// =========================================================================== // 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: Jan 2, 2000 // // Description: // This script is the export character map option box dialog. // // Input Arguments: // None. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { // characterMapMethod: // 1: by attr name // 2: by attr order // 3: by node name // 4: using existing mapping // if ( $forceFactorySettings || !`optionVar -exists characterMapMethod`) { optionVar -intValue characterMapMethod 3; } } // // Procedure Name: // characterMapSetup // // 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 characterMapSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings. setOptionVars( $forceFactorySettings ); setParent $parent; // Set the correct radio button. int $whichMethod = `optionVar -query characterMapMethod`; switch($whichMethod) { case 1: radioButtonGrp -e -sl 1 byAttrNameMethod; break; case 2: radioButtonGrp -e -sl 1 byAttrOrderMethod; break; case 3: radioButtonGrp -e -sl 1 byNodeNameMethod; break; case 4: radioButtonGrp -e -sl 1 byCurrentMapMethod; break; default: radioButtonGrp -e -sl 1 byAttrNameMethod; break; } } // // Procedure Name: // characterMapCallback // // 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 characterMapCallback (string $parent, int $doIt) { setParent $parent; if (`radioButtonGrp -q -sl byAttrNameMethod` == 1) { optionVar -intValue characterMapMethod 1; } else if (`radioButtonGrp -q -sl byAttrOrderMethod` == 1) { optionVar -intValue characterMapMethod 2; } else if (`radioButtonGrp -q -sl byCurrentMapMethod` == 1) { optionVar -intValue characterMapMethod 4; } else { optionVar -intValue characterMapMethod 3; } if ($doIt) performExportCharacterMap false; } proc string characterMapWidgets( string $parent ) { setParent $parent; string $tabForm = `columnLayout -adj true`; // how to do the export radioButtonGrp -numberOfRadioButtons 1 -select 1 -label (uiRes("m_performExportCharacterMap.kMapMethod")) -label1 (uiRes("m_performExportCharacterMap.kByAttributeName")) byAttrNameMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 (uiRes("m_performExportCharacterMap.kByAttributeOrder")) -shareCollection byAttrNameMethod byAttrOrderMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 (uiRes("m_performExportCharacterMap.kByNodeName")) -shareCollection byAttrNameMethod byNodeNameMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 (uiRes("m_performExportCharacterMap.kByCurrentMap")) -shareCollection byAttrNameMethod byCurrentMapMethod; return $tabForm; } global proc characterMapOptions () { string $commandName = "characterMap"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // 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; setOptionBoxCommandName("characterMap"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scr true -tv false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; characterMapWidgets $parent; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performExportCharacterMap.kExport")) -command ($callback + " " + $parent + " " + 1) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle (uiRes("m_performExportCharacterMap.kExportCharacterMapOptions")); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "ExportCharacterMap" ); // Set the current values of the option box. // eval (($setup + " " + $parent + " " + 0)); // 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 $cmd; setOptionVars(false); string $mapMethod = "byAttrName"; int $whichMethod = `optionVar -q characterMapMethod`; switch ($whichMethod) { case 1: $mapMethod = "byAttrName"; break; case 2: $mapMethod = "byAttrOrder"; break; case 3: $mapMethod = "byNodeName"; break; case 4: $mapMethod = "currentMap"; break; } // doExportCharacterMapArgList takes a string array // $cmd = "doExportCharacterMapArgList 2 { " + "\"" + $mapMethod + "\"" + " };"; return $cmd; } // // Procedure Name: // performExportCharacterMap // // Description: // Post a window with the export character map options or assemble // a string corresponding to the character map command. // // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performExportCharacterMap(int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // setOptionVars(false); // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // if ($cmd != "") evalEcho($cmd); break; // Show the option box. // case 1: characterMapOptions; break; case 2: // Get the command. // $cmd = `assembleCmd`; } return $cmd; }