// =========================================================================== // 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: May 22, 1998 // // Description: // This is a helper script to perform the show results 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) { // screenBased // if ($forceFactorySettings || !`optionVar -exists resultsScreenBased`) { optionVar -intValue resultsScreenBased 0; } // sampleRate // if ($forceFactorySettings || !`optionVar -exists resultsSampleRate`) { optionVar -floatValue resultsSampleRate 1.0; } // updateOptions // if ($forceFactorySettings || !`optionVar -exists resultsUpdates`) { optionVar -stringValue resultsUpdates "delayed"; } } global proc resultsSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars ($forceFactorySettings); setParent $parent; // screenBased // int $screenBased = `optionVar -query resultsScreenBased`; checkBoxGrp -edit -value1 $screenBased screenBased; // sampleRate // float $sampleRate = `optionVar -query resultsSampleRate`; floatFieldGrp -edit -value1 $sampleRate sampleRate; // updateOptions // string $updates = `optionVar -query resultsUpdates`; int $method = 1; if ($updates == "interactive") { $method = 2; } radioButtonGrp -edit -select $method updates; } global proc resultsCallback( string $parent, int $doIt, string $graphEd ) { setParent $parent; // screenBased // optionVar -intValue resultsScreenBased `checkBoxGrp -query -value1 screenBased`; // sampleRate // optionVar -floatValue resultsSampleRate `floatFieldGrp -query -value1 sampleRate`; // updateOptions // string $updates = `optionVar -query resultsUpdates`; int $method = `radioButtonGrp -query -select updates`; if ($method == 1) { optionVar -stringValue resultsUpdates "delayed"; } else { optionVar -stringValue resultsUpdates "interactive"; } if( $doIt ) { performShowResults ( 0, $graphEd ); string $tmpCmd = "performShowResults 0 \"" + $graphEd + "\""; addToRecentCommandQueue $tmpCmd "Show Results"; } } proc string resultsWidgets( string $tabLayout ) { setParent $tabLayout; string $tabForm = `columnLayout -adjustableColumn true`; frameLayout -label (uiRes("m_performShowResults.kSamples")) -labelVisible true -borderVisible false -collapsable false -marginWidth 10 -marginHeight 5 samplesFrame; columnLayout -adjustableColumn true; checkBoxGrp -label (uiRes("m_performShowResults.kScreenBased")) -ncb 1 -value1 off -l1 "" screenBased; floatFieldGrp -label (uiRes("m_performShowResults.kSampleRate")) -value1 1.0 sampleRate; setParent ..; setParent ..; separator; frameLayout -label (uiRes("m_performShowResults.kPerformanceOptions")) -labelVisible true -borderVisible false -collapsable false -marginWidth 10 -marginHeight 5 optionsFrame; string $delayed = (uiRes("m_performShowResults.kDelayed")); string $interactive = (uiRes("m_performShowResults.kInteractive")); columnLayout -adjustableColumn true optionsCol; radioButtonGrp -numberOfRadioButtons 2 -label (uiRes("m_performShowResults.kUpdates")) -labelArray2 $delayed $interactive updates; setParent ..; setParent ..; return $tabForm; } proc resultsOptions( string $graphEd ) { // Customisation options // // Name of the command for this option box (think of it as the base class) string $commandName = "results"; // Title for the option box window string $optionBoxTitle = (uiRes("m_performShowResults.kShowResultsOptions")); // Title for the apply button string $applyTitle = (uiRes("m_performShowResults.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 // resultsWidgets $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( "GraphShowResults" ); // 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 = "doShowResultsArgList 1 { " + "\"" + `optionVar -query resultsScreenBased` + "\"" + ",\"" + `optionVar -query resultsSampleRate` + "\"" + ",\"" + `optionVar -query resultsUpdates` + "\"" + ",\"" + $graphEd + "\"" + " };"; return $cmd; } // The action variable means // 0 - do the command // 1 - show the option box // 2 - return the drag command global proc string performShowResults (int $action, string $graphEd) { string $cmd = ""; switch( $action ) { case 0: setOptionVars( false ); $cmd = `assembleCmd( $graphEd )`; eval( $cmd ); break; case 1: resultsOptions( $graphEd ); break; case 2: setOptionVars( false ); $cmd = `assembleCmd( $graphEd )`; break; } return $cmd; }