// =========================================================================== // 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 polyRenameUVSet`) optionVar -stringValue polyRenameUVSet ""; } global proc performRenameUVSetSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; string $sval; $sval = `optionVar -query polyRenameUVSet`; textFieldGrp -edit -tx $sval polyRenameUVSet; } global proc performRenameUVSetCallback (string $parent, int $doIt, string $uvSetName, string $objectName) { setParent $parent; optionVar -stringValue polyRenameUVSet `textFieldGrp -query -tx polyRenameUVSet`; if ($doIt) { performRenameUVSet 0 $uvSetName $objectName; addToRecentCommandQueue ("performRenameUVSet 0 " + $uvSetName + " " + $objectName) "RenameUVSet"; } } proc polyRenameUVSetOptions(string $uvSetName, string $objectName) { string $commandName = "performRenameUVSet"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; string $parent = `columnLayout -adjustableColumn true`; textFieldGrp -label (uiRes("m_performRenameUVSet.kNewUVSet")) polyRenameUVSet; setParent $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performRenameUVSet.kRename")) -command ($callback + " " + $parent + " " + 1 + " " + $uvSetName + " " + $objectName) $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_performRenameUVSet.kOptionBoxTitle")) ); setOptionBoxHelpTag( "" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string performRenameUVSet (int $option, string $uvSetName, string $objectName) { string $cmd="polyUVSet -rename -uvSet "; switch ($option) { case 1: polyRenameUVSetOptions( $uvSetName, $objectName) ; // Just the option box break; default: setOptionVars(false); // Specify old name $cmd += $uvSetName; // Specify new name $cmd += " -newUVSet "; string $name = `optionVar -query polyRenameUVSet`; if (size($name)) { $cmd += ("\"" + $name + "\" "); } $cmd += $objectName; if ($option == 0) { evalEcho $cmd; } break; } return $cmd; }