// =========================================================================== // 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. // =========================================================================== // // // Creation Date: Oct 22, 1998 // // Procedure Name: // AEcharacterRelated // // Description Name; // Return all of the nodes related to the given character // // Input Value: // node name // // Output Value: // None // // // Procedure Name: // getAllCharacters // // Description: // Helper function to recursively find all of the sub characters in a // character // // Input Arguments: // $character - the name of the character to expand // // Return Value: // string[] (list of related nodes, with the node whose // tab you want to be opened duplicated at the // end of the array) // proc string[] getAllCharacters( string $character, int $includeSelf ) { string $retval[]; if ( $includeSelf ) { $retval[size($retval)] = $character; } string $setMembers[] = `sets -query $character`; for ( $item in $setMembers ) { if ( `nodeType $item` == "character" ) { $result = getAllCharacters( $item, true ); for ( $subCharacter in $result ) { $retval[size($retval)] = $subCharacter; } } } return $retval; } global proc string[] AEcharacterRelated( string $node ) { string $relatedNodes[] = getAllCharacters( $node, false ); $relatedNodes[size($relatedNodes)] = $node; return $relatedNodes; }