// =========================================================================== // 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: // This script contains the export EDL option box dialog // global proc int doExportEDL( int $forcePlayblast, string $fileName, string $fileType) { if( $fileType != "edl" ) return 0; python("import maya.app.edl.importExport as EDL"); python("EDL.doExport(\"" + $fileName + "\", " + $forcePlayblast + ")"); return 1; } proc setOptionVars (int $forceFactorySettings) { if( $forceFactorySettings || !`optionVar -exists exportEDLForcePlayblast` ) { optionVar -intValue exportEDLForcePlayblast 1; } } // // Procedure Name: // exportEDLSetup // // 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 exportEDLSetup (string $parent, int $forceFactorySettings) { // Retrieve the option settings. setOptionVars( $forceFactorySettings ); setParent $parent; // Set the start and end times. checkBoxGrp -e -v1 `optionVar -query exportEDLForcePlayblast` forcePlayblastEnabled; } // // Procedure Name: // exportEDLCallback // // 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 exportEDLCallback (string $parent, int $doIt) { setParent $parent; optionVar -intValue exportEDLForcePlayblast `checkBoxGrp -q -v1 forcePlayblastEnabled`; if ($doIt) { performExportEDL 0; } } global proc exportEDLOptions ( ) { string $commandName = "exportEDL"; // 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("exportEDL"); setUITemplate -pushTemplate DefaultTemplate; waitCursor -state 1; tabLayout -scr true -tv false; // To get the scroll bars string $parent = `columnLayout -adjustableColumn 1`; setParent $parent; checkBoxGrp -ncb 1 -label (uiRes("m_performExportEDL.kForcePlayblast")) forcePlayblastEnabled; setParent ..; waitCursor -state 0; setUITemplate -popTemplate; // 'Apply' button. // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performExportEDL.kExportEDL")) -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_performExportEDL.kExportEDLOptions")); setOptionBoxHelpTag( "ExportEDL" ); // 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); string $fileLabel = (uiRes("m_performExportEDL.kFileBroswerImport")); $cmd = "doExportEDL " + `optionVar -q exportEDLForcePlayblast`; $cmd = "fileBrowser(\"" + $cmd + "\", \"" + $fileLabel + "\", \"edl\", 1)"; return $cmd; } // // Procedure Name: // performExportEDL // // Description: // Export a Final Cut Pro XML or AAF file. // This procedure will also show the option box // window if necessary as well as construct the command string // that will split a shot with the current option box values. // // Input Arguments: // $action: 0 - Execute the command. // 1 - Show the option box dialog. // 2 - Return the command. // // Return Value: // None. // global proc string performExportEDL (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. // if ($cmd != "") evalEcho($cmd); break; // Show the option box. // case 1: exportEDLOptions(); break; case 2: // Get the command. // $cmd = assembleCmd(); } return $cmd; }