// =========================================================================== // 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. // =========================================================================== // // // Procedure Name: // characterFind // // Description: // Change the Trax display to show the character that contains whatever objects // in the scene are selected. // // Input Arguments: // $listItem - current trax editor list item // $editor - trax editor window // // Return Value: // None // global proc characterFind(string $listItem, string $editor) { string $sel[] = `ls -sl`; int $selNum = size($sel); // get the characters in the scene // string $chars[] =`ls -type character`; int $charNum = size($chars); if (0 == $selNum) { error (uiRes("m_characterFind.kSelectTheObject")); } if (0 == $charNum) { error (uiRes("m_characterFind.kThereAreNoChars")); } // search through the characters to see if the selected node is in there. // select -cl; ClearCurrentCharacterList; setCurrentCharacterList $editor 1; string $multChars[]; for ($charac in $chars) { select -cl; selectNodesInCharacter($charac); //select the members of the character string $members[] = `ls -sl`; //array of the characters nodes int $numMembers=`size($members)`; int $y=0; int $foundIt = 0; for ($y=0; $y < $numMembers && !$foundIt ; $y++) { for ($z=0; $z < $selNum && !$foundIt ; $z++) { if ($members[$y] == $sel[$z]) { //select the character and only show it in trax. $multChars[size($multChars)] = $charac; $foundIt = 1; } } } } // restore the selection // select -r $sel; if (size($multChars)>0) { setCurrentCharacters $multChars ; toggleCurrentCharacterList $listItem $editor; setCurrentCharacterList $editor 1; } else { error (uiRes("m_characterFind.kTheSelectedObject")); } }