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

MAYA-121625: cache to USD: take out 'Parent Scope' from options #2122

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created constant for this string (used in 2 places) and added new string "output-parentscope"


# 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
Expand Down Expand Up @@ -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()))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Used constant so we have same string for both post and query.


cacheFileUsdHierarchyOptions(topForm)

Expand Down Expand Up @@ -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))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need the same option string for the query so you don't get back those options (like parent scope).


primName = cmds.textFieldGrp('primNameText', query=True, text=True)
payloadOrReference = cmds.optionMenuGrp('compositionArcTypeMenu', query=True, value=True)
Expand Down
6 changes: 3 additions & 3 deletions plugin/adsk/scripts/mayaUSDRegisterStrings.mel
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Comment on lines +165 to +167
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed typo in name

register("kExportSkelsAnn", "Exports Maya joints as part of a USD skeleton.");
register("kExportSkelsLbl", "Skeletons:");
register("kExportSkelsNoneLbl", "None");
Expand Down
20 changes: 13 additions & 7 deletions plugin/adsk/scripts/mayaUsdTranslatorExport.mel
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Comment on lines +540 to +545
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added ability to not add this parent scope field.


separator -style "none";
setParent ..;
Expand Down Expand Up @@ -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)) {
Expand Down