// =========================================================================== // 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: November 9, 2017 // // Description: // doKeySyncArgList is the actual proc that is executed from the // Edit->Curves->Key Sync Filter option box or menu // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // "1" : $timeRange, $selectionConnection, $options // // $args // Version 1 // [0] $whichRange 1: time range all // 2: use playback range // 3: use $timeRange // 4: use selected keys // [1] $timeRange startTime:endTime // [2] $selectionConnection name of selection connection to use // unless $options has "bufferCurve" in which // case this is the name of the editor // [3] $options a ':' delimited list of options // noOptions an empty placeholder // bufferCurve create buffer curves // // Return Value: // The number of curves filtered. // global proc int doKeySyncArgList (string $version, string $args[]) { int $versionNum = $version; int $whichRange = $args[0]; string $timeRange = $args[1]; string $selectionConnection = $args[2]; string $options = $args[3]; string $cmd = "filterCurve -f keySync "; string $realConnection = $selectionConnection; // Check for the bufferCurve option // if (match ("bufferCurve", $options) == "bufferCurve") { $realConnection = `editor -query -mainListConnection $selectionConnection`; // Check to see if we need to create buffer curves // if (`animCurveEditor -query -showBufferCurves $selectionConnection` == "on") { $cmd = "bufferCurve -animation \"keys\" -overwrite false; " + $cmd; } } // Get the target objects // string $members; int $keyCount = 0; // Get the target objects // $members = expandSelectionConnection ($realConnection); if ($whichRange == 4) { $cmd = ( $cmd + "-selectedKeys " ); } else if ($whichRange > 1) { float $startTime = `playbackOptions -q -min`; float $endTime = `playbackOptions -q -max`; if ($whichRange > 2) { string $buff[]; tokenize $timeRange ":" $buff; $startTime = $buff[0]; $endTime = $buff[1]; } $cmd = ( $cmd + "-startTime \"" + $startTime + "\" " ); $cmd = ( $cmd + "-endTime \"" + $endTime + "\" " ); } // Add on the parameters // // // Add the selection connection to the cmd if there are no keyframes // on the active list. // if ($keyCount == 0) { if (($members == "") || ($members == "{}")) { $cmd = ""; warning ( (uiRes("m_doKeySyncArgList.kNoObjectsSelectedKeySync")) ); } else { $cmd = ($cmd + " " + $members); } } if ($cmd == "") { return (0); } else { return evalEcho( $cmd ); } }