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-121837: Maya Reference: Clean up 'Cache to USD' UI options #2144

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
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
22 changes: 20 additions & 2 deletions lib/mayaUsd/resources/scripts/mayaUsdCacheMayaReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,19 @@ def primNameTextChanged(primName):
if validatedName != primName:
cmds.textFieldGrp('primNameText', edit=True, text=validatedName)

def variantOrNewPrim(buttonChecked):
# The variant and new child prim radio buttons are part of a collection.
# So only one can be checked.
variantSelected = cmds.radioButtonGrp('variantRadioBtn', query=True, select=1)
cmds.rowLayout('usdCacheVariantSetRow', edit=True, enable=variantSelected)
cmds.rowLayout('usdCacheVariantNameRow', edit=True, enable=variantSelected)
cmds.textFieldGrp('primNameText', edit=True, enable=not variantSelected)
Comment on lines +156 to +159
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enable or disable certain sections based on whether the variant or new prim radio button is selected.


def cacheFileUsdHierarchyOptions(topForm):
'''Create controls to insert Maya reference USD cache into USD hierarchy.'''

cmds.setParent(topForm)
cmds.frameLayout(label=getMayaUsdLibString("kCacheMayaRefUsdHierarchy"))
cmds.frameLayout('authorFrameLayout', label=getMayaUsdLibString("kCacheMayaRefUsdHierarchy"))
widgetColumn = cmds.columnLayout()

rl = mel.eval('createRowLayoutforMayaReference("' + widgetColumn + '", "cacheFilePreviewRow", 2)')
Expand All @@ -166,7 +173,7 @@ def cacheFileUsdHierarchyOptions(topForm):

with mayaRefUtils.SetParentContext(cmds.rowLayout(numberOfColumns=2)):
cmds.optionMenuGrp('compositionArcTypeMenu',
label=getMayaUsdLibString('kOptionAsCompositionArc'),
label=getMayaUsdLibString('kOptionAsUSDReference'),
cc=compositionArcChanged)
for label in _compositionArcLabels:
cmds.menuItem(label=label)
Expand All @@ -178,6 +185,7 @@ def cacheFileUsdHierarchyOptions(topForm):

variantRb = cmds.radioButtonGrp('variantRadioBtn',
nrb=1,
changeCommand1=variantOrNewPrim,
label=getMayaUsdLibString('kTextDefineIn'),
l1=getMayaUsdLibString('kTextVariant'))

Expand All @@ -196,6 +204,8 @@ def cacheFileUsdHierarchyOptions(topForm):
cmds.textField('variantNameText',
cc=variantNameTextChanged)

# Note: this radio button doesn't need the change command since its part of
# the same collection as the variantRb (which has the changeCommand).
newChildRb = cmds.radioButtonGrp('newChildPrimRadioBtn',
nrb=1,
label='',
Expand All @@ -207,6 +217,7 @@ def cacheFileUsdHierarchyOptions(topForm):
cc=primNameTextChanged)

cmds.radioButtonGrp(variantRb, edit=True, select=1)
variantOrNewPrim(True)


# Adapted from fileOptions.mel:fileOptionsTabPage().
Expand Down Expand Up @@ -332,6 +343,13 @@ def cacheInitUi(parent, filterType):
primName = mayaUsd.ufe.uniqueChildName(mayaRefPrimParent, kDefaultCachePrimName)
cmds.textFieldGrp('primNameText', edit=True, text=primName)

# By default we want to collapse certain sections.
cmds.frameLayout('outputFrameLayout', edit=True, collapse=False)
cmds.frameLayout('geometryFrameLayout', edit=True, collapse=True)
cmds.frameLayout('materialsFrameLayout', edit=True, collapse=True)
cmds.frameLayout('animationFrameLayout', edit=True, collapse=True)
cmds.frameLayout('advancedFrameLayout', edit=True, collapse=True)
cmds.frameLayout('authorFrameLayout', edit=True, collapse=False)

