// =========================================================================== // 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: 2007 // // Description: // This script provides an option box dialog for the Fluid cache. // // global string $gFluidCacheSceneNameForPrefs = ""; // This string is used as an optionVar value for the cache // directory when we want to indicate that the preference is to // use the current project's data directory. The file // works the same way, with the default being to use the name of the // selected object. // //global string $gCacheCurrentProject = "CurrentProject"; global string $gFluidCacheCurrentProject = "CurrentProject"; global string $gFluidCacheAutomaticName = "Automatic"; proc string[] pluginCacheFormats() { string $formats[] = {"mcx","mcc"}; // Built in format string $plugins[] = `pluginInfo -q -ls`; // Get all loaded plugins for( $i = 0; $i < size($plugins); $i++ ) { string $pluginFormats[] = `pluginInfo -q -cacheFormat $plugins[$i]`; appendStringArray( $formats, $pluginFormats, size( $pluginFormats )); } return $formats; } global proc fluidCacheSetDirOptionVar() // // Set the optionVar based on the user's entry in the option box // { global string $gFluidCacheCurrentProject; global string $gFluidCacheSceneNameForPrefs; if ( `textFieldGrp -q -en fluidCacheDir` ) { string $value = `textFieldGrp -q -tx fluidCacheDir`; if ( $value != "" ) { verifyWorkspaceFileRule( "fluidCache", "cache/nCache/fluid" ); string $currentProj = `workspace -q -fre "fluidCache"`; $currentProj = `workspace -en $currentProj`; $currentProj += "/" ; if ($currentProj == $value) { $value = $gFluidCacheCurrentProject; } optionVar -sv fluidCacheDirName $value; $gFluidCacheSceneNameForPrefs = `file -q -loc`; } else { optionVar -sv fluidCacheDirName $gFluidCacheCurrentProject; } } } global proc int fluidCacheSetDirectory( string $dir, string $type ) { textFieldGrp -e -tx $dir fluidCacheDir; fluidCacheSetDirOptionVar(); return 1; } global proc cacheBrowseForFolder() { string $cmd = "fluidCacheSetDirectory "; string $action = (uiRes("m_performCreateFluidCache.kFluidSetDir")); string $startInDir; $startInDir = `textFieldGrp -q -tx fluidCacheDir`; if ( size( $startInDir ) == 0 ) { $startInDir = `internalVar -uwd`; } if ( `file -q -ex $startInDir` ) { workspace -dir $startInDir; } fileBrowser( $cmd, $action, "", 4 ); } global proc disableFluidDiskCacheAttrs(string $parent) { setParent $parent; int $showStartEnd = `radioButtonGrp -query -sl fluidCacheTimeRange3`; if( $showStartEnd ) { floatFieldGrp -e -enable true fluidCacheStartEndTime; } else { floatFieldGrp -e -enable false fluidCacheStartEndTime; } } global proc fluidFormatChanged() // // Menu callback // { $value = `optionMenuGrp -q -v formatMenu`; optionVar -sv fluidCacheFormat $value; } global proc fluidDistributionChanged() // // Enables/disables fluidCacheName field depending on whether // OneFilePerFrame or OneFile is chosen and/or the number // of selected objects. // { int $numShapes = size( getFluidObjectsToCache(0) ); int $oneFilePerFrame = `radioButtonGrp -q -sl fluidCacheDist1`; int $perGeom = ($numShapes > 1) && `checkBoxGrp -q -value1 fluidCachePerGeometry`; optionVar -intValue fluidCachePerGeometry $perGeom; checkBoxGrp -e -enable ($numShapes > 1) fluidCachePerGeometry; // disable the prefix box if there isn't a single object name // to prefix it to. (ie. OneFile, all geometry in one file) int $prefix = `checkBox -q -value fluidUseAsPrefix`; checkBox -e -enable ($oneFilePerFrame || $perGeom) fluidUseAsPrefix; textFieldGrp -e -enable (!$perGeom || $prefix) fluidCacheName; setFluidCacheName(); } global proc fluidCacheNameChanged() // // User has specified a cache name, so we no longer need to // update based on selected objects // { if( !`textFieldGrp -exists fluidCacheName` ) return; // Make sure the cache name in option var can't be // cleared. It must remain set to gFluidCacheAutomaticName string $name = `textFieldGrp -query -text fluidCacheName`; if( $name == "" ) return; // Since this is called on every Add, make sure the // cache name was actually modified. // global string $gFluidCacheAutomaticName; string $optName = `optionVar -q fluidCacheName`; if( $optName == $gFluidCacheAutomaticName ) { string $autoName = getAutomaticFluidCacheName(); if( $name == $autoName ) return; } global string $gFluidCacheSceneNameForPrefs; optionVar -sv fluidCacheName $name; $gFluidCacheSceneNameForPrefs = `file -q -loc`; } global proc setFluidCacheName() // // Sets the name of the cache based on the object name. If more than // one object selected, and user hasn't given us a prefix, // { global string $gFluidCacheAutomaticName; string $name = `optionVar -q fluidCacheName`; if ($name == $gFluidCacheAutomaticName) { $name = getAutomaticFluidCacheName(); } textFieldGrp -e -text $name fluidCacheName; } proc setOptionVars(int $forceFactorySettings) { global string $gFluidCacheCurrentProject; global string $gFluidCacheAutomaticName; global string $gFluidCacheSceneNameForPrefs; string $currSceneName = `file -q -loc`; if ($currSceneName != $gFluidCacheSceneNameForPrefs) { // We only want the cache name and directory name prefs to exist // for the time that the scene is opened. We don't want them // to be saved for the next session or next scene. // optionVar -rm fluidCacheDirName; optionVar -rm fluidCacheName; } if( $forceFactorySettings || !`optionVar -exists fluidRefresh` ) optionVar -intValue fluidRefresh 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheDistrib`) optionVar -intValue fluidCacheDistrib 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheTimeRange`) optionVar -intValue fluidCacheTimeRange 2; if( $forceFactorySettings || !`optionVar -exists fluidCacheStartTime`) optionVar -floatValue fluidCacheStartTime 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheEndTime`) optionVar -floatValue fluidCacheEndTime 10; if( $forceFactorySettings || !`optionVar -exists fluidCacheFormat`) optionVar -stringValue fluidCacheFormat "mcx"; if( $forceFactorySettings || !`optionVar -exists fluidCacheDirName`) { optionVar -sv fluidCacheDirName $gFluidCacheCurrentProject; } if( $forceFactorySettings || !`optionVar -exists fluidCacheName` ) { optionVar -stringValue fluidCacheName $gFluidCacheAutomaticName; } if( $forceFactorySettings || !`optionVar -exists fluidCachePerGeometry` ) optionVar -intValue fluidCachePerGeometry 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheSimulationRate`) optionVar -floatValue fluidCacheSimulationRate 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheMergeDelete`) optionVar -intValue fluidCacheMergeDelete 0; if( $forceFactorySettings || !`optionVar -exists fluidCacheSampleMultiplier`) optionVar -intValue fluidCacheSampleMultiplier 1; if( $forceFactorySettings || !`optionVar -exists fluidCacheInheritModifications`) optionVar -intValue fluidCacheInheritModifications 0; if( $forceFactorySettings || !`optionVar -exists fluidCacheUsePrefix`) optionVar -intValue fluidCacheUsePrefix 0; if( $forceFactorySettings || !`optionVar -exists fluidCachePBDensity`) optionVar -intValue fluidCachePBDensity 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBVelocity`) optionVar -intValue fluidCachePBVelocity 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBTemperature`) optionVar -intValue fluidCachePBTemperature 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBFuel`) optionVar -intValue fluidCachePBFuel 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBColor`) optionVar -intValue fluidCachePBColor 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBTextureCoords`) optionVar -intValue fluidCachePBTextureCoords 1; if( $forceFactorySettings || !`optionVar -exists fluidCachePBFalloff`) optionVar -intValue fluidCachePBFalloff 1; } global proc fluidCacheSetup (string $parent, int $forceFactorySettings) { global string $gFluidCacheCurrentProject; setOptionVars($forceFactorySettings); setParent $parent; // checkBoxGrp -e -v1 `optionVar -q fluidRefresh` fluidRefreshBox; string $cacheFormat = `optionVar -q fluidCacheFormat`; optionMenuGrp -e -v $cacheFormat formatMenu; int $distOpt = `optionVar -query fluidCacheDistrib`; if ($distOpt == 1) { radioButtonGrp -e -sl 1 fluidCacheDist1; } else if ($distOpt == 2) { radioButtonGrp -e -sl 1 fluidCacheDist2; } fluidDistributionChanged(); int $timeOpt = `optionVar -query fluidCacheTimeRange`; if ($timeOpt == 1) { radioButtonGrp -e -sl 1 fluidCacheTimeRange1; } else if ($timeOpt == 2) { radioButtonGrp -e -sl 1 fluidCacheTimeRange2; } else { radioButtonGrp -e -sl 1 fluidCacheTimeRange3; } // fluidCacheDirName int $import = 0; verifyWorkspaceFileRule( "fluidCache", "cache/nCache/fluid" ); string $dirToUse = cacheGetCurrentDir("fluidCache", "fluidCacheDirName", $gFluidCacheCurrentProject, $import ); textFieldGrp -e -tx $dirToUse fluidCacheDir; setFluidCacheName(); floatFieldGrp -e -v1 `optionVar -query fluidCacheStartTime` -v2 `optionVar -query fluidCacheEndTime` fluidCacheStartEndTime; floatFieldGrp -e -v1 `optionVar -query fluidCacheSimulationRate` fluidCacheSimulationRate; intFieldGrp -e -v1 `optionVar -query fluidCacheSampleMultiplier` fluidCacheSampleMultiplier; checkBoxGrp -e -v1 `optionVar -query fluidCachePBDensity` fluidCachePBDensity; checkBoxGrp -e -v1 `optionVar -query fluidCachePBVelocity` fluidCachePBVelocity; checkBoxGrp -e -v1 `optionVar -query fluidCachePBTemperature` fluidCachePBTemperature; checkBoxGrp -e -v1 `optionVar -query fluidCachePBFuel` fluidCachePBFuel; checkBoxGrp -e -v1 `optionVar -query fluidCachePBColor` fluidCachePBColor; checkBoxGrp -e -v1 `optionVar -query fluidCachePBTextureCoords` fluidCachePBTextureCoords; checkBoxGrp -e -v1 `optionVar -query fluidCachePBFalloff` fluidCachePBFalloff; if (`checkBoxGrp -exists fluidMergeDeleteBox`) { checkBoxGrp -e -v1 `optionVar -query fluidCacheMergeDelete` fluidMergeDeleteBox; } if( `checkBoxGrp -exists fluidReplaceInheritMods`) { checkBoxGrp -e -v1 `optionVar -query fluidCacheInheritModifications` fluidReplaceInheritMods; } if( `checkBox -exists fluidUseAsPrefix` ) { checkBox -e -value `optionVar -query fluidCacheUsePrefix` fluidUseAsPrefix; } disableFluidDiskCacheAttrs $parent; } global proc fluidCacheCallback(string $parent, int $doIt, string $action) { int $timeMode = 1; int $distMode = 1; if ( `radioButtonGrp -q -sl fluidCacheDist1` ) { $distMode = 1; } else if ( `radioButtonGrp -q -sl fluidCacheDist2` ) { $distMode = 2; } optionVar -iv fluidCacheDistrib $distMode; if( `radioButtonGrp -q -sl fluidCacheTimeRange1` ) { $timeMode = 1; } else if( `radioButtonGrp -q -sl fluidCacheTimeRange2` ) { $timeMode = 2; } else if( `radioButtonGrp -q -sl fluidCacheTimeRange3` ) { $timeMode = 3; } optionVar -iv fluidCacheTimeRange $timeMode; // optionVar -iv fluidRefresh `checkBoxGrp -q -v1 fluidRefreshBox`; checkBoxGrp -edit -value1 `optionVar -query fluidCachePerGeometry` fluidCachePerGeometry; if (`checkBoxGrp -exists fluidMergeDeleteBox`) { optionVar -iv fluidCacheMergeDelete `checkBoxGrp -q -v1 fluidMergeDeleteBox`; } optionVar -fv fluidCacheStartTime `floatFieldGrp -q -v1 fluidCacheStartEndTime`; optionVar -fv fluidCacheEndTime `floatFieldGrp -q -v2 fluidCacheStartEndTime`; optionVar -fv fluidCacheSimulationRate `floatFieldGrp -q -v1 fluidCacheSimulationRate`; optionVar -fv fluidCacheSampleMultiplier `intFieldGrp -q -v1 fluidCacheSampleMultiplier`; optionVar -iv fluidCachePBDensity `checkBoxGrp -q -v1 fluidCachePBDensity`; optionVar -iv fluidCachePBVelocity `checkBoxGrp -q -v1 fluidCachePBVelocity`; optionVar -iv fluidCachePBTemperature `checkBoxGrp -q -v1 fluidCachePBTemperature`; optionVar -iv fluidCachePBFuel `checkBoxGrp -q -v1 fluidCachePBFuel`; optionVar -iv fluidCachePBColor `checkBoxGrp -q -v1 fluidCachePBColor`; optionVar -iv fluidCachePBTextureCoords `checkBoxGrp -q -v1 fluidCachePBTextureCoords`; optionVar -iv fluidCachePBFalloff `checkBoxGrp -q -v1 fluidCachePBFalloff`; if( `checkBoxGrp -exists fluidReplaceInheritMods`) { optionVar -iv fluidCacheInheritModifications `checkBoxGrp -q -v1 fluidReplaceInheritMods`; } if( `checkBox -exists fluidUseAsPrefix` ) { optionVar -iv fluidCacheUsePrefix `checkBox -q -value fluidUseAsPrefix`; } if ($doIt) { fluidCacheNameChanged(); hideOptionBox; string $cmd = ("performCreateFluidCache 0 "+$action); // use evalDeferred so that the option box will get hidden before // the cache is created evalDeferred $cmd; } } proc createFluidCacheOptions(string $action) { global string $gFluidCacheCurrentProject; // Name of the command for this option box // string $commandName = "fluidCache"; // 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 // // Directory name // rowLayout -nc 3 -cw3 400 5 50 -adjustableColumn 1 -cal 1 "both" -cal 2 "both" -cal 3 "left" -ct3 "both" "both" "left"; // fluidCacheDirName int $import = 0; verifyWorkspaceFileRule( "fluidCache", "cache/nCache/fluid" ); string $dirToUse = cacheGetCurrentDir("fluidCache", "fluidCacheDirName", $gFluidCacheCurrentProject, $import ); textFieldGrp -label (uiRes("m_performCreateFluidCache.kFluidCacheDirectory")) -tx $dirToUse -cc ( "fluidCacheSetDirOptionVar" ) -adjustableColumn 2 fluidCacheDir; separator -w 5 -style "none"; symbolButton -image "navButtonBrowse.png" -c ( "cacheBrowseForFolder" ) fluidCacheDirBrowser; setParent ..; // Cache Name // rowLayout -nc 3 -cw 2 5 -adjustableColumn 1 -cal 1 "left" -cal 2 "both" -cal 3 "left" -ct3 "left" "both" "left"; textFieldGrp -label (uiRes("m_performCreateFluidCache.kFluidCacheName")) -enable true -cc ("fluidCacheNameChanged") fluidCacheName; separator -w 5 -style "none"; checkBox -label (uiRes("m_performCreateFluidCache.kFluidUsePrefix")) -value 0 -enable true -cc ( "fluidDistributionChanged" ) fluidUseAsPrefix; setParent ..; // Initialize cache name setFluidCacheName(); // // Cache Format // string $cacheFormatList[] = `pluginCacheFormats`; int $selection = 1; // Corresponds to default entry of "mcx" if(!`optionVar -exists fluidCacheFormat` || !stringArrayContains(`optionVar -q fluidCacheFormat`, $cacheFormatList)) optionVar -stringValue fluidCacheFormat "mcx"; string $optionSelection = `optionVar -query fluidCacheFormat`; int $optionFound = false; string $tabForm = `columnLayout -adj true`; optionMenuGrp -l (uiRes("m_performCreateFluidCache.kFluidCacheFormat")) -cc ( "fluidFormatChanged" ) formatMenu; for( $nth = 0; $nth < size($cacheFormatList); $nth++ ) { menuItem -l $cacheFormatList[$nth]; if( $cacheFormatList[$nth] == $optionSelection ) { $optionFound = true; $selection = $nth + 1; // Add 1 since menus are indexed 1-based } } if( $optionFound == false ) { warning( (uiRes("m_performCreateFluidCache.kNoFormatPlugin")) ); } optionMenuGrp -e -sl $selection formatMenu; // Distribution of cache files // radioButtonGrp -label (uiRes("m_performCreateFluidCache.kFluidCacheFileDistribution")) -nrb 1 -l1 (uiRes("m_performCreateFluidCache.kFluidOnePerFrame")) -cc ( "fluidDistributionChanged" ) fluidCacheDist1; radioButtonGrp -label "" -nrb 1 -scl fluidCacheDist1 -l1 (uiRes("m_performCreateFluidCache.kFluidOneFile")) -cc ( "fluidDistributionChanged" ) fluidCacheDist2; checkBoxGrp -numberOfCheckBoxes 1 -label "" -label1 (uiRes("m_performCreateFluidCache.kCachePerGeometry")) -value1 `optionVar -query fluidCachePerGeometry` -enable true -cc ( "fluidDistributionChanged" ) fluidCachePerGeometry; separator -h 5 -style "none"; // Time range to cache // radioButtonGrp -label (uiRes("m_performCreateFluidCache.kFluidCacheTimeRange")) -nrb 1 -l1 (uiRes("m_performCreateFluidCache.kFluidRenderSettings")) -cc ( "disableFluidDiskCacheAttrs " + $parent ) fluidCacheTimeRange1; radioButtonGrp -label "" -nrb 1 -scl fluidCacheTimeRange1 -cc ( "disableFluidDiskCacheAttrs " + $parent ) -l1 (uiRes("m_performCreateFluidCache.kFluidTimeSlider")) fluidCacheTimeRange2; radioButtonGrp -label "" -nrb 1 -scl fluidCacheTimeRange1 -l1 (uiRes("m_performCreateFluidCache.kFluidStartEnd")) -cc ( "disableFluidDiskCacheAttrs " + $parent ) fluidCacheTimeRange3; floatFieldGrp -label (uiRes("m_performCreateFluidCache.kFluidStartEndGrp")) -nf 2 fluidCacheStartEndTime; floatFieldGrp -label (uiRes("m_performCreateFluidCache.kFluidSimulationRate")) -nf 1 -extraLabel (uiRes("m_performCreateFluidCache.kFluidSimulationRateR")) fluidCacheSimulationRate; intFieldGrp -label (uiRes("m_performCreateFluidCache.kFluidSampleMultiplierLeft")) -extraLabel (uiRes("m_performCreateFluidCache.kFluidSampleMultiplierRight")) -nf 1 fluidCacheSampleMultiplier; separator -h 5 -style "none"; checkBoxGrp -label (uiRes("m_performCreateFluidCache.kFluidCache")) -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidDensity")) fluidCachePBDensity; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidVelocity")) fluidCachePBVelocity; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidTemperature")) fluidCachePBTemperature; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidFuel")) fluidCachePBFuel; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidColor")) fluidCachePBColor; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidTextureCoord")) fluidCachePBTextureCoords; checkBoxGrp -label "" -ncb 1 -label1 (uiRes("m_performCreateFluidCache.kFluidFalloff")) fluidCachePBFalloff; separator -h 5 -style "none"; if ($action == "merge") { // refresh during caching // checkBoxGrp -numberOfCheckBoxes 1 -label "" -label1 (uiRes("m_performCreateFluidCache.kFluidDeleteExisting")) -v1 0 fluidMergeDeleteBox; } if ($action == "replace") { // refresh during caching // checkBoxGrp -numberOfCheckBoxes 1 -label "" -label1 (uiRes("m_performCreateFluidCache.kFluidInheritModifications")) -v1 0 fluidReplaceInheritMods; } // refresh during caching // // checkBoxGrp // -numberOfCheckBoxes 1 // -label "" // -label1 _L10N( kFluidRefresh, "Refresh screen while caching") // -v1 0 // fluidRefreshBox; // 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(); string $buttonName; if ($action == "replace") { $buttonName = (uiRes("m_performCreateFluidCache.kFluidReplaceCache")); } else if ($action == "add") { $buttonName = (uiRes("m_performCreateFluidCache.kFluidAddCache")); } else { $buttonName = (uiRes("m_performCreateFluidCache.kFluidMergeCache")); } button -edit -label $buttonName -command ($callback + " " + $parent + " " + 1 + " " + $action) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + " " + $action +"; hideOptionBox") $saveBtn; // 'Reset' button string $resetBtn = getOptionBoxResetBtn(); int $resetToDefaults = 1; button -edit -command ($setup + " " + $parent + " " + $resetToDefaults) $resetBtn; // Step 7: Set the option box title. // ================================= // string $optionTitle; if ($action == "replace") { $optionTitle = (uiRes("m_performCreateFluidCache.kFluidReplaceOptions")); } else if ($action == "add") { $optionTitle = (uiRes("m_performCreateFluidCache.kFluidAddOptions")); } else { $optionTitle = (uiRes("m_performCreateFluidCache.kFluidMergeOptions")); } setOptionBoxTitle($optionTitle); // Step 8: Customize the 'Help' menu item text. // ============================================ // if ($action == "add") { setOptionBoxHelpTag( "CreateFluidCache" ); } else if ($action == "replace") { setOptionBoxHelpTag( "ReplaceFluidCache" ); } else { setOptionBoxHelpTag( "MergeFluidCache" ); } // Step 9: Set the current values of the option box. // ================================================= // eval ($setup + " " + $parent + " " + 0); // Update fluidCacheName field if number of selected objects changes. Make sure it's // killed when we close this option box. // scriptJob -parent $parent -event "SelectionChanged" fluidDistributionChanged; // Step 10: 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 $action) { global string $gFluidCacheCurrentProject; global string $gFluidCacheAutomaticName; string $distrib = "OneFilePerFrame"; if (`optionVar -query fluidCacheDistrib` == 2) { $distrib = "OneFile"; } string $directory = `optionVar -query fluidCacheDirName`; if ($directory == $gFluidCacheCurrentProject) { $directory = ""; } fluidCacheNameChanged(); // If the user doesn't hit enter after changing // cache name on windows, callback is not triggered. string $fileName = `optionVar -query fluidCacheName`; if ($fileName == $gFluidCacheAutomaticName) { $fileName = ""; } string $prefix = 0; if( `optionVar -exists fluidCacheUsePrefix`) { if ("" != $fileName) { $prefix = `optionVar -q fluidCacheUsePrefix`; } } if ($action == "merge") { if (`optionVar -query fluidCacheMergeDelete`) { $action = "mergeDelete"; } } int $inherit = 0; if( $action == "replace" ) { $inherit = `optionVar -q fluidCacheInheritModifications`; } return( "doCreateFluidCache 5 { \"" + `optionVar -query fluidCacheTimeRange` + "\", " + "\"" + `optionVar -query fluidCacheStartTime` + "\", " + "\"" + `optionVar -query fluidCacheEndTime` + "\", " + "\"" + $distrib + "\", " + "\"" + `optionVar -query fluidRefresh` + "\", " + "\"" + $directory + "\"," + "\"" + `optionVar -query fluidCachePerGeometry` + "\"," + "\"" + $fileName + "\"," + "\"" + $prefix + "\", " + "\"" + $action + "\", " + "\"0\", " + "\"" + `optionVar -query fluidCacheSimulationRate` + "\", " + "\"" + `optionVar -query fluidCacheSampleMultiplier` + "\", " + "\"" + $inherit + "\", " + "\"1\", " + "\"" + `optionVar -query fluidCacheFormat` + "\", " + "\"" + `optionVar -query fluidCachePBDensity` + "\", " + "\"" + `optionVar -query fluidCachePBVelocity` + "\", " + "\"" + `optionVar -query fluidCachePBTemperature` + "\", " + "\"" + `optionVar -query fluidCachePBFuel` + "\", " + "\"" + `optionVar -query fluidCachePBColor` + "\", " + "\"" + `optionVar -query fluidCachePBTextureCoords` + "\", " + "\"" + `optionVar -query fluidCachePBFalloff` + "\"" + " } " ); } global proc string performCreateFluidCache( int $action, string $createMode ) { string $cmd = ""; switch( $action ) { case 0: setOptionVars(false); $cmd = assembleCmd($createMode); evalEcho($cmd); break; case 1: createFluidCacheOptions($createMode); break; case 2: setOptionVars(false); $cmd = assembleCmd($createMode); break; } return $cmd; }