// =========================================================================== // 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. // =========================================================================== global proc string[] getHighlightedCharacters(string $editor) { string $hiConn = `clipEditor -query -highlightConnection $editor`; return `selectionConnection -query -object $hiConn`; } proc string[] findCharactersForSelection() { string $sel[] = `ls -sl`; string $characters[]; for ($obj in $sel) { string $isChar[] = `listConnections -type character $obj`; string $isCharNoDup[] = stringArrayRemoveDuplicates($isChar); for ($ch in $isCharNoDup) { $characters[size($characters)] = $ch; } } string $charReturn[] = stringArrayRemoveDuplicates($characters); return $charReturn; } global proc string[] getCharactersForAction() // // Description: // Find the character to operate on. The priority is: // 1) Highlighted character(s) in the trax window // 2) Selected character(s) // 3) Character(s) related to the selected object(s) // 4) Current character(s) // { string $characters[]; // Is a character highlighted? // string $panel = `getPanel -underPointer`; if( $panel == "" ) { $panel = `getPanel -withFocus`; } if( $panel != "" ) { if ( "scriptedPanel" == `getPanel -typeOf $panel`) { if ( "clipEditorPanel" == `scriptedPanel -q -type $panel`) { $characters = getHighlightedCharacters (clipEditorNameFromPanel($panel)); } } } if (size($characters) == 0) { $characters = `ls -sl -type character`; } if (size($characters) == 0) { $characters = findCharactersForSelection(); } if (size($characters) == 0) { $characters = `currentCharacters`; } return $characters; }