// =========================================================================== // 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. // =========================================================================== global proc clampUVToBounds(float $umin,float $vmin, float $umax,float $vmax) { string $selectedItems[]; $selectedItems = `filterExpand -ex true -sm 35`; if (size($selectedItems) == 0) return; float $uv[2]; string $uvStr; int $i=0; while (size($selectedItems) > $i) { $uvStr = $selectedItems[$i]; $cmd = ("polyEditUV -q -u -v " + $uvStr + ";"); $uv = `eval $cmd`; if ($uv[0] < $umin) polyEditUV -r off -u $umin $uvStr; else if ($uv[0] > $umax) polyEditUV -r off -u $umax $uvStr; if ($uv[1] < $vmin) polyEditUV -r off -v $vmin $uvStr; else if ($uv[1] > $vmax) polyEditUV -r off -v $vmax $uvStr; $i++; } }