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

MAYA-122927 interaction between deactivation and cancel edit #2794

Merged
merged 4 commits into from
Jan 13, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

When a Maya reference is edited, its USD prim is deactivated to hide it in the outliner. If its parent prim is then deactivated, the edit is orphaned. At that point the Maya Ref prim and its parent are both deactivated. If the edit is cancelled while the parent is deactivated, the code could not activate the Maya Ref USD prim because children of deactivated prims cannot be modified. We needed to fix this.

The fix is to add code to temporarily reactivate ancestors prims when trying to activate a prim. The design actually provides a class to temporarily activate all ancestors of a prim, for any possible edits.

  • Add PrimActivation class to temporarily make a prim accessible even when its ancestors are deactivated.
  • It works by activating all inactive ancestors by authoring opinions in the session layer.
  • Use this class in the addExcludedFromRendering and removeExcludedFromRendering functions.
  • Add a flag in the orphaned nodes manager to avoid responding to notifications caused by its own responses to notifications.
  • This avoids infinite recursion when the work done to orphan an edited node caused notifications to be sent.
  • In our case, the temporary reactivation of prims would cause an infinite flip-flop or orphaning and de-orphaning.

A unit test already checked the case where an edited prim was under a dectivated prim, but had not checked for the proper result due to the known bug. Simply fix the test for the fix.

Also, fix that the auto-edit flag was not being properly updated due to the same ancestor-is-deactivated problem.

When a Maya reference is edited, its USD prim is deactivated to hide it in the outliner. If its parent prim is then deactivated, the edit is orphaned. At that point the Maya Ref prim and its parent are both deactivated. If the edit is canceled while the parent is deactivated, the code could not activate the Maya Ref USD prim because children of deactivated prims cannot be modified. We needed to fix this.

The fix is to add code to temporarily reactivate ancestors prims when trying to activate a prim. The design actuslly provides a class to temporarily activate all ancestors of a prim, for any possible edits.

- Add PrimActivation class to temporarily make a prim accessible even when its ancestors are deactivated.
- It works by activating all inactive ancestors by authoring opinions in the session layer.
- Use this class in the addExcludedFromRendering and removeExcludedFromRendering functions.
- Add a flag in the orphaned nodes manager to avoid responding to notifications caused by its own responses to notifications.
- This avoids infinite recursion when the work done to orphan an edited node caused notifications to be sent.
- In our case, the temporary reactivation of prims would cause an infinite flip-flop or orphaning and de-orphaning.

A unit test already checked the case where an edited prim was under a dectivated prim, but had not checked for the proper result due to the known bug. Simply fix the test for the fix.

Also, fix that the auto-edit flag was not being properly updated due to the same ancestor-is-deactivated problem.
@pierrebai-adsk pierrebai-adsk added bug Something isn't working adsk Related to Autodesk plugin labels Dec 20, 2022
@pierrebai-adsk pierrebai-adsk changed the title MAYA-122917 interaction between deactivation and cancel edit MAYA-122927 interaction between deactivation and cancel edit Dec 22, 2022
Copy link
Collaborator

@vlasovi vlasovi left a comment

Choose a reason for hiding this comment

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

Looks good

@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 11, 2023
@seando-adsk seando-adsk added core Related to core library and removed adsk Related to Autodesk plugin labels Jan 13, 2023
@seando-adsk seando-adsk merged commit 68b023a into dev Jan 13, 2023
@seando-adsk seando-adsk deleted the bailp/MAYA-122927/better-prim-activation branch January 13, 2023 16:18
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