// =========================================================================== // 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: June 26, 2007 // // Description: // Display -> HUD -> Poly Count Option Box // // Input Arguments: // int if 1 show option box // if 0 perform command with current values // if 2 returns the default settings as a command string // Return Value: // none // proc setOptionVars (int $forceFactorySettings) { // Objects Afftected // if ($forceFactorySettings || !`optionVar -exists polyCountUseSMP`) optionVar -intValue polyCountUseSMP 1; } global proc polyCountSetup (string $parent, int $forceFactorySettings) { setOptionVars ($forceFactorySettings); setParent $parent; int $val = `optionVar -q polyCountUseSMP`; radioButtonGrp -e -select ($val + 1) polyCountCageOrSMP_RBG; } global proc polyCountCallback (string $parent, int $doIt) { setParent $parent; // Set the optionVar's from the control values, and then perform the command // int $val = `radioButtonGrp -q -select polyCountCageOrSMP_RBG`; if ($val < 1) { $val=1; } $val--; optionVar -intValue polyCountUseSMP $val; if ($doIt) performPolyCountOptions 0; } proc polyCountOptions() { string $commandName = "polyCount"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; string $optionBoxTitle = (uiRes("m_performPolyCountOptions.kCustomPolygonOptions")); setOptionBoxTitle($optionBoxTitle); setOptionBoxCommandName($commandName); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -tabsVisible 0 -scrollable 1; string $parent = `columnLayout -adjustableColumn 1`; radioButtonGrp -numberOfRadioButtons 2 -vertical -label (uiRes("m_performPolyCountOptions.kHudPolyCount")) -label1 (uiRes("m_performPolyCountOptions.kCage")) -label2 (uiRes("m_performPolyCountOptions.kSmoothMeshPreview")) polyCountCageOrSMP_RBG; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -command ($callback + " " + $parent + " " + 1 + ";") $applyBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; eval (($setup + " " + $parent + " " + 0)); setOptionBoxTitle($optionBoxTitle); setOptionBoxHelpTag( "PolyCount" ); showOptionBox(); } proc string polyCountHelp() { // is this proc needed for consistency, or can it be omitted? return ""; } // Procedure Name: // assembleCmd // // Description: // Assembles a command to set the option based on the optionVar proc string assembleCmd() { string $cmd = ""; setOptionVars(false); int $val = `optionVar -q polyCountUseSMP`; $cmd = "headsUpDisplay -e -setOption smpPolyCount "; if ($val == 1) $cmd += "smp;"; else $cmd += "cage;"; return $cmd; } // Procedure Name: // performPolyCountOptions // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // global proc string performPolyCountOptions(int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // eval($cmd); break; // Show the option box. // case 1: polyCountOptions; break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd`; break; } return $cmd; }