-
Notifications
You must be signed in to change notification settings - Fork 201
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-248 fix lost notification listeners #3202
Merged
seando-adsk
merged 5 commits into
dev
from
bailp/EMSUSD-248/lost-notification-listeners
Jul 12, 2023
Merged
EMSUSD-248 fix lost notification listeners #3202
seando-adsk
merged 5 commits into
dev
from
bailp/EMSUSD-248/lost-notification-listeners
Jul 12, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The order of operations when loading a Maya scene depends on the relative order of unrelated events. Some things are triggered by Maya callbacks, some are done when a stage is set on a proxy node, which gets set when the proxy node is computed, which depends on when it gets dirtied and when something accesses it. Furthermore, some other things are done in the on-idle callback of maya, which depends on when Qt events are processed. On top of all this, some things are triggered by timers. For example: - notification listeners are cleared in Maya callbacks. - notification listeners are registered when the proxy node is computed - The layer manager initialize itself with a timer. - The layer manager is cleared by a Qt signal being emitted, which itself is triggered by a Maya callback. - The Maya session state stage is reset in an on-idle callback. The problem in our case is that the notification listeners were getting wiped out because they were cleared in a Maya after-new / after-open callback, but now that is getting called after the proxy shape has been computed, which is where the notification listeners for the new stage were registered. IOW, they new listeners were cleared by a function that was meant to clear the old listeners. The fix is to clear the listerener in a before-new / before-open callback instead. - Rename beforeNewCallback() to isInNewScene(). - Rename beforeNewCallback(bool) to setInNewScene(bool) _ Those were confusing because they had the same name as the real Maya callback, but with different parameters. - Move the code that cleared listeners from afterOpen to beforeOpen. - Added setupListener() and clearListener() to make the code clearer. - Fixed abug that left the in-new-scene flag to true when opening a Maya scene.
Reduce the timer to 0s so that it triggers at a predictable time during load.
Only the known flaky testVP2RenderDelegateDisplayLayers test failed. |
pierrebai-adsk
added
the
ready-for-merge
Development process is finished, PR is ready for merge
label
Jul 10, 2023
AramAzhari-adsk
approved these changes
Jul 10, 2023
seando-adsk
added
do-not-merge-yet
Development is not finished, PR not ready for merge
and removed
ready-for-merge
Development process is finished, PR is ready for merge
labels
Jul 11, 2023
pierrebai-adsk
removed
the
do-not-merge-yet
Development is not finished, PR not ready for merge
label
Jul 11, 2023
pierrebai-adsk
added
the
ready-for-merge
Development process is finished, PR is ready for merge
label
Jul 11, 2023
seando-adsk
approved these changes
Jul 12, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed description and investigation of the problem/solution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
adsk
Related to Autodesk plugin
bug
Something isn't working
ready-for-merge
Development process is finished, PR is ready for merge
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The order of operations when loading a Maya scene depends on the relative order of unrelated events. Some things are triggered by Maya callbacks, some are done when a stage is set on a proxy node, which gets set when the proxy node is computed, which depends on when it gets dirtied and when something accesses it. Furthermore, some other things are done in the on-idle callback of Maya, which depends on when Qt events are processed. On top of all this, some things are triggered by timers.
For example:
The problem in our case is that the notification listeners were getting wiped out because they were cleared in a Maya after-new / after-open callback, but now that is getting called after the proxy shape has been computed, which is where the notification listeners for the new stage were registered.
IOW, the new listeners were cleared by a function that was meant to clear the old listeners. The fix is to clear the listeners in a before-new / before-open callback instead.