Skip to content

Commit

Permalink
EMSUSD-249 Refactors relative path dialog options to be more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
AramAzhari-adsk committed Jul 4, 2023
1 parent 0eb0a3a commit c19150f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
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")
10 changes: 2 additions & 8 deletions plugin/adsk/scripts/mayaUsd_USDRootFileRelative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit c19150f

Please sign in to comment.