def cacheCommitUi(parent, selectedFile):
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/mayaUsd/resources/scripts/mayaUsdLibRegisterStrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def mayaUsdLibRegisterStrings():
register('kButtonNewChildPrim', 'New Child Prim')
register('kCacheFileWillAppear', 'Cache file will appear\non parent prim:')
register('kCacheMayaRefCache', 'Cache');
register('kCacheMayaRefOptions', 'Cache Options');
register('kCacheMayaRefOptions', 'Cache File Options');
register('kCacheMayaRefUsdHierarchy', 'Author Cache File to USD Hierarchy');
register('kCaptionCacheToUsd', 'Cache to USD')
register('kErrorCacheToUsdFailed', 'Cache to USD failed for "^1s".')
register('kMenuAppend', 'Append')
register('kMenuPayload', 'Payload')
register('kMenuPrepend', 'Prepend')
register('kMenuReference', 'Reference')
register('kOptionAsCompositionArc', 'As Composition Arc:')
register('kOptionAsUSDReference', 'As USD Reference:')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Couple of minor renaming as per design.

register('kOptionListEditedAs', 'List Edited As')
register('kTextDefineIn', 'Define in:')
register('kTextVariant', 'Variant')
Expand Down
10 changes: 5 additions & 5 deletions plugin/adsk/scripts/mayaUsdTranslatorExport.mel
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ global proc int mayaUsdTranslatorExport (string $parent,
}

if (stringArrayContains("output", $sectionNames)) {
frameLayout -label `getMayaUsdString("kExportFrameOutputLbl")` -collapsable true -collapse false;
frameLayout -label `getMayaUsdString("kExportFrameOutputLbl")` -collapsable true -collapse false outputFrameLayout;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gave all these frameLayout's names so that from the "Cache to Usd" I can collapse them.

separator -style "none";

optionMenuGrp -l `getMayaUsdString("kExportDefaultFormatLbl")` -annotation `getMayaUsdString("kExportDefaultFormatAnn")` -statusBarMessage `getMayaUsdString("kExportDefaultFormatStatus")` defaultUSDFormatPopup;
Expand All @@ -549,7 +549,7 @@ global proc int mayaUsdTranslatorExport (string $parent,
}

if (stringArrayContains("geometry", $sectionNames)) {
frameLayout -label `getMayaUsdString("kExportFrameGeometryLbl")` -collapsable true -collapse false;
frameLayout -label `getMayaUsdString("kExportFrameGeometryLbl")` -collapsable true -collapse false geometryFrameLayout;
separator -style "none";
optionMenuGrp -l `getMayaUsdString("kExportSubdMethodLbl")` -annotation `getMayaUsdString("kExportSubdMethodAnn")` defaultMeshSchemePopup;
menuItem -l `getMayaUsdString("kExportSubdMethodCCLbl")` -ann "catmullClark";
Expand Down Expand Up @@ -580,7 +580,7 @@ global proc int mayaUsdTranslatorExport (string $parent,
}

if (stringArrayContains("materials", $sectionNames)) {
frameLayout -label `getMayaUsdString("kExportFrameMaterialsLbl")` -collapsable true -collapse false -ann `getMayaUsdString("kExportMaterialsAnn")`;
frameLayout -label `getMayaUsdString("kExportFrameMaterialsLbl")` -collapsable true -collapse false -ann `getMayaUsdString("kExportMaterialsAnn")` materialsFrameLayout;
separator -style "none";

string $conversions[] = `mayaUSDListShadingModes -export -useRegistryOnly`;
Expand All @@ -600,7 +600,7 @@ global proc int mayaUsdTranslatorExport (string $parent,

if (stringArrayContains("animation", $sectionNames)) {
frameLayout -label `getMayaUsdString("kExportFrameAnimationLbl")` -collapsable true -collapse false
-expandCommand("mayaUsdTranslatorExport_AnimationFrameLayoutExpandCB");
-expandCommand("mayaUsdTranslatorExport_AnimationFrameLayoutExpandCB") animationFrameLayout;
separator -style "none";

if (stringArrayContains("animation-data", $sectionNames)) {
Expand Down Expand Up @@ -630,7 +630,7 @@ global proc int mayaUsdTranslatorExport (string $parent,
}

if (stringArrayContains("advanced", $sectionNames)) {
frameLayout -label `getMayaUsdString("kExportFrameAdvancedLbl")` -collapsable true -collapse true;
frameLayout -label `getMayaUsdString("kExportFrameAdvancedLbl")` -collapsable true -collapse true advancedFrameLayout;
separator -style "none";

checkBoxGrp -l `getMayaUsdString("kExportVisibilityLbl")` -annotation `getMayaUsdString("kExportVisibilityAnn")` exportVisibilityCheckBox;
Expand Down