// =========================================================================== // 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: Nov 24, 19987 // // Description: // This script is use to display and update the move shell tool options. // // Input Arguments: // None. // // Return Value: // None. // // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // proc string assembleCmd() { string $cmd; string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; int $colorMode = `radioButtonGrp -q -sl uvShadeColorMode`; int $seed = `intSliderGrp -query -value uvShadeMultiColorSeed`; float $alpha = `floatSliderGrp -query -value uvShadeMultiColorAlpha`; float $front[] = `colorSliderGrp -query -rgb uvShadeFrontColor`; float $alpha1 = `floatSliderGrp -query -value uvShadeFrontAlpha`; float $back[] = `colorSliderGrp -query -rgb uvShadeBackColor`; float $alpha2 = `floatSliderGrp -query -value uvShadeBackAlpha`; int $s3d = `checkBoxGrp -query -v1 uvShadeIn3dViewport`; int $ast = `checkBoxGrp -query -v1 uvShadeActiveSelectionOnTop`; $cmd = "textureWindow -edit"; $cmd += " -solidMapPerShell "; $cmd += 2 - $colorMode; $cmd += " -solidMapColorSeed"; $cmd += " " + $seed; $cmd += " -multiColorAlpha"; $cmd += " " + $alpha; $cmd += " -frontFacingColor"; $cmd += " " + $front[0]; $cmd += " " + $front[1]; $cmd += " " + $front[2]; $cmd += " " + $alpha1; $cmd += " -backFacingColor"; $cmd += " " + $back[0]; $cmd += " " + $back[1]; $cmd += " " + $back[2]; $cmd += " " + $alpha2; $cmd += " -solidMap3dView"; $cmd += " " + $s3d; $cmd += " -activeSelectionOnTop"; $cmd += " " + $ast; $cmd += " " +$texWinName[0]; return $cmd; } global proc mapShadeOptionsCallback(string $parent, int $doIt) { if ($doIt) { // Execute the command with the option settings. $cmd = `assembleCmd`; eval($cmd); } mapShadeOptionsRefresh $parent; } global proc mapShadeOptionsRefresh(string $parent) { setParent $parent; string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; int $colorMode = `textureWindow -q -solidMapPerShell $texWinName[0]`; radioButtonGrp -e -sl (2 - $colorMode) uvShadeColorMode; intSliderGrp -e -en $colorMode uvShadeMultiColorSeed; floatSliderGrp -e -en $colorMode uvShadeMultiColorAlpha; int $seed = `textureWindow -q -solidMapColorSeed $texWinName[0]`; intSliderGrp -e -v $seed uvShadeMultiColorSeed; float $alpha = `textureWindow -q -multiColorAlpha $texWinName[0]`; floatSliderGrp -e -v $alpha uvShadeMultiColorAlpha; colorSliderGrp -e -en (!$colorMode) uvShadeFrontColor; floatSliderGrp -e -en (!$colorMode) uvShadeFrontAlpha; colorSliderGrp -e -en (!$colorMode) uvShadeBackColor; floatSliderGrp -e -en (!$colorMode) uvShadeBackAlpha; float $front[] = `textureWindow -q -frontFacingColor $texWinName[0]`; float $back[] = `textureWindow -q -backFacingColor $texWinName[0]`; if (size($front) == 4) { colorSliderGrp -e -rgb $front[0] $front[1] $front[2] uvShadeFrontColor; floatSliderGrp -e -value $front[3] uvShadeFrontAlpha; } if (size($back) == 4) { colorSliderGrp -e -rgb $back[0] $back[1] $back[2] uvShadeBackColor; floatSliderGrp -e -value $back[3] uvShadeBackAlpha; } int $s3d = `textureWindow -q -solidMap3dView $texWinName[0]`; checkBoxGrp -e -v1 $s3d uvShadeIn3dViewport; int $ast = `textureWindow -q -activeSelectionOnTop $texWinName[0]`; checkBoxGrp -e -v1 $ast uvShadeActiveSelectionOnTop; } global proc mapShadeOptionsSetup(string $parent, int $forceFactorySettings) { setParent $parent; if ($forceFactorySettings) { string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; textureWindow -e -solidMapPerShell 0 -solidMapColorSeed 1 -multiColorAlpha 0.25 -frontFacingColor 0.0 0.0 1.0 0.25 -backFacingColor 1.0 0.0 0.0 0.25 -solidMap3dView 1 -activeSelectionOnTop 1 $texWinName[0]; } // Update the settings mapShadeOptionsCallback ($parent, false); } global proc mapShaderColorModePresets() { int $enableFrontBackColor = `radioButtonGrp -q -sl uvShadeColorMode` - 1; colorSliderGrp -e -en $enableFrontBackColor uvShadeFrontColor; floatSliderGrp -e -en $enableFrontBackColor uvShadeFrontAlpha; colorSliderGrp -e -en $enableFrontBackColor uvShadeBackColor; floatSliderGrp -e -en $enableFrontBackColor uvShadeBackAlpha; intSliderGrp -e -en (!$enableFrontBackColor) uvShadeMultiColorSeed; floatSliderGrp -e -en (!$enableFrontBackColor) uvShadeMultiColorAlpha; } // Procedure Name: // tvSudgeToolOptions // // Description: // Construct the option box UI. Involves accessing the standard option // box and customizing the UI accordingly. // // Input Arguments: // None. // // Return Value: // None. // proc uvShadeOptions() { // Name of the command for this option box. // string $commandName = "mapShadeOptions"; // Build the option box actions. // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // STEP 1: Get the option box. // ============================ // // The value returned is the name of the layout to be used as // the parent for the option box UI. // string $layout = getOptionBox(); setParent $layout; // STEP 2: Pass the command name to the option box. // ================================================= // // Any default option box behaviour based on the command name is set // up with this call. For example, updating the 'Help' menu item with // the name of the command. // setOptionBoxCommandName($commandName); // STEP 3: Activate the default UI template. // ========================================== // // Activate the default UI template so that the layout of this // option box is consistent with the layout of the rest of the // application. // setUITemplate -pushTemplate OptionBoxTemplate; // STEP 4: Create option box contents. // =================================== // // This, of course, will vary from option box to option box. // Turn on the wait cursor. // waitCursor -state 1; tabLayout -tabsVisible 0 -scrollable 1; string $parent = `columnLayout -adjustableColumn 1`; columnLayout textureMoveUV; frameLayout -collapsable true -collapse false -label (uiRes("m_performOverlayUVOptions.kColorSettings")) texShadeSettingFrame; columnLayout textureSmudgeDeformOptions; separator -style "none"; radioButtonGrp -nrb 2 -vr -label (uiRes("m_performOverlayUVOptions.kColorMode")) -label1 (uiRes("m_performOverlayUVOptions.kMultiColor")) -label2 (uiRes("m_performOverlayUVOptions.kFrontBackFacing")) -cc mapShaderColorModePresets uvShadeColorMode; intSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeMultiColorSeed")) -min 1 -max 100 -fieldMaxValue 10000 uvShadeMultiColorSeed; floatSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeMultiColorAlpha")) uvShadeMultiColorAlpha; colorSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeFrontColor")) uvShadeFrontColor; floatSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeFrontAlpha")) uvShadeFrontAlpha; colorSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeBackColor")) uvShadeBackColor; floatSliderGrp -label (uiRes("m_performOverlayUVOptions.kUVShadeBackAlpha")) uvShadeBackAlpha; setParent ..; setParent ..; frameLayout -label (uiRes("m_performOverlayUVOptions.kDisplaySettings")) -collapsable true -collapse false; columnLayout; separator -style "none"; checkBoxGrp -label1 (uiRes("m_performOverlayUVOptions.kUVShadeIn3dViewport")) -numberOfCheckBoxes 1 uvShadeIn3dViewport; checkBoxGrp -label1 (uiRes("m_performOverlayUVOptions.kUVShadeActiveSelectionOnTop")) -numberOfCheckBoxes 1 uvShadeActiveSelectionOnTop; setParent ..; setParent ..; setParent ..; // Turn off the wait cursor. // waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // // Provide more descriptive labels for the buttons. This is not // necessary, but in some cases, for example, a button labelled // 'Create' may be more meaningful to the user than one labelled // 'Apply'. // // Disable those buttons that are not applicable to the option box. // // Attach actions to those buttons that are applicable to the option // box. Note that the 'Close' button has a default action attached // to it that will hide the window. If a a custom action is // attached to the 'Close' button then be sure to call the 'hide the // option box' procedure within the custom action so that the option // box is hidden properly. // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 1 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Step 7: Set the option box title. // ================================= // setOptionBoxTitle (uiRes("m_performOverlayUVOptions.kColorShadeOptions")); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("UVOverlay"); // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } // // Procedure Name: // performOverlayUVOptions // // Description: // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // global proc string performOverlayUVOptions(int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // eval($cmd); break; // Show the option box. // case 1: uvShadeOptions; break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd`; break; } return $cmd; }