// =========================================================================== // 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. // =========================================================================== // // Description: // This is a helper script to perform the show buffer curves command // using the various options that have been set // // Input Arguments: // string showOptionBox true - show the option box dialog // false - just execute the command // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists optionVarBufferCurveSelectKey`) { optionVar -intValue optionVarBufferCurveSelectKey 1; } } global proc bufferCurvesSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars ($forceFactorySettings); setParent $parent; checkBox -e -value `optionVar -query optionVarBufferCurveSelectKey` selectOnDeletionCheckbox; } global proc bufferCurvesCallback( string $parent, int $doIt, string $graphEd) { setParent $parent; // screenBased // optionVar -intValue optionVarBufferCurveSelectKey `checkBox -query -value selectOnDeletionCheckbox`; if( $doIt ) { performShowBufferCurves ( 0, $graphEd ); addToRecentCommandQueue ("performShowBufferCurves 0 \"" + $graphEd + "\"") "Show Buffer Curves"; } } proc string bufferCurvesWidgets( string $tabLayout ) { setParent $tabLayout; string $tabForm = `columnLayout -adjustableColumn true`; frameLayout -label (uiRes("m_performShowBufferCurves.kPerformanceOptions")) -labelVisible true -borderVisible false -collapsable false -marginWidth 10 -marginHeight 5 optionsFrame; checkBox -label (uiRes("m_performShowBufferCurves.kSelectOnDeletion")) selectOnDeletionCheckbox; setParent ..; return $tabForm; } proc bufferCurvesOptions( string $graphEd ) { // Customisation options // // Name of the command for this option box (think of it as the base class) string $commandName = "bufferCurves"; // Title for the option box window string $optionBoxTitle = (uiRes("m_performShowBufferCurves.kShowResultsOptions")); // Title for the apply button string $applyTitle = (uiRes("m_performShowBufferCurves.kShowResults")); // 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"`; setUITemplate -pushTemplate DefaultTemplate; // Make the form invisible while we create the widgets in the window // formLayout -e -vis false $widgetList[1]; // Attach each tab // bufferCurvesWidgets $widgetList[2]; // Attach the standard buttons // string $buttonList[] = `addStandardButtons $commandName $applyTitle $widgetList[1] $widgetList[2] "noOptions"`; // attach commands to the standard buttons // // Save // button -e -c ($callback + " " + $widgetList[0] + " false " + $graphEd + "; hideOptionBox()") $buttonList[3]; // Close // button -edit -command hideOptionBox $buttonList[2]; // Reset // button -edit -command ($setup + " " + $widgetList[0] + " true") $buttonList[1]; // Do It // button -edit -command ($callback + " " + $widgetList[0] + " true " + $graphEd) $buttonList[0]; // Make the form layout visible so we can see what we built, and // reset the template // formLayout -e -vis true $widgetList[1]; setUITemplate -popTemplate; // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "GraphShowBufferCurveOptions" ); // Call the setup "method" to fill in the current settings // eval (($setup + " " + $widgetList[0] + " false")); showOptionBox(); showWindow $widgetList[0]; } proc string assembleCmd( string $graphEd ) { // Retrieve the option settings // setOptionVars(false); string $cmd = "doShowBufferCurvesArgList 1 " + "{ " + "\"" + `optionVar -query optionVarBufferCurveSelectKey` + "\"," + "\"" + $graphEd + "\"" + " };" ; return $cmd; } // The action variable means // 0 - do the command // 1 - show the option box // 2 - return the drag command global proc string performShowBufferCurves(int $action, string $graphEd) { string $cmd = ""; switch( $action ) { case 0: setOptionVars( false ); $cmd = `assembleCmd( $graphEd )`; eval( $cmd ); break; case 1: bufferCurvesOptions( $graphEd ); break; case 2: setOptionVars( false ); $cmd = `assembleCmd( $graphEd )`; break; } return $cmd; }