// Copyright (C) 1997-2000 Alias|Wavefront, // a division of Silicon Graphics Limited. // // The information in this file is provided for the exclusive use of the // licensees of Alias|Wavefront. Such users have the right to use, modify, // and incorporate this code into other products for purposes authorized // by the Alias|Wavefront license agreement, without fee. // // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. // // Alias|Wavefront Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: 3 June 1997 // // // Description: // Script to create the option dialog for convert solid texture. // // // Procedure Name: // setOptionVars // // Description: // Initialize the option values. // // Input Arguments: // Whether to set the options to default values. // // Return Value: // None. // proc setOptionVars(int $forceFactorySettings) { // AntiAlias. // if ($forceFactorySettings || !`optionVar -exists convertSolidTxAntiA`) { optionVar -intValue convertSolidTxAntiA false; } // bakeLt. // if ($forceFactorySettings || !`optionVar -exists convertSolidTxBakeLt`) { optionVar -intValue convertSolidTxBakeLt false; } // ResolutionX. // if ($forceFactorySettings || !`optionVar -exists convertSolidTxResX`) { optionVar -intValue convertSolidTxResX 256; } // ResolutionY. // if ($forceFactorySettings || !`optionVar -exists convertSolidTxResY`) { optionVar -intValue convertSolidTxResY 256; } // generate shadow maps // if($forceFactorySettings || !`optionVar -exists convertSolidTxShadows`) { optionVar -intValue convertSolidTxShadows false; } } // // Procedure Name: // convertSolidTxSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc convertSolidTxSetup(string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars($forceFactorySettings); setParent $parent; // Query the optionVar's and set the values into the controls. // AntiAlias. // checkBoxGrp -edit -value1 `optionVar -query convertSolidTxAntiA` convertSolidTxAntiA; // BakeLighting. // checkBoxGrp -edit -value1 `optionVar -query convertSolidTxBakeLt` convertSolidTxBakeLt; // ResolutionX. // intSliderGrp -edit -value `optionVar -query convertSolidTxResX` convertSolidTxResX; // ResolutionY. // intSliderGrp -edit -value `optionVar -query convertSolidTxResY` convertSolidTxResY; checkBoxGrp -edit -value1 `optionVar -query convertSolidTxShadows` convertSolidTxShadows; } // // Procedure Name: // convertSolidTxCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc convertSolidTxCallback( string $parent, int $doIt, int $useMultilisterHighlighted) { setParent $parent; // Set the optionVar's from the control values, and then // perform the command. // AntiAlias // optionVar -intValue convertSolidTxAntiA `checkBoxGrp -query -value1 convertSolidTxAntiA`; // BakeLight // optionVar -intValue convertSolidTxBakeLt `checkBoxGrp -query -value1 convertSolidTxBakeLt`; // ResolutionX. // optionVar -intValue convertSolidTxResX `intSliderGrp -query -value convertSolidTxResX`; // ResolutionY. // optionVar -intValue convertSolidTxResY `intSliderGrp -query -value convertSolidTxResY`; // Shadows optionVar -intValue convertSolidTxShadows `checkBoxGrp -query -value1 convertSolidTxShadows`; if ($doIt) { performConvertSolidTx 0 $useMultilisterHighlighted; string $tmpCmd = "performConvertSolidTx 0 " + $useMultilisterHighlighted; addToRecentCommandQueue $tmpCmd "Convert to File Texture"; } } // // Procedure Name: // convertSolidTxOptions // // Description: // Construct the option box UI. Involves accessing the standard option // box and customizing the UI accordingly. // // Input Arguments: // None. // // Return Value: // None. // proc convertSolidTxOptions(int $useMultilisterHighlighted) { // Name of the command for this option box. // string $commandName = "convertSolidTx"; // Build the option box actions. // 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; // RECOMMENDATION: Place the UI in a 'scrollable' layout. A // scrollable layout ensures that if the option box window is ever // resized such that it's entire contents is not visible then the // scroll bars provided by the scrollable layout will allow the user // to access the hidden UI. Two layouts currently supporting // scrollable behaviour are the 'scrollLayout' and the 'tabLayout'. // // scrollLayout; // // or... // tabLayout -tabsVisible 0 -scrollable 1; string $parent = `columnLayout -adjustableColumn 1`; // RECOMMENDATION: Use the 'Grp' commands where possible because // they obey the formatting specified in the default template. // This will result in a more consistent look throughout the // application. // checkBoxGrp -label "Anti-alias" -label1 "" -numberOfCheckBoxes 1 -value1 off convertSolidTxAntiA; checkBoxGrp -label "Bake Shading Group Lighting" -label1 "" -numberOfCheckBoxes 1 -value1 off convertSolidTxBakeLt; intSliderGrp -field on -label "X Resolution" -minValue 1 -maxValue 512 -fieldMinValue 1 -fieldMaxValue 4096 -value 256 convertSolidTxResX; intSliderGrp -field on -label "Y Resolution" -minValue 1 -maxValue 512 -fieldMinValue 1 -fieldMaxValue 4096 -value 256 convertSolidTxResY; checkBoxGrp -label "Shadows" -label1 "" -numberOfCheckBoxes 1 -value1 off convertSolidTxShadows; // 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 "Convert Texture" -command ( $callback + " " + $parent + " " + 1 + " " + $useMultilisterHighlighted) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ( $callback + " " + $parent + " " + 0 + " " + $useMultilisterHighlighted + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Step 7: Set the option box title. // ================================= // setOptionBoxTitle("Convert to File Texture Options"); // Step 8: Customize the 'Help' menu item text. // ============================================ // // By default, the 'Help' menu item is set up when the command name // is passed to the option box. Normally, you do not need to // customize the 'Help' menu item. // // To customize the 'Help' menu item use the following example. // // string $helpItem = getOptionBoxHelpItem(); // menuItem -edit // -label "New Label" // -command "CustomCommand" // $helpItem; // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } // // Procedure Name: // convertSolidTxHelp // // Description: // Return a short description about this command. // // Input Arguments: // None. // // Return Value: // string. // proc string convertSolidTxHelp() { // ******** Example // " Command: Extrude - create a surface using extrusion.\n" + // "Selection: curves and isoparms." return " Command: convertSolidTx - convert a texture to a file texture.\n" + "Selection: surface or texture.\n" + "Highlight: surface or texture."; } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // proc string assembleCmd( int $useMultilisterHighlighted) { string $cmd = "copyConvertSolidTx"; setOptionVars(false); $cmd = ($cmd + " " + `optionVar -query convertSolidTxAntiA` + " " + `optionVar -query convertSolidTxBakeLt` + " " + `optionVar -query convertSolidTxResX` + " " + `optionVar -query convertSolidTxResY` + " " + `optionVar -query convertSolidTxShadows` + " " + $useMultilisterHighlighted ); return $cmd; } // // Procedure Name: // performConvertSolidTx // // Description: // Perform the convertSolidTx command using the corresponding // option values. This procedure will also show the option box // window if necessary as well as construct the command string // that will invoke the optionBoxExample1 command with the current // option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // global proc string performConvertSolidTx( int $action, int $useMultilisterHighlighted) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Get the command. // $cmd = `assembleCmd $useMultilisterHighlighted`; // Execute the command with the option settings. // eval($cmd); break; // Show the option box. // case 1: convertSolidTxOptions $useMultilisterHighlighted; break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd $useMultilisterHighlighted`; break; } return $cmd; }