From c19150f16f4c2b3f8166543f92b446d12772df82 Mon Sep 17 00:00:00 2001 From: Aram Azhari Date: Tue, 4 Jul 2023 15:40:12 -0400 Subject: [PATCH 1/2] EMSUSD-249 Refactors relative path dialog options to be more clear --- plugin/adsk/scripts/mayaUSDRegisterStrings.py | 5 ++--- plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/plugin/adsk/scripts/mayaUSDRegisterStrings.py b/plugin/adsk/scripts/mayaUSDRegisterStrings.py index 1abcce1732..782b433fae 100644 --- a/plugin/adsk/scripts/mayaUSDRegisterStrings.py +++ b/plugin/adsk/scripts/mayaUSDRegisterStrings.py @@ -35,15 +35,14 @@ def mayaUSDRegisterStrings(): register("kDiscardStageEditsReloadMsg", "Are you sure you want to reload ^1s as the stage source?\n\nAll edits on your layers (except the session layer) in ^2s will be discarded.") register("kLoadUSDFile", "Load USD File") register("kFileOptions", "File Options") + register("kRelativePathOptions", "Relative Pathing") register("kMakePathRelativeToSceneFile", "Make Path Relative to Scene File") register("kMakePathRelativeToSceneFileAnn", "Path will be relative to your Maya scene file.") register("kMakePathRelativeToEditTargetLayer", "Make Path Relative to Edit Target Layer Directory") register("kMakePathRelativeToEditTargetLayerAnn", "Enable to activate relative pathing to your current edit target layer's directory.\nIf this option is disabled, verify that your target layer is not anonymous and save it to disk.") register("kMakePathRelativeToParentLayer", "Make Path Relative to Parent Layer Directory") register("kMakePathRelativeToParentLayerAnn", "Enable to activate relative pathing to your current parent layer's directory.\nIf this option is disabled, verify that your parent layer is not anonymous and save it to disk.") - register("kUnresolvedPath", "Unresolved Path:") + register("kUnresolvedPath", "Path Preview:") register("kUnresolvedPathAnn", "This field indicates the path with the file name currently chosen in your text input. Note: This is the string that will be written out to the file in the chosen directory in order to enable portability.") - register("kResolvedPath", "Resolved Path:") - register("kResolvedPathAnn", "This field indicates the resolved path of your chosen working directory for your USD file. Note: The resolved path for the file can vary for each individual as the file is handed off.") register("kCompositionArcOptions", "Composition Arc Options") register("kPreview", "Preview") diff --git a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py index f19bcae7f6..627aadab33 100644 --- a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py +++ b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py @@ -79,23 +79,20 @@ def uiCreate(cls, parentLayout, relativeToWhat): topForm = cmds.columnLayout('actionOptionsForm', rowSpacing=5) - kFileOptionsStr = getMayaUsdString("kFileOptions") + kRelativePathOptionsStr = getMayaUsdString("kRelativePathOptions") kMakePathRelativeStr = getMayaUsdString("kMakePathRelativeTo" + relativeToWhat) kMakePathRelativeAnnStr = getMayaUsdString("kMakePathRelativeTo" + relativeToWhat + "Ann") kUnresolvedPathStr = getMayaUsdString("kUnresolvedPath") kUnresolvedPathAnnStr = getMayaUsdString("kUnresolvedPathAnn") - kResolvedPathStr = getMayaUsdString("kResolvedPath") - kResolvedPathAnnStr = getMayaUsdString("kResolvedPathAnn") optBoxMarginWidth = mel.eval('global int $gOptionBoxTemplateDescriptionMarginWidth; $gOptionBoxTemplateDescriptionMarginWidth += 0') cmds.setParent(topForm) - cmds.frameLayout(label=kFileOptionsStr, collapsable=False) + cmds.frameLayout(label=kRelativePathOptionsStr, collapsable=False) widgetColumn = cmds.columnLayout() cmds.checkBox(cls.kMakePathRelativeCheckBox, label=kMakePathRelativeStr, ann=kMakePathRelativeAnnStr) cmds.checkBox(cls.kMakePathRelativeCheckBox, edit=True, changeCommand=cls.onMakePathRelativeChanged) cmds.textFieldGrp(cls.kUnresolvedPathTextField, label=kUnresolvedPathStr, ann=kUnresolvedPathAnnStr, editable=False) - cmds.textFieldGrp(cls.kResolvedPathTextField, label=kResolvedPathStr, ann=kResolvedPathAnnStr , editable=False) cls._haveRelativePathFields = True return topForm @@ -142,7 +139,6 @@ def uiInit(cls, parentLayout, canBeRelative, relativeToWhat): showPreviewFields = cmds.file(q=True, exists=True) cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, visible=showPreviewFields) - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, visible=showPreviewFields) # Only enable fields when make relative is checked. makePathRelative = cmds.checkBox(cls.kMakePathRelativeCheckBox, query=True, value=True) @@ -220,7 +216,6 @@ def onMakePathRelativeChanged(cls, checked): return enableFields = cls._canBeRelative and checked cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, enable=enableFields, text='') - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, enable=enableFields, text='') if enableFields: cls.updateFilePathPreviewFields(checked) @@ -261,7 +256,6 @@ def updateFilePathPreviewFields(cls, makePathRelative=None): elif unresolvedPath: relativePath = mayaUsdLib.Util.getPathRelativeToMayaSceneFile(unresolvedPath) cmds.textFieldGrp(cls.kUnresolvedPathTextField, edit=True, text=relativePath) - cmds.textFieldGrp(cls.kResolvedPathTextField, edit=True, text=unresolvedPath) @classmethod def selectionChanged(cls, parentLayout, selection): From 5e06635ed3d81915f5ee5eb37baa25fdf49a033f Mon Sep 17 00:00:00 2001 From: Aram Azhari Date: Wed, 5 Jul 2023 11:36:34 -0400 Subject: [PATCH 2/2] Removed an unused variable --- plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py index 627aadab33..f5b3d72bed 100644 --- a/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py +++ b/plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py @@ -36,7 +36,6 @@ class usdFileRelative(object): kMakePathRelativeCheckBox = 'MakePathRelativeTo' kUnresolvedPathTextField = 'UnresolvedPath' - kResolvedPathTextField = 'ResolvedPath' # We will store whether or not the file can be made relative. Used to know when we need # to update fields.