// =========================================================================== // 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: 04 Dec 2001 // // Description: // This script provides an option box dialog for the diskCache command // as used by fluids. // // Input Arguments: // boolean isCreationMode true - we are in creation mode // false - we are in deletion mode // boolean showOptionBox true - show the option box dialog // false - just execute the command // proc setOptionVars(int $forceFactorySettings) { if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICDensity`) { optionVar -intValue fluidsDiskCacheICDensity 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICTemperature`) { optionVar -intValue fluidsDiskCacheICTemperature 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICColor`) { optionVar -intValue fluidsDiskCacheICColor 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICVelocity`) { optionVar -intValue fluidsDiskCacheICVelocity 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICFuel`) { optionVar -intValue fluidsDiskCacheICFuel 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICTextureCoords`) { optionVar -intValue fluidsDiskCacheICTextureCoords 1; } if( $forceFactorySettings || !`optionVar -exists fluidsDiskCacheICFalloff`) { optionVar -intValue fluidsDiskCacheICFalloff 1; } } global proc setFluidStateSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICDensity` fluidsDiskCacheICDensity; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICTemperature` fluidsDiskCacheICTemperature; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICColor` fluidsDiskCacheICColor; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICVelocity` fluidsDiskCacheICVelocity; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICFuel` fluidsDiskCacheICFuel; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICTextureCoords` fluidsDiskCacheICTextureCoords; checkBoxGrp -e -v1 `optionVar -query fluidsDiskCacheICFalloff` fluidsDiskCacheICFalloff; } global proc setFluidStateCallback(int $doIt, string $parent) { optionVar -iv fluidsDiskCacheICDensity `checkBoxGrp -q -v1 fluidsDiskCacheICDensity`; optionVar -iv fluidsDiskCacheICTemperature `checkBoxGrp -q -v1 fluidsDiskCacheICTemperature`; optionVar -iv fluidsDiskCacheICColor `checkBoxGrp -q -v1 fluidsDiskCacheICColor`; optionVar -iv fluidsDiskCacheICVelocity `checkBoxGrp -q -v1 fluidsDiskCacheICVelocity`; optionVar -iv fluidsDiskCacheICFuel `checkBoxGrp -q -v1 fluidsDiskCacheICFuel`; optionVar -iv fluidsDiskCacheICTextureCoords `checkBoxGrp -q -v1 fluidsDiskCacheICTextureCoords`; optionVar -iv fluidsDiskCacheICFalloff `checkBoxGrp -q -v1 fluidsDiskCacheICFalloff`; if( $doIt ) { performSetFluidState 0; } } proc creationOptionBox() { // Name of the command for this option box // string $commandName = "setFluidState"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // STEP 1: 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; // STEP 2: Pass the command name to the option box. // ================================================= // // Any default option box behaviour based on the command name is set // up with this call. For example, updating the 'Help' menu item with // the name of the command. // setOptionBoxCommandName($commandName); // STEP 3: Activate the default UI template. // ========================================== // // Activate the default UI template so that the layout of this // option box is consistent with the layout of the rest of the // application. // setUITemplate -pushTemplate DefaultTemplate; // STEP 4: Create option box contents. // =================================== // // This, of course, will vary from option box to option box. // Turn on the wait cursor. // waitCursor -state 1; tabLayout -scr true -tv false; string $parent = `columnLayout -adjustableColumn 1`; // Create the widgets for this option box // checkBoxGrp -label (uiRes("m_performSetFluidState.kSet")) -ncb 1 -label1 (uiRes("m_performSetFluidState.kDensity")) fluidsDiskCacheICDensity; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kVelocity")) fluidsDiskCacheICVelocity; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kTemperature")) fluidsDiskCacheICTemperature; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kFuel")) fluidsDiskCacheICFuel; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kColor")) fluidsDiskCacheICColor; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kTextureCoordinates")) fluidsDiskCacheICTextureCoords; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performSetFluidState.kFalloff")) fluidsDiskCacheICFalloff; // Turn off the wait cursor. // waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // // Provide more descriptive labels for the buttons. This is not // necessary, but in some cases, for example, a button labelled // 'Create' may be more meaningful to the user than one labelled // 'Apply'. // // Disable those buttons that are not applicable to the option box. // // Attach actions to those buttons that are applicable to the option // box. Note that the 'Close' button has a default action attached // to it that will hide the window. If a a custom action is // attached to the 'Close' button then be sure to call the 'hide the // option box' procedure within the custom action so that the option // box is hidden properly. // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performSetFluidState.kSetInitialState")) -command ($callback + " " + 1 + " " + $parent) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + 0 + " " + $parent + "; hideOptionBox") $saveBtn; // 'Reset' button string $resetBtn = getOptionBoxResetBtn(); int $resetToDefaults = 1; button -edit -command ($setup + " " + $parent + " " + $resetToDefaults) $resetBtn; // Step 7: Set the option box title. // ================================= // setOptionBoxTitle (uiRes("m_performSetFluidState.kSetInitialStateOptions")); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag( "SetInitialState" ); // Step 9: Set the current values of the option box. // ================================================= // eval ($setup + " " + $parent + " " + 0); // Step 10: Show the option box. // ============================= // showOptionBox(); } proc string creation() { return( "doSetFluidState 1 { \"" + `optionVar -query fluidsDiskCacheICDensity` + "\", " + `optionVar -query fluidsDiskCacheICVelocity` + ", " + `optionVar -query fluidsDiskCacheICTemperature` + ", " + `optionVar -query fluidsDiskCacheICFuel` + ", " + `optionVar -query fluidsDiskCacheICColor` + ", " + `optionVar -query fluidsDiskCacheICTextureCoords` + ", " + `optionVar -query fluidsDiskCacheICFalloff` + " " + "} " ); } global proc string performSetFluidState( int $action ) { string $cmd = ""; switch( $action ) { case 0: setOptionVars(false); $cmd = creation(); evalEcho($cmd); break; case 1: creationOptionBox(); break; case 2: setOptionVars(false); $cmd = creation(); break; } return $cmd; }