// =========================================================================== // 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: Dec 3, 1996 // // Description: // This script is a template script for option box dialogs. // // Input Arguments: // None. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { if( $forceFactorySettings || !`optionVar -exists detachDeleteHistory` ) { // default detachDeleteHistory of 1 means delete bindSkin history // during detach // optionVar -intValue detachDeleteHistory 1; } if( $forceFactorySettings || !`optionVar -exists detachSkinColorJts` ) { optionVar -intValue detachSkinColorJts 1; } } global proc detachSkinSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars( $forceFactorySettings ); setParent $parent; // Query the optionVar's and set the values into the controls // optionMenuGrp -e -sl `optionVar -query detachDeleteHistory` detachDeleteHistory; // color joints option // int $colorJoints = `optionVar -query detachSkinColorJts`; checkBoxGrp -e -value1 $colorJoints detachSkinColorJtsWidget; historyModeCallback(); } global proc detachSkinCallback (string $parent, int $doIt) // // Description: // Set the optionVar's from the control values, and then perform // the command // { setParent $parent; optionVar -intValue detachDeleteHistory `optionMenuGrp -q -sl detachDeleteHistory`; optionVar -intValue detachSkinColorJts `checkBoxGrp -q -value1 detachSkinColorJtsWidget`; if ($doIt) { performDetachSkin false; addToRecentCommandQueue "performDetachSkin false" "Detach Skin"; } } global proc historyModeCallback() { int $mode = `optionMenuGrp -q -sl detachDeleteHistory`; if (2 == $mode) { // cannot remove skin colors when you keep history so disable // the widget // checkBoxGrp -e -enable false detachSkinColorJtsWidget; } else { checkBoxGrp -e -enable true detachSkinColorJtsWidget; } } proc string detachSkinBasic( string $tabLayout ) { setUITemplate -pushTemplate DefaultTemplate; setParent $tabLayout; string $tabForm = `columnLayout -adjustableColumn true`; optionMenuGrp -label (uiRes("m_performDetachSkin.kHistory")) -cc "historyModeCallback" detachDeleteHistory; menuItem -label (uiRes("m_performDetachSkin.kDeleteHistory")) ; menuItem -label (uiRes("m_performDetachSkin.kKeepHistory")) ; menuItem -label (uiRes("m_performDetachSkin.kBakeHistory")) ; setParent -m ..; optionMenuGrp -e -sl 1 detachDeleteHistory; checkBoxGrp -label (uiRes("m_performDetachSkin.kColoring")) -label1 (uiRes("m_performDetachSkin.kRemoveJointColors")) -numberOfCheckBoxes 1 detachSkinColorJtsWidget; setUITemplate -popTemplate; return $tabForm; } global proc detachSkinOptions () { // Name of the command for this option box // string $commandName = "detachSkin"; // Title for the option box window // string $optionBoxTitle = (uiRes("m_performDetachSkin.kDetachSkinOptions")); // Title for the apply button // string $applyTitle = (uiRes("m_performDetachSkin.kDetach")); // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // Build the window, with a tab layout // string $widgetList[] = `getStandardWindow $optionBoxTitle 0 "noOptions"`; // Make the form invisible while we create the widgets in the window // formLayout -e -vis false $widgetList[1]; string $basicTab = `detachSkinBasic $widgetList[2]`; // Attach the standard buttons // string $buttonList[] = `addStandardButtons $commandName $applyTitle $widgetList[1] $widgetList[2] "noOptions"`; // attach commands to the standard buttons // // Save and Close Button button -e -c ($callback + " " + $widgetList[0] + " " + false + "; hideOptionBox()") $buttonList[3]; // Close button button -edit -command hideOptionBox $buttonList[2]; // Reset Button button -edit -c ($setup + " " + $widgetList[0] + " true") $buttonList[1]; // Do it button button -e -c ($callback + " " + $widgetList[0] + " " + true) $buttonList[0]; // Fill out the help menu item // setOptionBoxHelpTag( "DetachSkin" ); // Make the form layout visible so we can see what we built, and // reset the template // formLayout -e -vis true $widgetList[1]; // Call the setup "method" to fill in the current settings // eval (($setup + " " + $widgetList[0] + " false")); showOptionBox(); showWindow $widgetList[0]; } proc string assembleCmd() { string $cmd; setOptionVars(false); $cmd = "doDetachSkin \"2\" { " + "\"" + `optionVar -query detachDeleteHistory` + "\"," + "\"" + `optionVar -query detachSkinColorJts` + "\" };"; return $cmd; } global proc string performDetachSkin (int $action) // The action variable means // 0 - do the command // 1 - show the option box // 2 - return the drag command { string $result; string $cmd = ""; switch ($action) { case 0: // Execute the command // Get the command $cmd = `assembleCmd`; // Execute the command with the option settings evalEcho($cmd); break; case 1: // Do the option box detachSkinOptions; break; case 2: // Return the drag string // Get the command $cmd = `assembleCmd`; break; } return $cmd; }