// =========================================================================== // 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: Mar 30, 2005 // // Description: // This script is use to display and update the UV distortion options. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd; string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; int $value = `radioButtonGrp -q -sl uvDistortionModeOption`; float $alpha = `floatSliderGrp -q -value uvDistortionAlpha`; int $ast = `checkBoxGrp -query -v1 uvDistortionActiveSelectionOnTop`; $cmd = "textureWindow -e -distortionPerObject "; $cmd += $value - 1; $cmd += " -distortionAlpha"; $cmd += " " + $alpha; $cmd += " -activeSelectionOnTop"; $cmd += " " + $ast; $cmd += " " + $texWinName[0]; return $cmd; } global proc uvDistortionOptionsCallback(string $parent, int $doIt) { if ($doIt) { // Execute the command with the option settings. $cmd = `assembleCmd`; eval($cmd); } uvDistortionOptionsRefresh $parent; } global proc uvDistortionOptionsRefresh(string $parent) { setParent $parent; string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; int $distortionBasis = `textureWindow -q -distortionPerObject $texWinName[0]`; // Recast the values to the selected items switch ($distortionBasis) { case 1: radioButtonGrp -e -sl 2 uvDistortionModeOption; break; case 0: radioButtonGrp -e -sl 1 uvDistortionModeOption; break; } float $alpha = `textureWindow -q -distortionAlpha $texWinName[0]`; floatSliderGrp -e -value $alpha uvDistortionAlpha; int $ast = `textureWindow -q -activeSelectionOnTop $texWinName[0]`; checkBoxGrp -e -v1 $ast uvDistortionActiveSelectionOnTop; } global proc uvDistortionOptionsSetup(string $parent, int $forceFactorySettings) { setParent $parent; if ($forceFactorySettings) { string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; textureWindow -e -distortionPerObject 0 -distortionAlpha 0.8 -activeSelectionOnTop 1 $texWinName[0]; } // Update the settings uvDistortionOptionsCallback ($parent, false); } // 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 uvDistortionOptions() { // Name of the command for this option box. // string $commandName = "uvDistortionOptions"; // 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_performUVDistortionOptions.kColorSettings")) texDistortionSettingFrame; radioButtonGrp -nrb 2 -label (uiRes("m_performUVDistortionOptions.kShadingOptions")) -label1 (uiRes("m_performUVDistortionOptions.kPerShell")) -label2 (uiRes("m_performUVDistortionOptions.kPerObject")) uvDistortionModeOption; floatSliderGrp -label (uiRes("m_performUVDistortionOptions.kUVDistortionAlpha")) uvDistortionAlpha; setParent ..; setParent ..; frameLayout -label (uiRes("m_performUVDistortionOptions.kDisplaySettings")) -collapsable true -collapse false; columnLayout; separator -style "none"; checkBoxGrp -label1 (uiRes("m_performUVDistortionOptions.kUVDistortionActiveSelectionOnTop")) -numberOfCheckBoxes 1 uvDistortionActiveSelectionOnTop; 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_performUVDistortionOptions.kUVDistortionOptions")); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag( "UVDistortion" ); // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } // // Procedure Name: // performUVDistortionOptions // // Description: // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // global proc string performUVDistortionOptions(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: uvDistortionOptions; break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd`; break; } return $cmd; }