// =========================================================================== // 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: Jan. 30, 1997 // // Description: // This script is for assuming prefAngle(a joint command executed). // // Input Arguments: // string showOptionBox true - show the option box dialog // false - just execute the command // // Return Value: // None. // if ( !`exists prefAngleSetOptionVars` ) { source prefAngleTabBasic; } global proc prefAngleAssumeCallback( string $parent, int $doIt ) { setParent $parent; // Set the optionVar's from the control values, and then perform command // optionVar -intValue recursive (`radioButtonGrp -q -sl recursive` - 1); if( $doIt ) { performAssumePrefAngle false; addToRecentCommandQueue "performAssumePrefAngle false" "AssumePrefAngle"; } } proc assumePrefAngleOptions() { string $cmdName = "joint"; string $funcName = "prefAngle"; string $callback = ($funcName + "AssumeCallback"); string $setup = ($funcName + "Setup"); // Get the option box. // string $layout = getOptionBox(); // call prefAngleTabBasic to build UI. // string $parent = `prefAngleTabBasic $layout`; // Pass the command name to the option box. // setOptionBoxCommandName($cmdName); // 'Apply' button. // string $buttonW = getOptionBoxApplyBtn(); button -e -label (uiRes("m_performAssumePrefAngle.kAssume")) -command ($callback + " " + $parent + " " + 1) $buttonW; // 'Save' button. // $buttonW = getOptionBoxSaveBtn(); button -e -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $buttonW; // 'Reset' button. // $buttonW = getOptionBoxResetBtn(); button -e -command ($setup + " " + $parent + " " + 1) $buttonW; // Set the option box title. // setOptionBoxTitle (uiRes("m_performAssumePrefAngle.kAssumePreferredAngleOptions")); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "AssumePreferredAngle" ); // Call the setup "method" to fill in the current settings // eval( ($setup + " " + $parent + " " + 0) ); // Show the option box. // showOptionBox(); } proc string assumePrefAngleHelp() { return " Command: assume joints preferred angle.\n"; } proc string assembleCmd() { prefAngleSetOptionVars( false ); int $isRecursive = `optionVar -q recursive`; // execute a joint cmd to set prefAngle. // string $cmdString; if ( $isRecursive ) $cmdString = "joint -e -apa -ch"; else $cmdString = "joint -e -apa"; return $cmdString; } // // Procedure Name: // performAssumePrefAngle // // Description: // Perform the joint command to assume joints' preferred angle using // the corresponding option values. This procedure will also show the // option box window if necessary as well as construct the command string // that will invoke the joint command with the current option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // global proc string performAssumePrefAngle( int $action ) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // prefAngleSetOptionVars( false ); $cmd = `assembleCmd`; evalEcho($cmd); break; // Show the option box. // case 1: assumePrefAngleOptions; break; // Return the command string. // case 2: // Retrieve the option settings. // prefAngleSetOptionVars( false ); $cmd = `assembleCmd`; break; } return $cmd; }