// =========================================================================== // 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: Jan 20, 2000 // // // Description: // Script to register UI action with clip editor // within it. // // Input Arguments: // None. // // Return Value: // None. // //////////////////////////////////////////////////////////////////////// // // Description: // Action called when key is pressed // // //////////////////////////////////////////////////////////////////////// global proc clipEditorDeleteCmd( string $editor ) { doRemoveClipArgList 1 { $editor, "0" }; } //////////////////////////////////////////////////////////////////////// // // Description: // Action called when clip is dropped in TraX // // //////////////////////////////////////////////////////////////////////// global proc clipDropCmd( string $editor, string $clip, string $character, string $track, string $group, string $startTime ) { if( !`exists getClipScheduler`) { source "ClipEdMenu.mel"; } string $cmd; int $isInstance = `getAttr ($clip+".clipInstance")`; int $isPose = `getAttr ($clip+".pose")`; // We need to copy and paste if the clip is not already mapped to this // character. But if it is already on the character, we can just // instance it. // int $copyPasteNeeded = 1; string $clipChars[] = `clip -q -ch $clip`; string $clipChar; for ($clipChar in $clipChars) { if ($clipChar == $character) { $copyPasteNeeded = 0; break; } } if (!$copyPasteNeeded) { // Make sure the clip is scheduled // $copyPasteNeeded = 1; string $sch = getClipScheduler($clip); if ($sch != "") { int $clipIndex = getClipIndex($clip, $sch); if ($clipIndex != -1) { $copyPasteNeeded = 0; } } } if ($copyPasteNeeded) { // copy and paste. Use characterMap if it exists, else paste by node name. string $absRelFlag = ""; if (!$isInstance) { if ($isPose) { $absRelFlag = " -allAbsolute"; } else { $absRelFlag = " -defaultAbsolute"; } } $cmd = ("clip -copy "+$clip+"; doPasteClipArgList 6 {\"byMapOrNodeName\", \"specify\", \"" + $character + "\", \"0\", \"" + $startTime + "\", \"" + $track + "\", \"" + $group + "\", \"" + $absRelFlag + "\"}"); } else { $cmd = ("doDuplicateClipArgList 3 {\"1\", \"0\", \"0\", \"" + $clip + "\", \"specify\", \"" + $startTime + "\", \"" + $track + "\", \"" + $group + "\"};"); } evalEcho($cmd); } // // Register UI actions with the clip editor. These are mel proc commands // that get called when UI events happen in the clip editor. // global proc clipEditorRegisterActions ( string $editor ) { // Delete Key clipEditor -e -deleteCmd clipEditorDeleteCmd $editor; // Node drop on track clipEditor -e -clipDropCmd clipDropCmd $editor; }