// =========================================================================== // 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. // =========================================================================== proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists polyCurrentUVSet`) optionVar -stringValue polyCurrentUVSet ""; } global proc performSetCurrentUVSetSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; string $sval; $sval = `optionVar -query polyCurrentUVSet`; textFieldGrp -edit -tx $sval polyCurrentUVSet; } global proc performSetCurrentUVSetCallback (string $parent, int $doIt) { setParent $parent; optionVar -stringValue polyCurrentUVSet `textFieldGrp -query -tx polyCurrentUVSet`; if ($doIt) { performSetCurrentUVSet 0; addToRecentCommandQueue "performSetCurrentUVSet 0" "SetCurrentUVSet"; } } proc polySetCurrentUVSetOptions() { // Global template variables for form spacing global int $gOptionBoxTemplateFrameSpacing; string $commandName = "performSetCurrentUVSet"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate OptionBoxTemplate; waitCursor -state 1; // Form layout string $parent = `formLayout polySetCurrentUVSetOptions`; // Settings frame string $settingsFrame = `frameLayout -label (uiRes("m_performSetCurrentUVSet.kSettingsFrame"))`; columnLayout; textFieldGrp -label (uiRes("m_performSetCurrentUVSet.kUVSetName")) polyCurrentUVSet; setParent ..; // columnLayout setParent $parent; // frameLayout; setParent ..; // formLayout; // Attach Description/Settings frames to form layout formLayout -e -af $settingsFrame "top" $gOptionBoxTemplateFrameSpacing -af $settingsFrame "left" $gOptionBoxTemplateFrameSpacing -af $settingsFrame "right" $gOptionBoxTemplateFrameSpacing -an $settingsFrame "bottom" $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performSetCurrentUVSet.kSetCurrent")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; setOptionBoxTitle (uiRes("m_performSetCurrentUVSet.kSetCurrentUVSetOptions")); setOptionBoxHelpTag( "SetCurrentUVSet" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string performSetCurrentUVSet (int $option) { string $cmd="polyUVSet -currentUVSet -uvSet "; switch ($option) { case 1: polySetCurrentUVSetOptions; // Just the option box break; default: setOptionVars(false); string $name = `optionVar -query polyCurrentUVSet`; if (size($name)) { $cmd += ("\"" + $name + "\""); if ($option == 0) evalEcho $cmd; } else { if ($option == 0) warning (uiRes("m_performSetCurrentUVSet.kNoName")); } break; } return $cmd; }