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-249 Refactors relative path dialog options to be more clear #3195

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
5 changes: 2 additions & 3 deletions plugin/adsk/scripts/mayaUSDRegisterStrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
11 changes: 2 additions & 9 deletions plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -79,23 +78,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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think line 39 should also be removed (where this string is set).

cls._haveRelativePathFields = True

return topForm
Expand Down Expand Up @@ -142,7 +138,6 @@ def uiInit(cls, parentLayout, canBeRelative, relativeToWhat):
showPreviewFields = cmds.file(q=True, exists=True)
Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk Jul 5, 2023

Choose a reason for hiding this comment

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

I think the two-lines conditional above can be removed, and the showPreviewFields variable above it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wouldn't we still want to show the unresolved field? (Now called Path Preview)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh sorry, the variable is also usedfor the other field, NVM, I thought it was only for the resolved path.


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)
Expand Down Expand Up @@ -220,7 +215,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)

Expand Down Expand Up @@ -261,7 +255,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):
Expand Down