// =========================================================================== // 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. // =========================================================================== global proc setSculptMeshCacheWireframeColor( ) { string $toolName = `currentCtx`; if (!`colorSliderGrp -exists sculptMeshWireframeColor_CSG` || !`sculptMeshCacheCtx -exists $toolName`) return; float $color[] = `colorSliderGrp -q -rgbValue sculptMeshWireframeColor_CSG`; sculptMeshCacheCtx -e -wireframeColor $color[0] $color[1] $color[2] $toolName; } global proc meshSculptBrushInfo(string $mode, string $brushInfo[]) { switch ($mode) { case "Sculpt": $brushInfo[4] = "1"; // Use stamps $brushInfo[3] = "1"; // Use invert $brushInfo[2] = "Sculpt"; $brushInfo[1] = "Sculpt.png"; $brushInfo[0] = "Sculpt Tool"; break; case "Smooth": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Smooth"; $brushInfo[1] = "Smooth.png"; $brushInfo[0] = "Smooth Tool"; break; case "Grab": $brushInfo[4] = "0"; $brushInfo[3] = "0"; $brushInfo[2] = "Grab"; $brushInfo[1] = "Grab.png"; $brushInfo[0] = "Grab Tool"; break; case "Pinch": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Pinch"; $brushInfo[1] = "Pinch.png"; $brushInfo[0] = "Pinch Tool"; break; case "Flatten": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Flatten"; $brushInfo[1] = "Flatten.png"; $brushInfo[0] = "Flatten Tool"; break; case "Foamy": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Foamy"; $brushInfo[1] = "Foamy.png"; $brushInfo[0] = "Foamy Tool"; break; case "Spray": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Spray"; $brushInfo[1] = "Spray.png"; $brushInfo[0] = "Spray Tool"; break; case "Repeat": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Repeat"; $brushInfo[1] = "Repeat.png"; $brushInfo[0] = "Repeat Tool"; break; case "Imprint": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Imprint"; $brushInfo[1] = "Imprint.png"; $brushInfo[0] = "Imprint Tool"; break; case "Wax": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Wax"; $brushInfo[1] = "Wax.png"; $brushInfo[0] = "Wax Tool"; break; case "Scrape": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Scrape"; $brushInfo[1] = "Scrape.png"; $brushInfo[0] = "Scrape Tool"; break; case "Fill": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Fill"; $brushInfo[1] = "Fill.png"; $brushInfo[0] = "Fill Tool"; break; case "Knife": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Knife"; $brushInfo[1] = "Knife.png"; $brushInfo[0] = "Knife Tool"; break; case "Smear": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Smear"; $brushInfo[1] = "Smear.png"; $brushInfo[0] = "Smear Tool"; break; case "Bulge": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Bulge"; $brushInfo[1] = "Bulge.png"; $brushInfo[0] = "Bulge Tool"; break; case "Amplify": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Amplify"; $brushInfo[1] = "Amplify.png"; $brushInfo[0] = "Amplify Tool"; break; case "Freeze": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Freeze"; $brushInfo[1] = "Freeze.png"; $brushInfo[0] = "Freeze Tool"; break; case "UV": $brushInfo[4] = "0"; $brushInfo[3] = "0"; $brushInfo[2] = "UV"; $brushInfo[1] = "UV_3D_Grab_Brush.png"; $brushInfo[0] = "3D UV Grab Tool"; break; case "Relax": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Relax"; $brushInfo[1] = "Relax.png"; $brushInfo[0] = "Relax Tool"; break; case "Erase": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "Erase"; $brushInfo[1] = "Erase.png"; $brushInfo[0] = "Erase Target Tool"; break; case "Mask": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Mask"; $brushInfo[1] = "Mask.png"; $brushInfo[0] = "Mask Target Tool"; break; case "SmoothTarget": $brushInfo[4] = "1"; $brushInfo[3] = "0"; $brushInfo[2] = "SmoothTarget"; $brushInfo[1] = "SmoothTarget.png"; $brushInfo[0] = "Smooth Target Tool"; break; case "Clone": $brushInfo[4] = "1"; $brushInfo[3] = "1"; $brushInfo[2] = "Clone"; $brushInfo[1] = "CloneTarget.png"; $brushInfo[0] = "Clone Target Tool"; break; default: $brushInfo[4] = "0"; $brushInfo[3] = "0"; $brushInfo[2] = "Sculpt"; $brushInfo[1] = "Sculpt.png"; $brushInfo[0] = "Sculpt Tool"; break; } } global proc sculptMeshCacheValues( string $toolName ) { string $parent = (`toolPropertyWindow -q -location` + "|sculptMeshCache"); setParent $parent; float $size = `sculptMeshCacheCtx -q -size $toolName`; float $strength = `sculptMeshCacheCtx -q -strength $toolName`; int $direction = 1 + (`sculptMeshCacheCtx -q -direction $toolName`); int $falloff = 1 + (`sculptMeshCacheCtx -q -falloffType $toolName`); string $mode = (`sculptMeshCacheCtx -q -mode $toolName`); int $inv = `sculptMeshCacheCtx -q -inverted $toolName`; int $dw = `sculptMeshCacheCtx -q -displayWireframe $toolName`; float $wa = `sculptMeshCacheCtx -q -wireframeAlpha $toolName`; float $wc[] = `sculptMeshCacheCtx -q -wireframeColor $toolName`; int $sf = `sculptMeshCacheCtx -q -displayFrozen $toolName`; int $sm = `sculptMeshCacheCtx -q -displayMask $toolName`; int $or = `sculptMeshCacheCtx -q -orientToSurface $toolName`; int $usd = `sculptMeshCacheCtx -q -useStampDistance $toolName`; float $sd = `sculptMeshCacheCtx -q -stampDistance $toolName`; float $bup = `sculptMeshCacheCtx -q -buildUpRate $toolName`; float $minSize = `sculptMeshCacheCtx -q -minSize $toolName`; float $minStrength = `sculptMeshCacheCtx -q -minStrength $toolName`; int $ugs = `sculptMeshCacheCtx -q -useGlobalSize $toolName`; $ugs = 1 - $ugs; int $uss = `sculptMeshCacheCtx -q -useSteadyStroke $toolName`; float $ssd = `sculptMeshCacheCtx -q -steadyStrokeDistance $toolName`; int $usi = `sculptMeshCacheCtx -q -useStampImage $toolName`; int $sos = `sculptMeshCacheCtx -q -stampOrientToStroke $toolName`; string $stampFile = (`sculptMeshCacheCtx -q -stampFile $toolName`); float $srot = `sculptMeshCacheCtx -q -stampRotation $toolName`; int $sfx = `sculptMeshCacheCtx -q -stampFlipX $toolName`; int $sfy = `sculptMeshCacheCtx -q -stampFlipY $toolName`; int $splac = 1 + (`sculptMeshCacheCtx -q -stampPlacement $toolName`); int $srand = `sculptMeshCacheCtx -q -stampRandomization $toolName`; int $srfx = `sculptMeshCacheCtx -q -stampRandomizeFlipX $toolName`; int $srfy = `sculptMeshCacheCtx -q -stampRandomizeFlipY $toolName`; float $srr = `sculptMeshCacheCtx -q -stampRandomizeRotation $toolName`; float $srsc = `sculptMeshCacheCtx -q -stampRandomizeScale $toolName`; float $srpx = `sculptMeshCacheCtx -q -stampRandomizePosX $toolName`; float $srpy = `sculptMeshCacheCtx -q -stampRandomizePosY $toolName`; float $srstr = `sculptMeshCacheCtx -q -stampRandomizeStrength $toolName`; int $stg = `falloffCurve -q -snapToGrid sculptFalloffCurve`; int $chs = `sculptMeshCacheCtx -q -cloneHideSource $toolName`; int $cm = 1 + (`sculptMeshCacheCtx -q -cloneMethod $toolName`); int $cts = `sculptMeshCacheCtx -q -constrainToSurface $toolName`; if( $mode == "Relax" || $mode == "Smear" || $mode == "Pinch" || $mode == "Grab" ) checkBoxGrp -edit -visible true -value1 $cts sculptMeshConstrainToSurface_CBG; else checkBoxGrp -edit -visible false sculptMeshConstrainToSurface_CBG; if( $mode == "Flatten" || $mode == "Wax" || $mode == "Scrape" || $mode == "Fill" || $mode == "Amplify" ) { int $updpl = `sculptMeshCacheCtx -q -updatePlane $toolName`; int $whstr = `sculptMeshCacheCtx -q -wholeStroke $toolName`; checkBoxGrp -edit -visible true -value1 $updpl sculptMeshUpdatePlane_CBG; checkBoxGrp -edit -visible true -value1 $whstr -enable $updpl sculptMeshWholeStroke_CBG; } else { checkBoxGrp -edit -visible false sculptMeshUpdatePlane_CBG; checkBoxGrp -edit -visible false sculptMeshWholeStroke_CBG; } checkBoxGrp -edit -value1 $usi sculptMeshUseStamp_CBG; checkBoxGrp -edit -value1 $sos -enable $usi sculptMeshStampOrientToStroke_CBG; checkBoxGrp -edit -value1 $sfx -enable $usi flipStampX_CBG; checkBoxGrp -edit -value1 $sfy -enable $usi flipStampY_CBG; button -edit -enable $usi rotateStamp_BTN; optionMenuGrp -e -select $splac -enable $usi sculptMeshStampPlacement_OMG; int $usr = $usi * $srand; if( $splac > 1 ) { $usi = 0; $usr = 0; } checkBoxGrp -edit -value1 $srand -enable $usi sculptMeshStampRandomization_CBG; checkBoxGrp -edit -value1 $srfx -enable $usr sculptMeshStampRandomizeFlipX_CBG; checkBoxGrp -edit -value1 $srfy -enable $usr sculptMeshStampRandomizeFlipY_CBG; floatSliderGrp -edit -value $srr -enable $usr sculptMeshStampRandomizeRotation_FSG; floatSliderGrp -edit -value $srsc -enable $usr sculptMeshStampRandomizeScale_FSG; floatSliderGrp -edit -value $srpx -enable $usr sculptMeshStampRandomizePosX_FSG; floatSliderGrp -edit -value $srpy -enable $usr sculptMeshStampRandomizePosY_FSG; floatSliderGrp -edit -value $srstr -enable $usr sculptMeshStampRandomizeStrength_FSG; if( $stampFile != "" ) { iconTextButton -e -image $stampFile stampFile_IMG; } else { iconTextButton -e -image "off.png" stampFile_IMG; } iconTextButton -e -rotation $srot -flipX $sfx -flipY $sfy stampFile_IMG; int $ssp = `sculptMeshCacheCtx -q -useScreenSpace $toolName`; $ssp = $ssp + 1; floatSliderGrp -e -value $size sculptMeshFalloffSize_FSG; floatSliderGrp -e -value $strength sculptMeshFalloffStrength_FSG; floatSliderGrp -e -value $minSize sculptMeshMinSize_FSG; floatSliderGrp -e -value $minStrength sculptMeshMinStrength_FSG; if( $mode == "Grab" ) { optionMenuGrp -e -visible false sculptMeshDirection_OMG; optionMenuGrp -e -visible true -select $direction sculptMeshGrabDirection_OMG; optionMenuGrp -e -visible false sculptMeshStampPlacement_OMG; } else { if( $mode == "Smooth" || $mode == "SmoothTarget" || $mode == "Relax" || $mode == "Smear" || $mode == "Pinch" || $mode == "Bulge" || $mode == "UV" || $mode == "Freeze" || $mode == "Erase" || $mode == "Mask" || $mode == "Clone" ) optionMenuGrp -e -visible false sculptMeshDirection_OMG; else optionMenuGrp -e -visible true -select $direction sculptMeshDirection_OMG; optionMenuGrp -e -visible false sculptMeshGrabDirection_OMG; optionMenuGrp -e -visible true sculptMeshStampPlacement_OMG; } rowLayout -e -visible ($mode != "Grab" && $mode != "Imprint") flood_ROW; rowLayout -e -visible ($mode == "Mask") unmaskAll_ROW; rowLayout -e -visible ($mode == "Mask") invertMask_ROW; columnLayout -e -visible ($mode == "Clone") cloneControls_COL; checkBoxGrp -e -value1 $chs sculptMeshCloneHideSource_CBG; optionMenuGrp -e -sl $cm sculptMeshCloneMethod_OMG; if ( $mode == "Clone" ) { if ( `optionMenuGrp -q -sl sculptMeshCloneTargetSource_OMG` == 1 ) { checkBoxGrp -e -enable false sculptMeshCloneHideSource_CBG; button -e -enable false sculptMeshFloodClone_BTN; } else { checkBoxGrp -e -enable true sculptMeshCloneHideSource_CBG; button -e -enable true sculptMeshFloodClone_BTN; } } int $affectAllLayers = `sculptMeshCacheCtx -q -affectAllLayers $toolName`; optionMenuGrp -e -select (2-$affectAllLayers) -visible ($mode == "Smooth") sculptMeshAffectAllLayers_OMG; int $twist = `sculptMeshCacheCtx -q -grabTwist $toolName`; checkBoxGrp -e -value1 $twist sculptMeshTwist_CBG; if( $mode == "Grab" ) { frameLayout -e -visible false stylusFrameLayout; checkBoxGrp -e -visible false sculptMeshUseStampSpacing_CBG; floatSliderGrp -e -visible false sculptMeshStampDistance_FSG; checkBoxGrp -e -visible false useSteadyStroke_CBG; floatSliderGrp -e -visible false steadyStrokeDistance_ISG; checkBoxGrp -e -visible true sculptMeshTwist_CBG; separator -e -visible true grabSeparator; int $gs = `sculptMeshCacheCtx -q -grabSilhouette $toolName`; checkBoxGrp -e -visible true -value1 $gs sculptMeshGrabSilhouette_CBG; int $fp = `sculptMeshCacheCtx -q -grabFollowPath $toolName`; checkBoxGrp -e -visible true -value1 $fp sculptMeshFollowPath_CBG; } else { frameLayout -e -visible true stylusFrameLayout; checkBoxGrp -e -visible true sculptMeshUseStampSpacing_CBG; floatSliderGrp -e -visible true sculptMeshStampDistance_FSG; checkBoxGrp -e -visible true useSteadyStroke_CBG; floatSliderGrp -e -visible true steadyStrokeDistance_ISG; checkBoxGrp -e -visible false sculptMeshTwist_CBG; separator -e -visible false grabSeparator; checkBoxGrp -e -visible false sculptMeshGrabSilhouette_CBG; checkBoxGrp -e -visible false sculptMeshFollowPath_CBG; } int $smooth = `sculptMeshCacheCtx -q -freezesmooth $toolName`; int $sap = `sculptMeshCacheCtx -q -freezesmoothandpaint $toolName`; if( $mode == "Freeze" ) { int $pm = 2; if( $sap ) $pm = 1; optionMenuGrp -e -visible true -select $pm sculptMeshPaintMethod_OMG; rowLayout -e -visible true unfreezeAll_ROW; rowLayout -e -visible true invertFreeze_ROW; } else { optionMenuGrp -e -visible ($mode == "Mask") sculptMeshPaintMethod_OMG; rowLayout -e -visible false unfreezeAll_ROW; rowLayout -e -visible false invertFreeze_ROW; } if( $mode == "Grab" || $mode == "Imprint" || $mode == "UV" ) { floatSliderGrp -e -visible false sculptMeshBuildUp_FSG; } else { floatSliderGrp -e -visible true -value $bup sculptMeshBuildUp_FSG; } int $lockshellborder = `sculptMeshCacheCtx -q -lockShellBorder $toolName`; if( $mode == "UV" ) { checkBoxGrp -e -visible true -value1 $lockshellborder sculptMeshLockShellBorder_CBG; } else { checkBoxGrp -e -visible false -value1 $lockshellborder sculptMeshLockShellBorder_CBG; } sculptMeshCacheMirrorValue; iconTextCheckBox -e -value $ugs sculptMeshRemember_ITCB; optionMenuGrp -e -select $falloff sculptMeshFalloffType_OMG; optionMenuGrp -e -select $ssp sculptMeshBrushSpace_OMG; string $brushInfo[]; meshSculptBrushInfo($mode, $brushInfo); toolPropertySetCommon $brushInfo[0] $brushInfo[1] $brushInfo[2]; toolPropertySelect sculptMeshCache; int $stampVis = $brushInfo[4]; frameLayout -e -visible $stampVis stampFrameLayout; string $nameField = `toolPropertyWindow -query -field`; text -edit -label `contextInfo -title $toolName` $nameField; string $reset = `toolPropertyWindow -query -resetButton`; button -edit -enable true -command ("sculptMeshCacheValues_ResetToolUI \"" + $toolName + "\"") $reset; int $invVis = $brushInfo[3]; checkBoxGrp -edit -value1 $inv -visible $invVis sculptMeshInvert_CBG; checkBoxGrp -edit -value1 $dw sculptMeshShowWireframe_CBG; checkBoxGrp -edit -value1 $sf sculptMeshShowFrozen_CBG; checkBoxGrp -edit -value1 $or sculptMeshOrient_CBG; floatSliderGrp -e -value $wa sculptMeshWireframeAlpha_FSG; colorSliderGrp -e -rgbValue $wc[0] $wc[1] $wc[2] sculptMeshWireframeColor_CSG; checkBoxGrp -edit -value1 $usd sculptMeshUseStampSpacing_CBG; floatSliderGrp -e -value $sd -enable $usd sculptMeshStampDistance_FSG; checkBoxGrp -edit -value1 $uss useSteadyStroke_CBG; floatSliderGrp -e -value $ssd -enable $uss steadyStrokeDistance_ISG; falloffCurve -e -asString `sculptMeshCacheCtx -q -sculptFalloffCurve $toolName` sculptFalloffCurve; if(`optionVar -exists "optionvarCustomCurves"`) { string $customsArray[] = `optionVar -q "optionvarCustomCurves"`; for($i = 0 ; $i