From fa71ae414f12604f4854dcf32b09cc49f41106f9 Mon Sep 17 00:00:00 2001 From: Samuel Liu Date: Wed, 28 Feb 2024 16:32:18 -0500 Subject: [PATCH] Make root prim persistent and update default prim accordingly --- plugin/adsk/scripts/mayaUsdTranslatorExport.mel | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugin/adsk/scripts/mayaUsdTranslatorExport.mel b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel index 65f0df6972..50d58caed5 100644 --- a/plugin/adsk/scripts/mayaUsdTranslatorExport.mel +++ b/plugin/adsk/scripts/mayaUsdTranslatorExport.mel @@ -286,7 +286,7 @@ global proc mayaUsdTranslatorExport_updateDefaultPrimList() { } -global proc onExportRootPrimChanged() { +global proc mayaUsdTranslatorExport_RootPrimCB() { if (`optionMenuGrp -exists exportDefaultPrim` == 0){ return; } @@ -445,6 +445,7 @@ global proc mayaUsdTranslatorExport_EnableAllControls() { textFieldGrp -e -en 1 rootPrimField; optionMenuGrp -e -en 1 rootPrimTypePopup; } + optionMenuGrp -e -en -1 exportDefaultPrim; } if (stringArrayContains("materials", $sectionNames)) { @@ -494,6 +495,8 @@ global proc mayaUsdTranslatorExport_SetFromOptions(string $currentOptions, int $ int $exportCameras = 1; int $exportLights = 1; + int $hasRootPrim = 0; + string $excludeTypes; for ($index = 0; $index < size($optionList); $index++) { tokenize($optionList[$index], "=", $optionBreakDown); @@ -553,6 +556,9 @@ global proc mayaUsdTranslatorExport_SetFromOptions(string $currentOptions, int $ floatFieldGrp -e -v1 $frameStride -en1 $enable frameStrideField; } else if ($optionBreakDown[0] == "frameSample") { mayaUsdTranslatorExport_SetTextField($optionBreakDown[1], $enable, "frameSampleField"); + } else if ($optionBreakDown[0] == "rootPrim") { + mayaUsdTranslatorExport_SetTextField($optionBreakDown[1], $enable, "rootPrimField"); + $hasRootPrim = 1; } else if ($optionBreakDown[0] == "convertMaterialsTo") { mayaUsdTranslatorExport_SetConvertMaterialsToCheckboxes($optionBreakDown[1], $enable, $processJobContext); } else if ($optionBreakDown[0] == "shadingMode" && $optionBreakDown[1] != "useRegistry") { @@ -570,8 +576,6 @@ global proc mayaUsdTranslatorExport_SetFromOptions(string $currentOptions, int $ } else if ($optionBreakDown[0] == "worldspace") { mayaUsdTranslatorExport_SetCheckbox($optionBreakDown[1], $enable, "worldspaceCheckBox"); } - // Removed parent scope because we don't need the parent scope name from last export. Also parent scope created at export - // will be the default default prim, which can be misleading when this field is filled with previous parent scope name. } // We now know if we export nurbs curves or not and if forced by the job context: @@ -592,6 +596,9 @@ global proc mayaUsdTranslatorExport_SetFromOptions(string $currentOptions, int $ if ($processJobContext == 0 && $supportsMultiExport == 0) { mayaUsdTranslatorExport_DisableConvertMaterialsToCheckboxes(); } + if ($hasRootPrim == 1){ + mayaUsdTranslatorExport_RootPrimCB(); + } } } @@ -763,7 +770,7 @@ global proc int mayaUsdTranslatorExport (string $parent, //separator -style "none"; textFieldGrp -l `getMayaUsdString("kExportRootPrimLbl")` -placeholderText `getMayaUsdString("kExportRootPrimPht")` - -annotation `getMayaUsdString("kExportRootPrimAnn")` -textChangedCommand "onExportRootPrimChanged" rootPrimField; + -annotation `getMayaUsdString("kExportRootPrimAnn")` -textChangedCommand "mayaUsdTranslatorExport_RootPrimCB" rootPrimField; optionMenuGrp -l `getMayaUsdString("kExportRootPrimTypeLbl")` rootPrimTypePopup; menuItem -l `getMayaUsdString("kExportScopeLbl")` -ann "scope";