// =========================================================================== // 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. // =========================================================================== // // This script helps to visualize the sharing of uv sets on instances for // per-instance uv sets. // // Given a instance, it finds the current uv set for that instance and // then selects all the instances that are also sharing that set. // // global proc int polyUVSelectSharedInstances() { int $rtn = 0; string $sel[] = `ls -sl`; if (size($sel) == 1) { select -r $sel[0]; string $currSet[] = `polyUVSet -q -currentPerInstanceUVSet $sel[0]`; string $baseName[] = `polyUVSet -pi 1 -q -currentUVSet $sel[0]`; if (size($currSet) > 0) { if ($baseName[0] == $currSet[0]) { // this is not a per-instance set so they all share // string $rel[] = `listRelatives -pa -type mesh -ni`; select -add $rel; } else { string $members[] = `polyUVSet -uvSet $currSet[0] -q -shareInstances`; select -add $members; } $sel = `ls -sl`; string $resultFmt = (uiRes("m_polyUVSelectSharedInstances.kResult")); string $sizeStr = size($sel); string $resultString = `format -s $sizeStr $resultFmt`; print($resultString); } else { warning( (uiRes("m_polyUVSelectSharedInstances.kNoPerInstance"))); select -d; } } else { if (size($sel) == 0) { error( (uiRes("m_polyUVSelectSharedInstances.kSelectOneInstance"))); } else { error( (uiRes("m_polyUVSelectSharedInstances.kTooManyInstances"))); } } return $rtn; }