From ea7d371f86a9ec8d6c71dd749da9e8dd9f62d513 Mon Sep 17 00:00:00 2001 From: Sean Donnelly <23455376+seando-adsk@users.noreply.github.com> Date: Fri, 18 Feb 2022 11:12:29 -0500 Subject: [PATCH] MAYA-121625: cache to USD: take out 'Parent Scope' from options * Used patter for sub-option to remove the Parent Scope field from the Cache To Usd. --- .../scripts/mayaUsdCacheMayaReference.py | 7 +++++-- .../adsk/scripts/mayaUSDRegisterStrings.mel | 6 +++--- .../adsk/scripts/mayaUsdTranslatorExport.mel | 20 ++++++++++++------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py b/lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py index ef8ed458ea..2b18a86f31 100644 --- a/lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py +++ b/lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py @@ -34,6 +34,9 @@ # Cache options in string format, for MEL mayaUsdTranslatorExport() consumption. _cacheExportOptions = None +# The options string that we pass to mayaUsdTranslatorExport. +kTranslatorExportOptions = 'all;!output-parentscope;!animation-data' + # Dag path corresponding to pulled prim. This is a Maya transform node that is # not in the Maya reference itself, but is its parent. _mayaRefDagPath = None @@ -181,7 +184,7 @@ def fileOptionsTabPage(tabLayout): # USD file option controls will be parented under this layout. # resultCallback not called on "post", is therefore an empty string. fileOptionsScroll = cmds.columnLayout('fileOptionsScroll') - mel.eval('mayaUsdTranslatorExport("fileOptionsScroll", "post=all;!animation-data", "' + getCacheExportOptions() + '", "")') + mel.eval('mayaUsdTranslatorExport("fileOptionsScroll", "post={exportOpts}", "{cacheOpts}", "")'.format(exportOpts=kTranslatorExportOptions, cacheOpts=getCacheExportOptions())) cacheFileUsdHierarchyOptions(topForm) @@ -241,7 +244,7 @@ def cacheCommitUi(parent, selectedFile): # The following call will set _cacheExportOptions. Initial settings not # accessed on "query", is therefore an empty string. - mel.eval('mayaUsdTranslatorExport("fileOptionsScroll", "query", "", "mayaUsdCacheMayaReference_setCacheOptions")') + mel.eval('mayaUsdTranslatorExport("fileOptionsScroll", "query={exportOpts}", "", "mayaUsdCacheMayaReference_setCacheOptions")'.format(exportOpts=kTranslatorExportOptions)) primName = cmds.textFieldGrp('primNameText', query=True, text=True) payloadOrReference = cmds.optionMenuGrp('compositionArcTypeMenu', query=True, value=True) diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel index 28c49e4262..00e89907bc 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.mel +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.mel @@ -162,9 +162,9 @@ global proc mayaUSDRegisterStrings() register("kExportMergeShapesLbl", "Merge Transform and\nShape Nodes:"); register("kExportNamespacesAnn", "By default, namespaces are exported to the USD file in the following format: nameSpaceExample_pPlatonic1"); register("kExportNamespacesLbl", "Include Namespaces:"); - register("kExportParentScopAnn", "Name of the USD scope that is the parent of the exported data."); - register("kExportParentScopLbl", "Create USD Parent Scope:"); - register("kExportParentScopPht", "USD Prim Name"); + register("kExportParentScopeAnn", "Name of the USD scope that is the parent of the exported data."); + register("kExportParentScopeLbl", "Create USD Parent Scope:"); + register("kExportParentScopePht", "USD Prim Name"); register("kExportSkelsAnn", "Exports Maya joints as part of a USD skeleton."); register("kExportSkelsLbl", "Skeletons:"); register("kExportSkelsNoneLbl", "None"); diff --git a/plugin/adsk/scripts/mayaUsdTranslatorExport.mel b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel index 9714e57963..cc6b6f63b9 100644 --- a/plugin/adsk/scripts/mayaUsdTranslatorExport.mel +++ b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel @@ -310,7 +310,9 @@ global proc mayaUsdTranslatorExport_EnableAllControls() { if (stringArrayContains("output", $sectionNames)) { optionMenuGrp -e -en 1 defaultUSDFormatPopup; - textFieldGrp -e -en 1 parentScopeField; + if (stringArrayContains("output-parentscope", $sectionNames)) { + textFieldGrp -e -en 1 parentScopeField; + } } if (stringArrayContains("materials", $sectionNames)) { @@ -424,7 +426,7 @@ proc string[] parseActionSectionNames(string $sections) { global string $mayaUsdTranslatorExport_SectionNames[]; - string $allSections[] = { "context", "output", "geometry", "materials", "animation", "animation-data", "advanced" }; + string $allSections[] = { "context", "output", "output-parentscope", "geometry", "materials", "animation", "animation-data", "advanced" }; string $sectionList[]; tokenize($sections, ";", $sectionList); @@ -472,7 +474,7 @@ global proc int mayaUsdTranslatorExport (string $parent, // // In addition to the action, the list of UI sections that are desired can be added // with the syntax "action=section1;section2;..." where the section names can be: -// context, output, geometry, materials, animation, animation-data, advanced +// context, output, output-parentscope, geometry, materials, animation, animation-data, advanced // // The section name can also be "all", "none" or prefixed with "!": // - When "all" is used, all sections are included. @@ -534,10 +536,12 @@ global proc int mayaUsdTranslatorExport (string $parent, menuItem -l `getMayaUsdString("kExportDefaultFormatBinLbl")` -ann "usdc"; menuItem -l `getMayaUsdString("kExportDefaultFormatAscLbl")` -ann "usda"; - separator -style "none"; + if (stringArrayContains("output-parentscope", $sectionNames)) { + separator -style "none"; - textFieldGrp -l `getMayaUsdString("kExportParentScopLbl")` -placeholderText `getMayaUsdString("kExportParentScopPht")` - -annotation `getMayaUsdString("kExportParentScopAnn")` parentScopeField; + textFieldGrp -l `getMayaUsdString("kExportParentScopeLbl")` -placeholderText `getMayaUsdString("kExportParentScopePht")` + -annotation `getMayaUsdString("kExportParentScopeAnn")` parentScopeField; + } separator -style "none"; setParent ..; @@ -681,7 +685,9 @@ global proc int mayaUsdTranslatorExport (string $parent, if (stringArrayContains("output", $sectionNames)) { $currentOptions = mayaUsdTranslatorExport_AppendFromPopup($currentOptions, "defaultUSDFormat", "defaultUSDFormatPopup"); - $currentOptions = mayaUsdTranslatorExport_AppendFromTextField($currentOptions, "parentScope", "parentScopeField"); + if (stringArrayContains("output-parentscope", $sectionNames)) { + $currentOptions = mayaUsdTranslatorExport_AppendFromTextField($currentOptions, "parentScope", "parentScopeField"); + } } if (stringArrayContains("materials", $sectionNames)) {