Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMSUSD-1030 - Make root prim persistent and update default prim accordingly #3641

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions plugin/adsk/scripts/mayaUsdTranslatorExport.mel
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ global proc mayaUsdTranslatorExport_updateDefaultPrimList() {

}

global proc onExportRootPrimChanged() {
global proc mayaUsdTranslatorExport_RootPrimCB() {
if (`optionMenuGrp -exists exportDefaultPrim` == 0){
return;
}
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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") {
Expand All @@ -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:
Expand All @@ -592,6 +596,9 @@ global proc mayaUsdTranslatorExport_SetFromOptions(string $currentOptions, int $
if ($processJobContext == 0 && $supportsMultiExport == 0) {
mayaUsdTranslatorExport_DisableConvertMaterialsToCheckboxes();
}
if ($hasRootPrim == 1){
mayaUsdTranslatorExport_RootPrimCB();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the rootPrim section is already filled, update the default prim list

}
}
}

Expand Down Expand Up @@ -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";
Expand Down
Loading