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-277 fix lost muted anonymous layers #3320

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

  • Add a global functionality to hold onto muted layers.
  • This is to work around the fact that OpenUSD will not keep muted layers in memory.
  • Make sure to clean up the list of muted layers when a new Maya scene is created.
  • Use the muted layer holder in the MuteLayer command.
  • The base class of the command was trying to hold onto layer, but when the undo stack is cleared, so would be the anonymous layers.
  • In particular, when unloading a Maya Reference, Maya always clears the undo stack.
  • Add a test that check if muted anonymous layers are lost when editing a Maya Reference.
  • The test fails without my fix, works with it.
  • Improved test helper functions to enable creating anonymous sub-layers.

@pierrebai-adsk pierrebai-adsk added adsk Related to Autodesk plugin bug Something isn't working labels Sep 8, 2023
- Add a global functionality to hold onto muted layers.
- This is to work around the fact that OpenUSD will not keep muted layers in memory.
- Make sure to clean up the list of muted layers when a new Maya scene is created.
- Use the muted layer holder in the MuteLayer command.
- The base class of the command was trying to hold onto layer, but when the undo stack is cleared, so would be the anonymous layers.
- In particular, when unloading a Maya Reference, Maya always clears the undo stack.
- Add a test that check if muted anonymous layers are lost when editing a Maya Reference.
- The test fails without my fix, works with it.
- Improved test helper functions to enable creating anonymous sub-layers.
@@ -620,7 +621,7 @@ class MuteLayer : public BaseCmd
// we perfer not holding to pointers needlessly, but we need to hold on to the layer if we
// mute it otherwise usd will let go of it and its modifications, and any dirty children
// will also be lost
Copy link
Collaborator

@samuelliu-adsk samuelliu-adsk Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we need this comment anymore, so does L643

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the comment says exactly why we are calling addMutedLayer, so I'll keep the comment.

// we can release the pointer
_mutedLayer = nullptr;
removeMutedLayer(layer);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question here: In AddMutedLayer, we recursively added all dirty sublayers to the mutedLayer list, so when remvoeMutedLayer should we do the same? For now it just removes one layer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I will look into it.

Also, improve comments explaining why we add and remove muted layers.
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Sep 13, 2023
@seando-adsk seando-adsk added core Related to core library and removed adsk Related to Autodesk plugin labels Sep 13, 2023
@seando-adsk seando-adsk merged commit f2d8fa4 into dev Sep 13, 2023
2 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-277/losing-muted-anon-layers branch September 13, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Related to core library ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants