Chain multiple MayaUsdProxyShape nodes sharing Stage #1961
-
Hello, We are trying to implement a custom
But we are stuck by the So we wondered if it was good practice to chain two or more Thanks Christophe world_scene.usda #usda 1.0
(
defaultPrim = "mayaUsdProxy1"
endTimeCode = 96
framesPerSecond = 24
metersPerUnit = 0.01
startTimeCode = 1
timeCodesPerSecond = 24
upAxis = "Z"
)
def Xform "world"
{
} import maya.cmds as cmds
stage = "world_scene.usda"
layer = "Kitchen_set/assets/Chair/Chair.usd"
""" load plugins """
plugins = ["mayaUsdPlugin"]
for plugin in plugins:
if not cmds.pluginInfo(plugin, query=True, loaded=True):
cmds.loadPlugin(plugin)
""" MayaUsdProxyShape to load Stage """
proxy_shape = cmds.createNode("mayaUsdProxyShape", name="loadStageProxyShape")
cmds.setAttr(proxy_shape + ".filePath", stage, type="string")
proxy_transform = cmds.rename(cmds.listRelatives(proxy_shape, parent=True)[0], "loadStageProxy")
cmds.setAttr(proxy_shape + ".visibility", False)
cmds.setAttr(proxy_shape + ".lodVisibility", False)
cmds.setAttr(proxy_shape + ".hiddenInOutliner", True)
cmds.setAttr(proxy_transform + ".visibility", False)
cmds.setAttr(proxy_transform + ".lodVisibility", False)
cmds.setAttr(proxy_transform + ".hiddenInOutliner", True)
cmds.outlinerEditor(refresh=True)
""" MayaUsdProxyShape to display Stage """
display_shape = cmds.createNode("mayaUsdProxyShape", name="displayStageProxyShape")
cmds.connectAttr(proxy_shape + ".outStageData", display_shape + ".inStageData")
display_transform = cmds.rename(cmds.listRelatives(display_shape, parent=True)[0], "displayStageProxy")
""" Connect time information """
time = cmds.ls(typ="time")[0]
cmds.connectAttr(time + ".outTime", proxy_shape + ".time")
cmds.connectAttr(time + ".outTime", display_shape + ".time")
""" Add layer """
root_layer = "|" + proxy_transform + "|" + proxy_shape
cmds.mayaUsdEditTarget(root_layer,
edit=True,
editTarget=stage)
cmds.mayaUsdLayerEditor(stage,
edit=True,
insertSubPath=(0, layer)) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yes, you can absolutely chain proxy shapes, but you have to be careful to make sure the right shape receives changes. I see you did it above...just one FYI. You can use Additionally, you have to keep in mind that stage is shared across src and dst nodes...so whatever will be edited upstream, will as well be edited at the source. This gets pretty messy is you start branching to multiple dst nodes and create a graph of dependencies (instead of chain). We created an unshared composition mode (attr on the proxy shape) in which the proxy shape will put the incoming stage layer stack under a new root layer. Having a dedicated node isn't a bad idea either since the proxy shape has a few more features you don't care about. It's unclear to me if you really need to make it supported by LayerManager? Do you want to allow downstream to mutate the upstream state? Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hello, Thank you for sharing this advice. Custom load stage nodeAs for implementing a custom node which purpose would be to only load a stage and propagate it to the As far as I understand, if a Thanks again for your reply, Christophe |
Beta Was this translation helpful? Give feedback.
Yes, you can absolutely chain proxy shapes, but you have to be careful to make sure the right shape receives changes. I see you did it above...just one FYI. You can use
intermediateObject
attribute to prevent one proxy shape from drawing.Additionally, you have to keep in mind that stage is shared across src and dst nodes...so whatever will be edited upstream, will as well be edited at the source. This gets pretty messy is you start branching to multiple dst nodes and create a graph of dependencies (instead of chain). We created an unshared composition mode (attr on the proxy shape) in which the proxy shape will put the incoming stage layer stack under a new root layer.
Having a dedicated…