// =========================================================================== // 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. // =========================================================================== // // // // // // // // findAnimCurves (string $selectionConnection) // // // string[] (array of animCurves) // // // Given a selection connection, tells you which curves are selected. // // // // // Get a list of the curves selected in the outliner of the graph editor // // // GraphEditor; // string $selConn = `editor -q -selectionConnection graphEditor1OutlineEd`; // findAnimCurves($selConn); // // ///////////////////////////////////////////////////////////////////////// global proc string[] findAnimCurves (string $selectionConnection) { string $animCurves[]; int $numCurves = 0; // Make sure we have a valid selection connection // if ($selectionConnection == "") { return ($animCurves); } if (!`selectionConnection -query -exists $selectionConnection`) { return ($animCurves); } // Get the list of objects within the selection connection // string $objectList[] = `selectionConnection -query -object $selectionConnection`; if (size ($objectList) == 0) { return ($animCurves); } // Find all the animCurves within the object list and curves // connected to the select objects // string $connectList[]; if (!catch ($connectList = `findKeyframe -curve $objectList`)) { for ($connection in $connectList) { if (`isAnimCurve $connection` != 1) { continue; } $animCurves[$numCurves] = $connection; $numCurves++; } } return ($animCurves); }