// =========================================================================== // 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. // =========================================================================== // Procedure: polyRotateUVsAboutVertex(float angle) // // Description: // // The UVs are rotated about a selected vertex. // (ie, about the UV of the selected vertex) // // If the selected vertex has no UVs, then the // rotation will be done about the origin. // (warning reported) // // If the selected vertex has multiple UVs, then the // rotation will be done about any one of the UVs. // // Input arguments // // Angle by which the rotation has to be done. // // The selection list should contain UVs and at least one vertex // about which the rotation is done. // // // Return value // None // proc rotateUVAbout(float $pu, float $pv, float $angle) { string $cmd="polyEditUV "; $cmd += "-pu " + $pu + " "; $cmd += "-pv " + $pv + " "; $cmd += "-a " + $angle; eval($cmd); } global proc polyRotateUVsAboutVertex(float $angle) { float $pu, $pv; string $inList[]=`ls -sl`; if (size($inList) == 0) { error((uiRes("m_polyRotateUVsAboutVertex.kEmptySelectionList"))); return; } string $vertices[]=`filterExpand -ex false -sm 31`; if (size($vertices) == 0) { warning((uiRes("m_polyRotateUVsAboutVertex.kNoVertsSelected"))); $pu = 0.0; $pv = 0.0; rotateUVAbout($pu, $pv, $angle); return; } // Select the first Vertex on the list select -r $vertices[0]; // If it has multiple UVs... string $UVs[]; $UVs = `polyListComponentConversion -tuv`; if (size($UVs) != 0) { // select the first one and... select -r $UVs[0]; // Get the value of this UV float $pivot[]=`polyEvaluate -bc2`; $pu = $pivot[1]; $pv = $pivot[2]; } else { warning((uiRes("m_polyRotateUVsAboutVertex.kNoUVOnVert"))); $pu = 0.0; $pv = 0.0; } select -r $inList; rotateUVAbout($pu, $pv, $angle); }