// =========================================================================== // 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. // =========================================================================== // FILE: AEimplicitSphereRelated.mel // INPUT: string (node name) // RETURN: string[] (list of related nodes, with the node whose // tab you want to be opened duplicated at the // end of the array) // global proc string[] AEimplicitSphereRelated (string $node) { string $retval[]; int $ii, $jj; string $conns[] = `listConnections -s false ($node+".sphere")`; // look for a connected sculpt node // int $len = size($conns); for ($ii = 0; $ii < $len; $ii++) { if ("sculpt" == nodeType($conns[$ii])) { $sculptNode = $conns[$ii]; $retval[size($retval)] = $sculptNode; // see if there is a locator on the sculpt // $conns = `listHistory ($sculptNode+".startPosition")`; int $len = size($conns); for ($ii = 0; $ii < $len; $ii++) { if ("locator" == nodeType($conns[$ii])) { string $parents[] = `listRelatives -p ($conns[$ii])`; if (size($parents)) { $retval[size($retval)] = $parents[0]; } break; } } $retval[size($retval)] = $sculptNode; break; } } if (0 == size($retval)) { $retval[0] = $node; } return $retval; }