Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EMSUSD-1251] MayaUsdProxy node not refreshing properly #2465

Open
neilrubie opened this issue Jul 7, 2022 · 8 comments
Open

[EMSUSD-1251] MayaUsdProxy node not refreshing properly #2465

neilrubie opened this issue Jul 7, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@neilrubie
Copy link

Describe the bug
I am attempting to load a usd stage inside a MayaUsdProxy node using python code, however the stage doesn't appear to load under certain circumstances. Specifically when the anonymous session/root layer has unsaved edits, and you perform a save operation directly prior to setting the proxy filePath attribute.

Steps to reproduce

  1. Create an empty MayaUsdProxy node in the scene root (Create->USD->Stage with New Layer)
  2. Expand the proxy to its shape and add an xform (right-click on stageShape1->Add New Prim->Xform
  3. Run this code all in one execution. (saves the file out then sets the proxy filepath to a predefined usd file, which I've attached)
cmds.file(
    "/tmp/save_test.ma",
    type="mayaAscii",
    force=True,
    exportAll=True,
    preserveReferences=True,
    exportUnloadedReferences=True
)

cmds.setAttr("stageShape1.filePath", "/tmp/cube.usda", type="string")

After doing this, the proxy filepath attribute appears to be populated, but the usd file itself did not get loaded. The proxy's root layer is still pointing to an anonymous layer:
image

Expected behavior
I expect that any existing root layer (anonymous or not) gets cleared out and replaced by the layer specified by the filepath.

Attachments
cube.zip

Specs (if applicable):

  • CentOS 7.9
  • Maya version 2022.3
  • Maya USD commit: 0.18
  • Pixar USD commit: 21.08

Additional context
Things seem to work fine when I omit the save operation in the code. And they work fine when I execute the code separately and sequentially. And it works fine if there are no edits on the anonymous session or root layer. It just so happens that I need it to work under this perfect storm of a scenario..

@neilrubie neilrubie added the bug Something isn't working label Jul 7, 2022
@santosg87 santosg87 changed the title MayaUsdProxy node not refreshing properly [MAYA-125057] MayaUsdProxy node not refreshing properly Aug 29, 2022
@santosg87 santosg87 added the reproduced Issue has been reproduced label Aug 29, 2022
@santosg87
Copy link
Collaborator

santosg87 commented Aug 29, 2022

I was able to reproduce this on our side as well. it seems to only happen when the user saves all edits to the Maya scene, which is likely causing the "stuck" state of the layers. I logged this internally so we can investigate further and discuss next steps. the internal ticket ID is MAYA-125057

@santosg87
Copy link
Collaborator

santosg87 commented Mar 30, 2023

@neilrubie I was not able to reproduce this issue anymore on the latest build of mayausd and Maya.

I am closing this as "cannot reproduce" for the time being, feel free to re-open if you can still reproduce this or if you have any more information.

cheers!

@santosg87 santosg87 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2023
@santosg87 santosg87 removed the reproduced Issue has been reproduced label Mar 30, 2023
@neilrubie
Copy link
Author

neilrubie commented Jun 14, 2023

I am still seeing the same issue with the latest build of mayausd (0.23) and Maya 2023.3. I am unable to save a maya file out and "refresh" the usd node in the same execution of code. Can you verify and reopen if possible?

@neilh-adsk neilh-adsk moved this to Done in maya-usd Nov 6, 2023
@DanGroverUK
Copy link

DanGroverUK commented Nov 29, 2023

This issue still occurs for me using Maya 2022, MayaUSD 0.26.0 on Windows 10.

However (and I'm not sure if you're still looking for a solution @neilrubie ) but I found that by adding these lines...

import AETemplateHelpers  # That assumes "MayaUSD3/plugin/asdk/scripts" is on your system path as per the default .mod file I believe
cmds.file(
    "/tmp/save_test.ma",
    type="mayaAscii",
    force=True,
    exportAll=True,
    preserveReferences=True,
    exportUnloadedReferences=True
)

cmds.setAttr("stageShape1.filePath", "/tmp/cube.usda", type="string")
AETemplateHelpers.ProxyShapeFilePathRefresh("stageShape1.filePath")

This has allowed me to re-path a stage successfully if - like in the above example - doing so is the last thing to happen in the code block. If you have more 'stuff' going on afterwards (and in my case I do, as this happens half way through a Shotgrid Publish), it still doesn't work unfortunately.

@neilrubie
Copy link
Author

Thanks @DanGroverUK, I did end up finding solution that seems to work for me. It's pretty hacky, and don't ask me why it works, but it seems to get around the bug. Directly after you do your file export, perform another dummy export before setting the filepath on your proxy node:

# Perform normal file export.
cmds.file(
    "/tmp/save_test.ma",
    type="mayaAscii",
    force=True,
    exportAll=True,
    preserveReferences=True,
    exportUnloadedReferences=True
)

# Perform dummy export (don't export anything with a proxy node)
cmds.select("time1")
cmds.file(
    "/usr/tmp",
    type="mayaAscii",
    exportSelectedStrict=True,
    force=True,
    preview=True,
)

# Now the proxy node should refresh properly (fingers crossed)
cmds.setAttr("stageShape1.filePath", "/tmp/cube.usda", type="string")

Give that a try.

@DanGroverUK
Copy link

I'm not entirely sure I want to know what you had to go through to find this out @neilrubie but I am very grateful!

@neilrubie
Copy link
Author

@DanGroverUK Haha a lot of trial and error and banging my head against the wall! Did it work for you as well? @santosg87 Can you reopen this ticket? I don't see any option to do so myself.

@DanGroverUK
Copy link

Yes it did - thank you very much! The Layer Manager's UI always seems to update correctly, and of course the proxy shape's filePath attribute was always updating immediately, but it seems like the 'Root Layer' identifier there requires clicking off and back on to refresh in the attribute editor. This seems to just be a UI thing, though, as the stage clearly has updated.

@santosg87 santosg87 reopened this Apr 30, 2024
@github-project-automation github-project-automation bot moved this from Done to Needs triage in maya-usd Apr 30, 2024
@santosg87 santosg87 changed the title [MAYA-125057] MayaUsdProxy node not refreshing properly [EMSUSD-1251] MayaUsdProxy node not refreshing properly Apr 30, 2024
@github-project-automation github-project-automation bot moved this to Needs triage in Issue Triage Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage
Status: Needs triage
Development

No branches or pull requests

3 participants