[EMSUSD-3042] Incorrect detection of incoming stage for proxy shape
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
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()](https://github.com/Autodesk/maya-usd/blob/386b4fd763b5190d0dba4ffe40ef36ccad740011/lib/mayaUsd/nodes/proxyShapeBase.cpp#L923) and [isStageIncoming()](https://github.com/Autodesk/maya-usd/blob/386b4fd763b5190d0dba4ffe40ef36ccad740011/lib/mayaUsd/nodes/proxyShapeBase.cpp#L1732):
```
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](https://github.com/Autodesk/maya-usd/blob/386b4fd763b5190d0dba4ffe40ef36ccad740011/test/lib/mayaUsd/nodes/testProxyShapeBase.py#L1123).
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:
1. Launch Maya, load any USD file in proxy shape
2. 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
```
3. Set proxy shape's edit target layer to be session layer
4. Make changes in session layer
5. Save Maya scene file with the option "Save all edits (including USD) to the Maya scene file"
6. 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 386b4fd763b5190d0dba4ffe40ef36ccad740011 on dev branch
- Pixar USD : official v24.03 / v25.08
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.