// =========================================================================== // 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 int getMapIndexFromStrokeUVName(string $strokeObj, int $index) { string $uvStrokeAttr = $strokeObj + ".uvSetName[" + $index + "]"; string $connectedPolys[] = `listConnections $uvStrokeAttr`; for($i = 0; $i < size($connectedPolys); $i++) { string $shapeObj[] = `listRelatives -s $connectedPolys[$i]`; string $uvSetList[] = `listAttr -m -st uvSet $shapeObj[0]`; int $sizeOfList = size($uvSetList); int $returnIndex = 0; for($j = 0; $j < $sizeOfList; $j++) { string $uvObjAttr = $shapeObj[0] + "." + $uvSetList[$j] + ".uvSetName"; string $attrValid = `getAttr $uvObjAttr`; if(!size($attrValid)) continue; if(`isConnected $uvObjAttr $uvStrokeAttr`) return $returnIndex; $returnIndex ++; } } return 0; }