// =========================================================================== // 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 polyPinUvValue`) optionVar -floatValue polyPinUvValue 1.0; } global proc polyPinUVSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; int $ival = 1; float $fval = `optionVar -query polyPinUvValue`; floatSliderGrp -edit -en $ival -value $fval polyPinUvValue; } global proc polyPinUVCallback (string $parent, int $doIt) { setParent $parent; optionVar -floatValue polyPinUvValue `floatSliderGrp -query -value polyPinUvValue`; if ($doIt) { performPolyPinSelectionUVOptions 0; addToRecentCommandQueue "performPolyPinSelectionUVOptions 0" "PolyPinUV"; } } proc polyPinUVOptions () { // Global template variables for form spacing global int $gOptionBoxTemplateFrameSpacing; string $commandName = "polyPinUV"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate OptionBoxTemplate; waitCursor -state 1; // Form layout string $parent = `formLayout performPolyPinSelectionUVOptions`; // Settings frame string $settingsFrame = `frameLayout -label (uiRes("m_performPolyPinSelectionUVOptions.kSettingsFrame"))`; columnLayout; floatSliderGrp -label (uiRes("m_performPolyPinSelectionUVOptions.kPolyPinValue")) -min 0 -max 1 polyPinUvValue; setParent ..; // columnLayout setParent $parent; // frameLayout setParent ..; // formLayout // Attach Settings frame 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_performPolyPinSelectionUVOptions.kPinUVs")) -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_performPolyPinSelectionUVOptions.kPinSelectionOptions")); setOptionBoxHelpTag( "PinUVs" ); eval (($setup + " " + $parent + " " + 0)); showOptionBox(); } global proc string performPolyPinSelectionUVOptions (int $option) { string $cmd=""; switch ($option) { case 0: string $compSelType = `getComponentMask`; if($compSelType != "none") { string $selection[] = `ls -sl`; ConvertSelectionToUVs; setOptionVars(false); $cmd = "polyPinUV"; float $fval = `optionVar -query polyPinUvValue`; $cmd =($cmd + " -value " + $fval); evalEcho ("polyPerformAction \""+$cmd+"\" v 0"); //restore the original component mask setComponentMask($compSelType); //select the original selection select -replace $selection; } break; case 1: polyPinUVOptions; break; case 2: $cmd = "performPolyPinSelectionUVOptions 0"; break; } return $cmd; }