// =========================================================================== // 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. // proc string assembleCmd() { string $cmd; $cmd = "snapMode"; int $value = `radioButtonGrp -q -sl pixelSnapModeOption`; $cmd += " -pixelCenter "; $cmd += $value - 1; return $cmd; } global proc pixelSnapOptionsCallback(string $parent, int $doIt) { if ($doIt) { // Execute the command with the option settings. $cmd = `assembleCmd`; eval($cmd); } pixelSnapOptionsRefresh $parent; } global proc pixelSnapOptionsRefresh(string $parent) { setParent $parent; int $snapMode = `snapMode -q -pixelCenter`; // Recast the values to the selected items switch ($snapMode) { case 1: radioButtonGrp -e -sl 2 pixelSnapModeOption; break; case 0: radioButtonGrp -e -sl 1 pixelSnapModeOption; break; } } global proc pixelSnapOptionsSetup(string $parent, int $doIt) { setParent $parent; if ($doIt == false) { setUITemplate -pushTemplate OptionsTemplate; radioButtonGrp -nrb 2 -label (uiRes("m_performPixelSnapOptions.kPlacement")) -label1 (uiRes("m_performPixelSnapOptions.kSnapCorner")) -label2 (uiRes("m_performPixelSnapOptions.kSnapCenter")) pixelSnapModeOption; setUITemplate -popTemplate; } // Update the settings pixelSnapOptionsCallback ($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 pixelSnapOptions() { // Name of the command for this option box. // string $commandName = "pixelSnapOptions"; // 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 DefaultTemplate; // 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`; // 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_performPixelSnapOptions.kPixelSnapOptions")); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("texMoveUVShellTool"); // 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 performPixelSnapOptions(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: pixelSnapOptions; break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd`; break; } return $cmd; }