// =========================================================================== // 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. // =========================================================================== // Putty Tool UI script // global proc artPuttyOperationValues( string $artCommand, string $toolName ) { // // Sculpt Operation frameLayout // string $cmd = ($artCommand + " -q -mtm " + $toolName); string $operation = `eval $cmd`; symbolCheckBox -e -v 0 artPuttyPushIcon; symbolCheckBox -e -v 0 artPuttyPullIcon; symbolCheckBox -e -v 0 artPuttyRelaxIcon; symbolCheckBox -e -v 0 artPuttySmoothIcon; symbolCheckBox -e -v 0 artPuttyEraseIcon; symbolCheckBox -e -v 0 artPuttyPinchIcon; symbolCheckBox -e -v 0 artPuttySlideIcon; int $wantAutoSmooth = 0; int $wantSmoothStrength = 0; int $wantBrushStrength = 0; if ( $operation == "push" ) { symbolCheckBox -e -v 1 artPuttyPushIcon; $wantAutoSmooth = true; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "pull" ) { symbolCheckBox -e -v 1 artPuttyPullIcon; $wantAutoSmooth = true; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "relax" ) { symbolCheckBox -e -v 1 artPuttyRelaxIcon; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "smooth" ) { symbolCheckBox -e -v 1 artPuttySmoothIcon; $wantAutoSmooth = false; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "erase" ) { symbolCheckBox -e -v 1 artPuttyEraseIcon; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "pinch" ) { symbolCheckBox -e -v 1 artPuttyPinchIcon; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = true; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } else if ( $operation == "slide" ) { symbolCheckBox -e -v 1 artPuttySlideIcon; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = true; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); } if ($operation == "pinch" || $operation == "slide") { // Reference vector, max displacement // and seam/pole tolerance don't apply to pinch/slide radioButtonGrp -e -enable false rv0Radio; radioButtonGrp -e -enable false rv1Radio; radioButtonGrp -e -enable false rv2Radio; floatSliderGrp -e -enable false maxDisp; floatSliderGrp -e -enable false collapseCVTol; } else { radioButtonGrp -e -enable true rv0Radio; radioButtonGrp -e -enable true rv1Radio; radioButtonGrp -e -enable true rv2Radio; floatSliderGrp -e -enable true maxDisp; floatSliderGrp -e -enable true collapseCVTol; } // // Brush Strength frameLayout // $cmd = ($artCommand + " -q -brushStrength " + $toolName); floatSliderGrp -e -v `eval $cmd` artPuttyBrushStrength; // // Auto Smooth frameLayout // $cmd = ($artCommand + " -q -autosmooth " + $toolName); checkBoxGrp -e -v1 `eval $cmd` autoSmooth; $cmd = ($artCommand + " -q -smoothiters " + $toolName); intSliderGrp -e -v `eval $cmd` smoothStrength; artUpdateAutoSmoothSlider $artCommand ; // // Sculpt Variables frameLayout // $cmd = ($artCommand + " -q -refvector " + $toolName); string $refvector = `eval $cmd`; if ( $refvector == "normal" ) { radioButtonGrp -e -sl 1 rv0Radio; } else if ( $refvector == "firstnormal" ) { radioButtonGrp -e -sl 2 rv0Radio; } else if ( $refvector == "view" ) { radioButtonGrp -e -sl 3 rv0Radio; } else if ( $refvector == "xaxis" ) { radioButtonGrp -e -sl 1 rv1Radio; } else if ( $refvector == "yaxis" ) { radioButtonGrp -e -sl 2 rv1Radio; } else if ( $refvector == "zaxis" ) { radioButtonGrp -e -sl 3 rv1Radio; } else if ( $refvector == "uisoparm" ) { radioButtonGrp -e -sl 1 rv2Radio; } else if ( $refvector == "visoparm" ) { radioButtonGrp -e -sl 2 rv2Radio; } else if ( $refvector == "uvvector" ) { radioButtonGrp -e -sl 3 rv2Radio; } $cmd = ($artCommand + " -q -dragSlider " + $toolName); string $dragSlider = eval($cmd); checkBox -e -v ($dragSlider == "uvvector") rvUVVect; updateUandVSculptDirection( $artCommand ); $cmd = ($artCommand + " -q -maxdisp " + $toolName); floatSliderGrp -e -v `eval $cmd` maxDisp; $cmd = ($artCommand + " -q -collapsecvtol " + $toolName); floatSliderGrp -e -v `eval $cmd` collapseCVTol; // // Surface frameLayout // $cmd = ($artCommand + " -q -refsurface " + $toolName); checkBox -e -v `eval $cmd` refSurfaceChk; $cmd = ($artCommand + " -q -erasesrfupd " + $toolName); checkBox -e -v `eval $cmd` eraseSurfaceChk; } global proc artUpdatePuttyUIStates( int $wantAutoSmooth, int $wantSmoothStrength, int $wantBrushStrength ) { if( $wantAutoSmooth ) { $wantSmoothStrength = true; } int $smoothLayoutVis = ($wantAutoSmooth || $wantSmoothStrength); columnLayout -e -vis $wantBrushStrength artPuttyBrushStrengthLayout; floatSliderGrp -e -enable $wantBrushStrength artPuttyBrushStrength; columnLayout -e -vis $smoothLayoutVis artPuttySmoothStrengthLayout; checkBoxGrp -e -enable $wantAutoSmooth -vis $wantAutoSmooth autoSmooth; intSliderGrp -e -enable $wantSmoothStrength -vis $wantSmoothStrength smoothStrength; } global proc artUpdatePuttyOperation(string $artCommand, string $oper) { string $cmd ; switch ( $oper ) { // for push and pull user can choose to enable/disable auto smooth case "push": $cmd = $artCommand + " -e -mtm \"push\" `currentCtx`" ; $wantAutoSmooth = true; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break ; case "pull": $cmd = $artCommand + " -e -mtm \"pull\" `currentCtx`" ; $wantAutoSmooth = true; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break ; case "smooth" : $cmd = $artCommand + " -e -mtm \"smooth\" `currentCtx`" ; // for smooth operation we always use smooth strength. // so there is no use of auto smooth check box. $wantAutoSmooth = false; $wantSmoothStrength = true; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break ; case "erase" : // for erase operation there is no use of auto smooth and smooth strength. $cmd = $artCommand + " -e -mtm \"erase\" `currentCtx`" ; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break ; case "relax" : // for relax operation there is no use of auto smooth and smooth strength. $cmd = $artCommand + " -e -mtm \"relax\" `currentCtx`" ; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = false; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break; case "pinch" : // for pinch operation there is no use of auto smooth and smooth strength. $cmd = $artCommand + " -e -mtm \"pinch\" `currentCtx`" ; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = true; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break; case "slide" : // for slide operation there is no use of auto smooth and smooth strength. $cmd = $artCommand + " -e -mtm \"slide\" `currentCtx`" ; $wantAutoSmooth = false; $wantSmoothStrength = false; $wantBrushStrength = true; artUpdatePuttyUIStates( $wantAutoSmooth, $wantSmoothStrength, $wantBrushStrength ); break; } eval ($cmd); } global proc artUpdateAutoSmoothSlider( string $artCommand ) // // Description: // // For smooth operation the smooth Strength slider should be enabled always. // For push and pull operations it should be enabled ONLY if auto smooth option is ON. // For erase operation it should be always disabled. // { int $enableSmoothStrength ; $cmd = ($artCommand + " -q -mouldtypemouse " + `currentCtx`); string $opType = `eval $cmd` ; if( $opType == "smooth" ) $enableSmoothStrength = true ; else if( $opType == "erase" ) $enableSmoothStrength = false ; else { string $cmd = ($artCommand + " -q -autosmooth " + `currentCtx`); $enableSmoothStrength = `eval $cmd` ; } intSliderGrp -e -enable $enableSmoothStrength smoothStrength ; } // ======================================================= // Main callback procedure. // ======================================================= global proc artPuttyValues( string $toolName ) { source "artisanCallback.mel"; source "artisanValues.mel"; source "artAttrValues.mel"; string $artCommand = "artPuttyCtx"; string $currContext = `currentCtx`; string $currTool = `contextInfo -c $currContext`; // Provide a different icon for different attribute tools. string $icon = "putty.png"; string $helpTag = "SculptGeometryTool"; string $parent = (`toolPropertyWindow -q -location` + "|artPutty"); setParent $parent; toolPropertySetCommon $toolName $icon $helpTag; // Brush frameLayout values. artisanBrushValues( $artCommand, $currTool ); // Stroke frameLayout values. artisanStrokeValues( $artCommand, $currTool ); // Stylus Pressure frameLayout values. artisanPressureValues( $artCommand, $currTool ); // artPuttyOperationValues( $artCommand, $toolName) ; // Attribute Maps frameLayout values. artisanAttrMapValues( $artCommand, $currTool ); // Display frameLayout values. artisanDisplayValues( $artCommand, $currTool ); toolPropertySelect artPutty; }