// =========================================================================== // 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: August 2001 // // Description: // This script is the import clip to character option box dialog. // // Input Arguments: // None. // // Return Value: // None. // proc setOptionVars (int $forceFactorySettings) { // import clip to timeline // if ($forceFactorySettings || !`optionVar -exists ImportClipToTimeline`) { optionVar -intValue ImportClipToTimeline 1; } } // // Procedure Name: // ImportClipToCharSetup // // Description: // Update the state of the option box UI to reflect the option values. // // Input Arguments: // parent - Top level parent layout of the option box UI. // Required so that UI object names can be // successfully resolved. // // forceFactorySettings - Whether the option values should be set to // default values. // // Return Value: // None. // global proc ImportClipToCharSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings // setOptionVars( $forceFactorySettings ); setParent $parent; // import to timeline // int $toTimeline = `optionVar -query ImportClipToTimeline`; if ($toTimeline) { radioButtonGrp -e -sl 1 scheduleMethod; } else { radioButtonGrp -e -sl 1 moveToLibraryMethod; } } // // Procedure Name: // ImportClipToCharCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc ImportClipToCharCallback (string $parent, int $doIt) { setParent $parent; if (`radioButtonGrp -q -sl scheduleMethod` == 1) { optionVar -intValue ImportClipToTimeline 1; } else { optionVar -intValue ImportClipToTimeline 0; } if ($doIt) { performImportClipToChar 0; addToRecentCommandQueue "performImportClipToChar 0" "ImportClipToChar"; } } proc string ImportClipToCharWidgets( string $parent ) { setParent $parent; string $tabForm = `columnLayout -adjustableColumn true`; radioButtonGrp -numberOfRadioButtons 1 -label (uiRes("m_performImportClipToChar.kClip")) -label1 (uiRes("m_performImportClipToChar.kPutClipInVisorOnly")) -annotation (uiRes("m_performImportClipToChar.kPutClipInVisorOnlyAnnot")) moveToLibraryMethod; radioButtonGrp -numberOfRadioButtons 1 -label1 (uiRes("m_performImportClipToChar.kPutClipInTraxEditorAndVisor")) -annotation (uiRes("m_performImportClipToChar.kPutClipInTraxEditorAndVisorAnnot")) -shareCollection moveToLibraryMethod scheduleMethod; return $tabForm; } global proc ImportClipToCharOptions () { string $commandName = "ImportClipToChar"; string $applyTitle = "Create"; // Build the option box "methods" // string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // Get the option box. // // The value returned is the name of the layout to be used as // the parent for the option box UI. // string $layout = getOptionBox(); setParent $layout; setOptionBoxCommandName("clip"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scr true -tv false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; ImportClipToCharWidgets $parent; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performImportClipToChar.kImportClip")) -command ($callback + " " + $parent + " " + 1 ) $applyBtn; // 'Save' button. // string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox") $saveBtn; // 'Reset' button. // string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Set the option box title. // setOptionBoxTitle (uiRes("m_performImportClipToChar.kImportClipToCharacterOptions")); // Customize the 'Help' menu item text. // setOptionBoxHelpTag( "Import Clip" ); // Set the current values of the option box. // eval (($setup + " " + $parent + " " + 0)); // Show the option box. // showOptionBox(); } // // Procedure Name: // assembleCmd // // Description: // Construct the command that will apply the option box values. // // Input Arguments: // None. // // Return Value: // None. // proc string assembleCmd() { string $cmd; setOptionVars(false); // check whether to schedule the clip int $toTimeline = 1; if (`optionVar -exists ImportClipToTimeline`) { $toTimeline = `optionVar -query ImportClipToTimeline`; } // doImportClipArgList takes a string array // $cmd = "doImportClipArgList 4 { " + "\"1\"" + ",\"" + $toTimeline + "\" };"; return $cmd; } // // Procedure Name: // performImportClipToChar // // Description: // Import the clip. This procedure will also show the option box // window if necessary as well as construct the command string // that will import the clip with the current option box values. // // Input Arguments: // 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performImportClipToChar (int $action) { string $cmd = ""; switch ($action) { // Execute the command. // case 0: // Retrieve the option settings // setOptionVars(false); // Get the command. // $cmd = assembleCmd(); // Execute the command with the option settings. // evalEcho($cmd); break; // Show the option box. // case 1: ImportClipToCharOptions(); break; case 2: // Get the command. // $cmd = assembleCmd(); } return $cmd; }