// =========================================================================== // 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. // =========================================================================== // Procedure Name: // performArchiveScene // // Description: // // // Input Arguments: // $option : Whether to set the options to default values. // Return Value: // None // proc setOptionVars (int $forceFactorySettings) { if ($forceFactorySettings || !`optionVar -exists archiveUnloadedReferencesEnabled`) { optionVar -intValue archiveUnloadedReferencesEnabled false; } } global proc archiveSceneSetup (string $parent, int $forceFactorySettings) { setOptionVars($forceFactorySettings); setParent $parent; checkBoxGrp -edit -v1 `optionVar -query archiveUnloadedReferencesEnabled` archiveUnloadedReferencesEnabled; } global proc archiveSceneCallback (string $parent, int $doIt) { setParent $parent; optionVar -intValue "archiveUnloadedReferencesEnabled" `checkBoxGrp -query -value1 archiveUnloadedReferencesEnabled`; if ($doIt) { performArchiveScene 0; string $tmpCmd = "performArchiveScene 0 "; addToRecentCommandQueue $tmpCmd "Archive Scene"; } } proc archiveSceneOptions () { string $commandName = "archiveScene"; string $callback = ($commandName + "Callback"); string $setup = ($commandName + "Setup"); // STEP 1: Get the option box. // ============================ // string $layout = getOptionBox(); setParent $layout; // STEP 2: Pass the command name to the option box. // ================================================= // setOptionBoxCommandName("Archive Scene Options"); // STEP 3: Activate the default UI template. // ========================================== // setUITemplate -pushTemplate DefaultTemplate; // STEP 4: Create option box contents. // =================================== // waitCursor -state 1; string $parent = `columnLayout -adjustableColumn 1 -columnAttach "both" 5`; checkBoxGrp -cw 2 240 -numberOfCheckBoxes 1 -label "" -label1 (uiRes("m_performArchiveScene.kArchiveUnloadedReference")) -annotation (uiRes("m_performArchiveScene.kArchiveUnloadedReferenceAnnot")) archiveUnloadedReferencesEnabled; setParent -menu ..; waitCursor -state 0; // Step 5: Deactivate the default UI template. // =========================================== // setUITemplate -popTemplate; // Step 6: Customize the buttons. // ============================== // string $applyBtn = getOptionBoxApplyBtn(); button -edit -label (uiRes("m_performArchiveScene.kArchive")) -command ($callback + " " + $parent + " " + 1) $applyBtn; string $applyAndCloseBtn = getOptionBoxApplyAndCloseBtn(); button -edit -label (uiRes("m_performArchiveScene.kArchiveAndClose")) $applyAndCloseBtn; string $saveBtn = getOptionBoxSaveBtn(); button -edit -command ($callback + " " + $parent + " " + 0 + " " +"; hideOptionBox") $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -edit -command ($setup + " " + $parent + " " + 1) $resetBtn; // Step 7: Set the option box title. // ================================= // string $title = (uiRes("m_performArchiveScene.kArchiveSceneOptions")); setOptionBoxTitle( $title ); // Step 8: Customize the 'Help' menu item text. // ============================================ // setOptionBoxHelpTag("ArchiveSceneOptions"); // Step 9: Set the current values of the option box. // ================================================= // eval (($setup + " " + $parent + " " + 0)); // Step 10: Show the option box. // ============================= // showOptionBox(); } proc string assembleCmd() { setOptionVars (false); int $unloadRefEnabled = `optionVar -query "archiveUnloadedReferencesEnabled"`; string $cmd = "python (\"import maya.app.general.zipScene;maya.app.general.zipScene.zipScene("+ $unloadRefEnabled + ")\")"; return $cmd; } global proc string performArchiveScene (int $option) { string $cmd=""; switch ($option) { case 0: $cmd = `assembleCmd`; eval($cmd); break; case 1: archiveSceneOptions; break; case 2: $cmd = `assembleCmd`; break; } return $cmd; }