// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: 1998 // // Description: // global proc strokeOptionsCallback( string $parent, string $whichCallback) { global string $gCreatorWireCtx; string $whichCtx = $gCreatorWireCtx; setParent $parent; int $rval; int $ival; float $fval; switch( $whichCallback ) { case "Pmap1": case "Pmap2": case "Pmap3": if( $whichCallback == "Pmap1" ) $opt = `optionMenuGrp -q -v pressureMapping1`; else if( $whichCallback == "Pmap2" ) $opt = `optionMenuGrp -q -v pressureMapping2`; else $opt = `optionMenuGrp -q -v pressureMapping3`; if( $opt == (uiRes("m_paintEffectsProperties.kScale")) ) { $rval = 1; } else if( $opt == (uiRes("m_paintEffectsProperties.kWidth")) ) { $rval = 2; } else if( $opt == (uiRes("m_paintEffectsProperties.kSoftness")) ) { $rval = 3; } else if( $opt == (uiRes("m_paintEffectsProperties.kColor")) ) { $rval = 4; } else if( $opt == (uiRes("m_paintEffectsProperties.kTransparency")) ) { $rval = 5; } else if( $opt == (uiRes("m_paintEffectsProperties.kTubeWidth")) ) { $rval = 6; } else if( $opt == (uiRes("m_paintEffectsProperties.kTubeLength")) ) { $rval = 7; } else if( $opt == (uiRes("m_paintEffectsProperties.kIncandescence")) ) { $rval = 8; } else if( $opt == (uiRes("m_paintEffectsProperties.kGlowSpread")) ) { $rval = 9; } else if( $opt == (uiRes("m_paintEffectsProperties.kTubesPerStep")) ) { $rval = 10; } else if( $opt == (uiRes("m_paintEffectsProperties.kElevation")) ) { $rval = 11; } else if( $opt == (uiRes("m_paintEffectsProperties.kAzimuth")) ) { $rval = 12; } else if( $opt == (uiRes("m_paintEffectsProperties.kPathFollow")) ) { $rval = 13; } else if( $opt == (uiRes("m_paintEffectsProperties.kPathAttract")) ) { $rval = 14; } else if( $opt == (uiRes("m_paintEffectsProperties.kRandom")) ) { $rval = 15; } else if( $opt == (uiRes("m_paintEffectsProperties.kWiggle")) ) { $rval = 16; } else if( $opt == (uiRes("m_paintEffectsProperties.kCurl")) ) { $rval = 17; } else if( $opt == (uiRes("m_paintEffectsProperties.kNoise")) ) { $rval = 18; } else if( $opt == (uiRes("m_paintEffectsProperties.kTurbulence")) ) { $rval = 19; } else if( $opt == (uiRes("m_paintEffectsProperties.kNumTwigs")) ) { $rval = 20; } else if( $opt == (uiRes("m_paintEffectsProperties.kNumLeaves")) ) { $rval = 21; } else if( $opt == (uiRes("m_paintEffectsProperties.kNumPetals")) ) { $rval = 22; } else if( $opt == (uiRes("m_paintEffectsProperties.kSurfaceOffset")) ) { $rval = 23; } else { $rval = 0; } if( $whichCallback == "Pmap1" ) dynWireCtx -e -pm1 $rval $whichCtx; else if( $whichCallback == "Pmap2" ) dynWireCtx -e -pm2 $rval $whichCtx; else dynWireCtx -e -pm3 $rval $whichCtx; break; case "surfaceOffset": $fval = `floatSliderGrp -q -v "surfaceOffset"`; dynWireCtx -e -sof $fval $whichCtx; break; case "pressureMin1": $fval = `floatSliderGrp -q -v "pressureMin1"`; dynWireCtx -e -ps1 $fval $whichCtx; break; case "pressureMin2": $fval = `floatSliderGrp -q -v "pressureMin2"`; dynWireCtx -e -ps2 $fval $whichCtx; break; case "pressureMin3": $fval = `floatSliderGrp -q -v "pressureMin3"`; dynWireCtx -e -ps3 $fval $whichCtx; break; case "pressureMax1": $fval = `floatSliderGrp -q -v "pressureMax1"`; dynWireCtx -e -px1 $fval $whichCtx; break; case "pressureMax2": $fval = `floatSliderGrp -q -v "pressureMax2"`; dynWireCtx -e -px2 $fval $whichCtx; break; case "pressureMax3": $fval = `floatSliderGrp -q -v "pressureMax3"`; dynWireCtx -e -px3 $fval $whichCtx; break; case "displayQuality": $fval = `floatSliderGrp -q -v "displayQuality"`; dynWireCtx -e -dq $fval $whichCtx; break; } } proc string getMapping( int $index ) { string $str; switch( $index ) { case 1: $str = (uiRes("m_paintEffectsProperties.kScale")); break; case 2: $str = (uiRes("m_paintEffectsProperties.kWidth")); break; case 3: $str = (uiRes("m_paintEffectsProperties.kSoftness")); break; case 4: $str = (uiRes("m_paintEffectsProperties.kColor")); break; case 5: $str = (uiRes("m_paintEffectsProperties.kTransparency")); break; case 6: $str = (uiRes("m_paintEffectsProperties.kTubeWidth")); break; case 7: $str = (uiRes("m_paintEffectsProperties.kTubeLength")); break; case 8: $str = (uiRes("m_paintEffectsProperties.kIncandescence")); break; case 9: $str = (uiRes("m_paintEffectsProperties.kGlowSpread")); break; case 10: $str = (uiRes("m_paintEffectsProperties.kTubesPerStep")); break; case 11: $str = (uiRes("m_paintEffectsProperties.kElevation")); break; case 12: $str = (uiRes("m_paintEffectsProperties.kAzimuth")); break; case 13: $str = (uiRes("m_paintEffectsProperties.kPathFollow")); break; case 14: $str = (uiRes("m_paintEffectsProperties.kPathAttract")); break; case 15: $str = (uiRes("m_paintEffectsProperties.kRandom")); break; case 16: $str = (uiRes("m_paintEffectsProperties.kWiggle")); break; case 17: $str = (uiRes("m_paintEffectsProperties.kCurl")); break; case 18: $str = (uiRes("m_paintEffectsProperties.kNoise")); break; case 19: $str = (uiRes("m_paintEffectsProperties.kTurbulence")); break; case 20: $str = (uiRes("m_paintEffectsProperties.kNumTwigs")); break; case 21: $str = (uiRes("m_paintEffectsProperties.kNumLeaves")); break; case 22: $str = (uiRes("m_paintEffectsProperties.kNumPetals")); break; case 23: $str = (uiRes("m_paintEffectsProperties.kSurfaceOffset")); break; default: $str = (uiRes("m_paintEffectsProperties.kOff")); break; } return $str; } proc pressuremappings() { menuItem -label (uiRes("m_paintEffectsProperties.kOff")) aOff; menuItem -label (uiRes("m_paintEffectsProperties.kScale")) aScale; menuItem -label (uiRes("m_paintEffectsProperties.kWidth")) aWidth; menuItem -label (uiRes("m_paintEffectsProperties.kSoftness")) aSoftness; menuItem -label (uiRes("m_paintEffectsProperties.kColor")) aColor; menuItem -label (uiRes("m_paintEffectsProperties.kTransparency")) aTransparency; menuItem -label (uiRes("m_paintEffectsProperties.kTubeWidth")) aTubeWidth; menuItem -label (uiRes("m_paintEffectsProperties.kTubeLength")) aTubeLength; menuItem -label (uiRes("m_paintEffectsProperties.kIncandescence")) aIncandescence; menuItem -label (uiRes("m_paintEffectsProperties.kGlowSpread")) aGlowSpread; menuItem -label (uiRes("m_paintEffectsProperties.kTubesPerStep")) aTubesPerStep; menuItem -label (uiRes("m_paintEffectsProperties.kElevation")) aElevation; menuItem -label (uiRes("m_paintEffectsProperties.kAzimuth")) aAzimuth; menuItem -label (uiRes("m_paintEffectsProperties.kPathFollow")) aPathFollow; menuItem -label (uiRes("m_paintEffectsProperties.kPathAttract")) aPathAttract; menuItem -label (uiRes("m_paintEffectsProperties.kRandom")) aRandom; menuItem -label (uiRes("m_paintEffectsProperties.kWiggle")) aWiggle; menuItem -label (uiRes("m_paintEffectsProperties.kCurl")) aCurl; menuItem -label (uiRes("m_paintEffectsProperties.kNoise")) aNoise; menuItem -label (uiRes("m_paintEffectsProperties.kTurbulence")) aTurbulence; menuItem -label (uiRes("m_paintEffectsProperties.kNumTwigs")) aNumTwigs; menuItem -label (uiRes("m_paintEffectsProperties.kNumLeaves")) aNumLeaves; menuItem -label (uiRes("m_paintEffectsProperties.kNumPetals")) aNumPetals; menuItem -label (uiRes("m_paintEffectsProperties.kSurfaceOffset")) aSurfaceOffset; } global proc strokeOptionsUpdate( string $parent ) { string $str; global string $gCreatorWireCtx; string $whichCtx = $gCreatorWireCtx; setParent $parent; $str = getMapping( `dynWireCtx -q -pm1 $whichCtx` ); optionMenuGrp -e -v $str "pressureMapping1"; $str = getMapping( `dynWireCtx -q -pm2 $whichCtx` ); optionMenuGrp -e -v $str "pressureMapping2"; $str = getMapping( `dynWireCtx -q -pm3 $whichCtx` ); optionMenuGrp -e -v $str "pressureMapping3"; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { floatSliderGrp -e -v `dynWireCtx -q -sof $whichCtx` "surfaceOffset"; } floatSliderGrp -e -v `dynWireCtx -q -ps1 $whichCtx` "pressureMin1"; floatSliderGrp -e -v `dynWireCtx -q -ps2 $whichCtx` "pressureMin2"; floatSliderGrp -e -v `dynWireCtx -q -ps3 $whichCtx` "pressureMin3"; floatSliderGrp -e -v `dynWireCtx -q -px1 $whichCtx` "pressureMax1"; floatSliderGrp -e -v `dynWireCtx -q -px2 $whichCtx` "pressureMax2"; floatSliderGrp -e -v `dynWireCtx -q -px3 $whichCtx` "pressureMax3"; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { floatSliderGrp -e -v `dynWireCtx -q -dq $whichCtx` "displayQuality"; checkBoxGrp -e -v1 `dynWireCtx -q -pd $whichCtx` "paintAtDepth"; checkBoxGrp -e -v1 `dynWireCtx -q -dam $whichCtx` "drawAsMesh"; } } global proc paintEffectsProperties () { // // Description: // This procedure builds the property sheet and assigns callbacks to // its controls. The state of the controls are set in paintEffectsValues(). // // string $parent = `toolPropertyWindow -q -location`; setParent $parent; setUITemplate -pushTemplate OptionsTemplate; // create the top-level layout. This must have the // same name as the string returned from getClassName columnLayout -adj true paintEffects; $parent += "/paintEffects"; global string $gCreatorWireCtx; string $whichCtx = $gCreatorWireCtx; columnLayout -adj true dynPaint_Tab; // context options for dynPaint. // frameLayout -collapsable true -collapse false -label (uiRes("m_paintEffectsProperties.kStrokeSettings")) dynPaintFrame; columnLayout dynPaintOptions; separator -style "none"; $parent = `setParent -query`; if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) { checkBoxGrp -label "" -label1 (uiRes("m_paintEffectsProperties.kDrawAsMesh")) -ncb 1 -onc ("dynWireCtx -e -dam true " + $whichCtx) -ofc ("dynWireCtx -e -dam false " + $whichCtx) drawAsMesh; checkBoxGrp -label "" -label1 (uiRes("m_paintEffectsProperties.kPaintAtDepth")) -ncb 1 -onc ("dynWireCtx -e -pd true " + $whichCtx) -ofc ("dynWireCtx -e -pd false " + $whichCtx) paintAtDepth; separator -style "none"; floatSliderGrp -label (uiRes("m_paintEffectsProperties.kDisplayQuality")) -field true -min 0.0 -max 100.0 -fmn 0.0 -fmx 10000.0 -v 100.0 -precision 2 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"displayQuality\")") displayQuality; separator -style "none"; floatSliderGrp -label (uiRes("m_paintEffectsProperties.kSurfaceOffsetText")) -field true -min -1.0 -max 1.0 -fmn -10000 -fmx 10000.0 -v 0.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"surfaceOffset\")") surfaceOffset; } optionMenuGrp -label (uiRes("m_paintEffectsProperties.kPressureMapping1")) -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap1\")") pressureMapping1; pressuremappings(); floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMin1")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 0.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMin1\")") pressureMin1; floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMax1")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 1.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMax1\")") pressureMax1; optionMenuGrp -label (uiRes("m_paintEffectsProperties.kPressureMapping2")) -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap2\")") pressureMapping2; pressuremappings(); floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMin2")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 0.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMin2\")") pressureMin2; floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMax2")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 1.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMax2\")") pressureMax2; optionMenuGrp -label (uiRes("m_paintEffectsProperties.kPressureMapping3")) -cc ("strokeOptionsCallback(\""+$parent+"\",\"Pmap3\")") pressureMapping3; pressuremappings(); floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMin3")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 0.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMin3\")") pressureMin3; floatSliderGrp -label (uiRes("m_paintEffectsProperties.kPressureMax3")) -field true -min 0.0 -max 1.0 -fmn -10000.0 -fmx 10000.0 -v 1.0 -precision 4 -cc ("strokeOptionsCallback(\"" +$parent+"\",\"pressureMax3\")") pressureMax3; separator -style "none"; setParent ..; // dynPaintOptions setParent ..; // dynPaintFrame setParent ..; // dynPaint_Tab setUITemplate -popTemplate; strokeOptionsUpdate( $parent ); } global proc paintEffectsValues( string $toolName ){ // this method is exceptional, in that the values we are displaying // are not really tool-related. Therefore, this method can // be empty. string $helpTag = "PaintEffectsTool"; toolPropertySetCommon $toolName "paintEffectsTool.png" $helpTag; toolPropertySelect "paintEffects"; string $parent = `toolPropertyWindow -q -location`; strokeOptionsUpdate $parent; }