// =========================================================================== // 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 18, 1996 // // Description: // Duplicate script. // // // Procedure Name: // duplicateHelp // // Description: // Return a short description about this command. // // Input Arguments: // None. // // Return Value: // string. // proc string duplicateHelp() { return " Command: Duplicate - create a copy of selected objects.\n" + "Selection: objects."; } // // Procedure Name: // assembleCmd // // Description: // Construct the command // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd = "duplicatePreset"; int $count = 1; int $copy = 1; int $group = 1; int $smart = 0; int $upstream = 0; int $inputConn = 0; int $renameChild = 0; int $instanceLeaf = 0; float $transX = 0.0; float $transY = 0.0; float $transZ = 0.0; float $rotatX = 0.0; float $rotatY = 0.0; float $rotatZ = 0.0; float $scaleX = 1.0; float $scaleY = 1.0; float $scaleZ = 1.0; $cmd = ($cmd + "(" + $count + "," + $copy + "," + $group + "," + $smart + "," + $upstream + "," + $inputConn + "," + $renameChild + "," + $instanceLeaf + "," + $transX + "," + $transY + "," + $transZ + "," + $rotatX + "," + $rotatY + "," + $rotatZ + "," + $scaleX + "," + $scaleY + "," + $scaleZ + ")" ); return $cmd; } // // Procedure Name: // checkForClipDuplicate // // Description: // Determine if the duplicate command is coming from a trax panel. // // Input Arguments: // None. // // Return Value: // true if the clip specific duplicate should be involked, false otherwise. // proc int checkForClipDuplicate() { string $clips[] = `ls -sl -type animClip`; if (size($clips) == 0) { return false; } string $currentPanel = `getPanel -underPointer`; if( $currentPanel == "" ) { $currentPanel = `getPanel -withFocus`; } string $panelType = `getPanel -typeOf $currentPanel`; if( $panelType == "scriptedPanel" ) { $panelType = `scriptedPanel -q -type $currentPanel`; if ($panelType == "clipEditorPanel"){ return true; } } return false; } // // Procedure Name: // performDuplicate // // Description: // Perform the duplicate command. // // Input Arguments: // 0 - Execute the command. // 1 - Do nothing (option box removed) // 2 - Return the command. // global proc string performDuplicate (int $action) { string $cmd = ""; if( $action == 0) { if ( checkForClipDuplicate() ) { return performDuplicateClip( $action, "" ); } } switch ($action) { // Execute the command. // case 0: // Get the command. // $cmd = `assembleCmd`; // Execute the command with the option settings. // // *NOTE* we do NOT want to use evalEcho here because // this calls the duplicatePreset command which does // the command echoing. // eval($cmd); break; // Do nothing - option box removed case 1: break; // Return the command string. // case 2: // Get the command. // $cmd = `assembleCmd`; break; } return $cmd; }