// =========================================================================== // 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: January 2000 // // Description: // This script is the create pose option box dialog. // // Input Arguments: // None. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { // Pose name // if ($forceFactorySettings || !`optionVar -exists createPoseName`) { optionVar -stringValue createPoseName "pose1"; } } // // Procedure Name: // createPoseSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc createPoseSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars( $forceFactorySettings ); setParent $parent; // name // string $name = `optionVar -query createPoseName`; textFieldGrp -edit -text $name poseNameWidget; } // // Procedure Name: // createPoseCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc createPoseCallback (string $parent, int $doIt) { setParent $parent; // Name // optionVar -stringValue createPoseName `textFieldGrp -query -text poseNameWidget`; if ($doIt) { performCreatePose false; addToRecentCommandQueue "performCreatePose false" "CreatePose"; } } proc string createPoseWidgets( string $parent ) { setParent $parent; string $tabForm = `columnLayout -adjustableColumn true`; textFieldGrp -label (uiRes("m_performCreatePose.kName")) -text "pose1" poseNameWidget; return $tabForm; } global proc createPoseOptions () { string $commandName = "createPose"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // 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; setOptionBoxCommandName("pose"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scrollable true -tabsVisible false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; createPoseWidgets $parent; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performCreatePose.kCreatePose")) -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle((uiRes("m_performCreatePose.kCreatePoseOptions"))); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "CreatePose" ); // Set the current values of the option box. // eval (($setup + " " + $parent + " " + 0)); // Show the option box. // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd; setOptionVars(false); // get the partition name string $poseName = "pose1"; if (`optionVar -exists createPoseName`) { $poseName = `optionVar -query createPoseName`; } // doCreatePoseArgList takes a string array // $cmd = "doCreatePoseArgList 2 { " + "\"" + $poseName + "\"" + // ",\"" + $excludeTranslate + "\"" + " };"; return $cmd; } // // Procedure Name: // performCreatePose // // Description: // Create a pose and add the animatable attributes from the // selected nodes. This procedure will also show the option box // window if necessary as well as construct the command string // that will create a pose with the current option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performCreatePose (int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // setOptionVars(false); // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // evalEcho($cmd); break; // Show the option box. // case 1: createPoseOptions; break; case 2: // Get the command. // $cmd = `assembleCmd`; } return $cmd; }