options to retrieve selected layer name in the mayaUsdLayerEditor ? #3682
Unanswered
voidreamer
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @voidreamer If I'm understanding the question correctly you are asking to get the stages current EditTarget. To get the selected layer and its identifier you could run something like this in a python tab on the Maya script editor. import mayaUsd
from pxr import Sdf
maya_stage_node_list = cmds.ls(type='mayaUsdProxyShape', long=True)
stage = mayaUsd.ufe.getStage(maya_stage_node_list[0])
# Get the current edit target
edit_target_layer = stage.GetEditTarget().GetLayer()
print(edit_target_layer.identifier)
# Switch to a different edit target
new_layer = Sdf.Layer.FindOrOpen('/PATH/TO/LAYER.usd')
stage.SetEditTarget(new_layer) Hope that answers the question. Cheers, Jason Coelho |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, I'm looking for a way to retrieve the current selected layer name (identifier) in the mayaUsdLayerEditor, I didn't see a flag for it in the
cmds.mayaUsdLayerEditorWindow
command, also the same to change layer selection by passing a layer identifier.thanks!
Beta Was this translation helpful? Give feedback.
All reactions