// =========================================================================== // 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: polyRotateUVs(float $angle, int $usePivot) // // Description: // // The UVs are rotated about the center of the bBox or pivot // // Input arguments // // angle - Angle by which the rotation has to be done. // usePivot - If true, use current pivot; If false, use bounding box centra // // The selection list should contain poly components // // Return value // None // proc rotateUVAbout(float $pu, float $pv, float $angle, float $ratio) { string $cmd="polyEditUV "; $cmd += "-pu " + $pu + " "; $cmd += "-pv " + $pv + " "; $cmd += "-a " + $angle + " "; $cmd += "-rr " + $ratio; eval($cmd); } global proc polyRotateUVs(float $angle, int $usePivot) { string $inList[]=`ls -sl`; if (size($inList) == 0) { error((uiRes("m_polyRotateUVs.kEmptySelection"))); return; } float $ratio = 1.0; string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`; if(size($texWinName) == 1) $ratio = `textureWindow -q -irv $texWinName[0]`; float $pu, $pv; if($usePivot) { // Get pivot string $selection[] = `ls -selection`; string $buffer[]; tokenize $selection[0] "." $buffer; string $mesh = $buffer[0]; float $pivot[] = uvTkGetUVPivot(); $pu = $pivot[0]; $pv = $pivot[1]; } else { // Get bounding box centra float $UVs[] = `polyEvaluate -bc2`; float $U = ($UVs[0] + $UVs[1])/2; float $V = ($UVs[2] + $UVs[3])/2; $pu = $U; $pv = $V; } rotateUVAbout($pu, $pv, $angle, $ratio); }