// =========================================================================== // 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. // =========================================================================== // Description: Returns true if a motion trail key is selected, false otherwise. // Only works on one key at a time. // the following data is added to $info: // $info[0] = the name of object the keys are on // $info[1] = the time of the selected key (if there is one) // $info[2] = if the key is a breakdown or not // // global proc int getSelectedMotionTrailKeyInfo(string $transform, string $shape, string $info[]) { int $numKeysFound = 0; string $matchStr = ($transform + ".point\\[[0-9]*\\]"); string $sel[] = `ls -sl`; for( $s in $sel ) { if( size(`match $matchStr $s`) > 0 ) { $numKeysFound++; string $indexStr= `match "\\[[0-9]*\\]" $s`; int $index = int(`substring $indexStr 2 (size($indexStr)-1)`); float $times[] = `getAttr ($shape + ".keyframeTimes")`; string $object[] = `listConnections ($shape + ".transformToMove")`; $info[size($info)] = $object[0]; $info[size($info)] = $times[$index]; // Make sure it's a breakdown key for TX, TY and TZ int $foundCount = 0; float $breakdown[] = `keyframe -q -breakdown $object[0]`; for( $key in $breakdown ) { if( $key == $times[$index] ) { $foundCount++; } } $info[size($info)] = ($foundCount == 3); return 1; } } return 0; }