// =========================================================================== // 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: // Create UI components for Alembic plugin // global proc AlembicCreateUI() { global string $gMainWindow; // defined by Maya // load AbcImport and AbcExport plugins source performAlembicExport; if (!`pluginInfo -q -loaded AbcImport`) { loadPlugin -quiet AbcImport; } source performAlembicImport; if (!`pluginInfo -q -loaded AbcExport`) { loadPlugin -quiet AbcExport; } // register runtime command if (!`runTimeCommand -exists AlembicOpen`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kOpenAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicOpenAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicImport 0 1" AlembicOpen; } if (!`runTimeCommand -exists AlembicReference`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kAlembicReferenceLbl")) -annotation (uiRes("m_AlembicCreateUI.kAlembicReferenceAnnot")) -category "Menu items.Cache.Alembic Cache" -command "projectViewer AlembicReference;" AlembicReference; } if (!`runTimeCommand -exists AlembicImport`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kImportAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicImportAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicImport 0 2" AlembicImport; } if (!`runTimeCommand -exists AlembicImportOptions`) { runTimeCommand -default true -annotation (uiRes("m_AlembicCreateUI.kAlembicImportOptionsAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicImport 1 2" AlembicImportOptions; } if (!`runTimeCommand -exists AlembicReplace`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kReplaceAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicReplaceAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicImport 0 3" AlembicReplace; } if (!`runTimeCommand -exists AlembicExportAll`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kExportAllToAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicExportAllAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicExport 0 1" AlembicExportAll; } if (!`runTimeCommand -exists AlembicExportAllOptions`) { runTimeCommand -default true -annotation (uiRes("m_AlembicCreateUI.kAlembicExportAllOptionsAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicExport 1 1" AlembicExportAllOptions; } if (!`runTimeCommand -exists AlembicExportSelection`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kExportSelectionToAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicExportSelectionAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicExport 0 0" AlembicExportSelection; } if (!`runTimeCommand -exists AlembicExportSelectionOptions`) { runTimeCommand -default true -annotation (uiRes("m_AlembicCreateUI.kAlembicExportSelectionOptionsAnnot")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicExport 1 0" AlembicExportSelectionOptions; } if (!`runTimeCommand -exists AlembicHelp`) { runTimeCommand -default true -label (uiRes("m_AlembicCreateUI.kAboutAlembic")) -annotation (uiRes("m_AlembicCreateUI.kAlembicHelp")) -category "Menu items.Cache.Alembic Cache" -command "performAlembicHelp" AlembicHelp; } // Insert Alembic Cache menu insertPipelineSubMenu "alembicCacheMenu" (uiRes("m_AlembicCreateUI.kAlembicCache")) "buildAlembicCacheMenu"; } global proc buildAlembicCacheMenu(string $parent) { setParent -menu $parent; if (`menu -q -numberOfItems $parent` != 0) { // // Menu is built already - just return // return; } // Create menu items // menuItem -dragMenuCommand "performAlembicImport 2 1" -rtc "AlembicOpen"; menuItem -version "2016" -rtc "AlembicReference"; menuItem -optionBox true -rtc ("CreateReferenceOptions") referenceFileOptions; menuItem -dragMenuCommand "performAlembicImport 2 2" -dragDoubleClickCommand "AlembicImportOptions" -rtc "AlembicImport"; menuItem -optionBox true -rtc "AlembicImportOptions"; menuItem -dragMenuCommand "performAlembicImport 2 3" -rtc "AlembicReplace"; menuItem -dragMenuCommand "performAlembicExport 2 1" -dragDoubleClickCommand "AlembicExportAllOptions" -rtc "AlembicExportAll"; menuItem -optionBox true -rtc "AlembicExportAllOptions"; menuItem -dragMenuCommand "performAlembicExport 2 0" -dragDoubleClickCommand "AlembicExportSelectionOptions" -rtc "AlembicExportSelection"; menuItem -optionBox true -rtc "AlembicExportSelectionOptions"; menuItem -rtc "AlembicHelp"; // } global proc performAlembicHelp() { showHelp -absolute "http://code.google.com/p/alembic/"; } global proc AlembicDeleteUI() { // Delete Alembic Cache menu if (!`pluginInfo -q -loaded AbcImport` && !`pluginInfo -q -loaded AbcExport`) { deletePipelineSubMenu "alembicCacheMenu"; } }