-
Notifications
You must be signed in to change notification settings - Fork 214
Description
Describe the bug
Hi,
Our studio has the workflow that would connect the mayaUsdProxyShape's out stage attribute to a custom shape node (custom plugin), and that caused the session layer content cannot be saved as expected.
We found that the root cause was from the code how to detect "incoming stage" in computeInStageDataCached() and isStageIncoming():
listConnections -t shape -shapes on example_proxy_shape
The command above returns both source and destination connections, in our case, the proxy shape does not have any incoming stage but indeed has custom shape node connected on destination, the proxy shape treats stage as "incoming stage" and ignores saving session layer.
Changing the command to be below works for our case:
istConnections -source on -destination off exampleProxyShape.inStageData
- Explicitly checks the source;
- Explicitly tests against .inStageData attribute.
I believe this might be better, it also matches the command in unit test here.
But since our studio does not have such "incoming stage" use case, I am not sure the change would break anything else.
Thanks!
Steps to reproduce
Steps to reproduce the behavior:
- Launch Maya, load any USD file in proxy shape
- Connect the proxy shape's outStageData attribute to other shape node, for example:
# Add custom attribute on the proxy shape for testing, or reuse any existing one
cmds.addAttr("exampleProxyShape", ln="testBoolAttr", at="bool")
# For demonstration purpose, create a cube for testing
cmds.CreatePolygonCube()
# Also add a custom attribute for testing, but it can be anything
cmds.addAttr("|pCube1|pCubeShape1", ln="testBoolAttr", at="bool")
# Now connect the proxy shape to the cube shape
cmds.connectAttr(f"exampleProxyShape.testBoolAttr", "pCubeShape1.testBoolAttr")
Query the connections at this point would return the cube:
listConnections -t shape -shapes on exampleProxyShape;
// Result: pCubeShape1
- Set proxy shape's edit target layer to be session layer
- Make changes in session layer
- Save Maya scene file with the option "Save all edits (including USD) to the Maya scene file"
- Reopen the saved Maya scene, previous changes on session layer would be gone.
Expected behavior
Expect to detect shared or incoming stage properly, and save session layer content as expected
Specs (if applicable):
- OS & version: Rocky Linux 9.4
- Compiler & version : gcc-11.4
- Maya version: Maya 2024.2
- Maya USD : official v0.31.0 / v0.33.0 / commit 386b4fd on dev branch
- Pixar USD : official v24.03 / v25.08