// =========================================================================== // 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. // =========================================================================== // // Based on the selection find the associated deformer set or sets. // Return a string listing the sets found. // global proc string[] findDeformerSet() { string $defResult[]; string $sels[] = `ls -sl`; string $sel, $rel, $def; for ($sel in $sels) { string $defs[] = `listConnections -s false -d true -type geometryFilter $sel`; if (0 == size($defs)) { string $rels[] = `listRelatives`; for ($rel in $rels) { string $isAShape[] = `ls -type shape $rel`; if (0 == size($isAShape)) { continue; } $defs = `listConnections -s false -d true -type geometryFilter $rel`; if (size($defs)) { break; } } } for ($def in $defs) { int $foundIt = 0; for ($rel in $defResult) { if ($rel == $def) { $foundIt = 1; break; } } if (! $foundIt) { $defResult[size($defResult)] = $def; } } } string $result[]; for ($rel in $defResult) { string $conns[] = `listConnections -type objectSet ($rel+".msg")`; if (size($conns)) { $result[size($result)] = $conns[0]; } } return $result; }