// =========================================================================== // 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: 2 June 1999 // // Procedure Name: // performPolyRotateUVs // // Description: // Rotates UVs // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // command string iff $option==2 // proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists polyRotateUVAngle`) { optionVar -floatValue polyRotateUVAngle 90; } } global proc performPolyRotateUVsSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; float $ang = `optionVar -q polyRotateUVAngle`; floatSliderGrp -edit -value $ang polyRotateUVAngle; } global proc performPolyRotateUVsCallback (string $parent, int $doIt) { setParent $parent; float $ang = `floatSliderGrp -query -value polyRotateUVAngle`; optionVar -floatValue polyRotateUVAngle $ang; if ($doIt) { performPolyRotateUVs 0; addToRecentCommandQueue "performPolyRotateUVs 0" "PolyRotateUVs"; } } proc polyRotateUVsOptions () { // Global template variables for form spacing global int $gOptionBoxTemplateFrameSpacing; string $layout = getOptionBox(); setParent $layout; setUITemplate -pushTemplate OptionBoxTemplate; waitCursor -state 1; // Form layout string $parent = `formLayout polyUnmirrorOptions`; // Settings frame string $settingsFrame = `frameLayout -label (uiRes("m_performPolyRotateUVs.kSettingsFrame"))`; columnLayout; string $commandName = "performPolyRotateUVs"; string $callback = ($commandName + "Callback " + $parent + " "); string $setup = ($commandName + "Setup " + $parent + " "); setOptionBoxCommandName($commandName); floatSliderGrp -label (uiRes("m_performPolyRotateUVs.kRotationAngle")) -min -360.0 -max 360.0 -v 90.0 polyRotateUVAngle; setParent $parent; // frameLayout setParent ..; // formLayout // Attach Settings frames to form layout formLayout -e -attachForm $settingsFrame "top" $gOptionBoxTemplateFrameSpacing -attachForm $settingsFrame "left" $gOptionBoxTemplateFrameSpacing -attachForm $settingsFrame "right" $gOptionBoxTemplateFrameSpacing -attachNone $settingsFrame "bottom" $parent; waitCursor -state 0; setUITemplate -popTemplate; string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performPolyRotateUVs.kRotateUVs")) -command ($callback + 1) $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + 0 + "; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + 1) $resetBtn; setOptionBoxTitle (uiRes("m_performPolyRotateUVs.kRotateUVsOptions")); setOptionBoxHelpTag( "RotateUVs" ); eval (($setup + 0)); showOptionBox(); } proc string assembleCmd() { int $doHistory = `constructionHistory -q -toggle`; string $cmd=("string $selection[] = `ls -sl`; string $compSelType = `getComponentMask`; polyRotateUVs "); float $ang = `optionVar -q polyRotateUVAngle`; $cmd += $ang; $cmd += " 0; setComponentMask $compSelType; select -replace $selection"; return $cmd; } global proc string performPolyRotateUVs(int $option) { string $cmd=""; switch ($option) { case 0: $cmd=`assembleCmd `; string $res=`evalEcho $cmd`; break; case 1: polyRotateUVsOptions; break; case 2: $cmd=`assembleCmd`; break; default: $cmd = ("performPolyRotateUVs 0"); } return $cmd; }