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-749 fix how stages are updated when saved #3432

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

The interaction between how the stage were initially open or created and how they were updated did not match. This caused the code that attempted to update the stage cache when saving anonymous layers to fail to achieve its goal. This led to the proxy shape next compute to fail to find the original session layer. This caused the information about edited-as-Maya prim to be lost. This resulted in the stage being in a weird state where a Maya reference prim was edited but the stage had forgotten about it.

Fix the code so that the way the stage os open in the proxy shape and in the function that update the stage cache match.

  • Changed how the proxy shape open the USD stage by always initially not loading payloads.
  • Also, do not pass an explicit resolver as it would affect which stage could be found in the cache.
  • Document in the helper function that updates stage after saving anonymous layer to open the stages the same way.

We also needed to fix the layer manager UI update after save.

The previous code worked by happenstance of the order of indirect operations. In particular, it only worked if the proxy shape was recomputed at just the right time. Recomputing the proxy shape emitted a notice that refreshed the layer manager. For complex reasons, when there is an edited Maya reference, the order changes, which prevented the layer manager UI from updating with the latest data.

To avoid this reliance on the exact timing of when the proxy shape might get recomputed, an explicit call to refresh the underlying model of the layer manager is done when saving. Unfortunately, due to the complicated design of the layer manager, the underlying tree model and where the data is kept, multiple classes had to be modified to provide a path from the save code the the data model.

  • Add functions on the MayaSessionState to refresh the current displayed stage layers.
  • (The MayaSessionState is where the layer manager UI keeps its list of loaded USD stages... it really ough to be called LoadedStages instead... MayaSessionState is a combination of three meaningless words.)
  • Add a updateLayerModel() abstract function to the AbstractLayerEditorWindow interface.
  • Implement updateLayerModel() in MayaLayerEditorWindow by calling the refreshStageEntry() on the MayaSessionStage.
  • Add a updateLayerManagers(0 helper function to the LayerDatabase used by the LayerManager (that is, the data holder, not the UI), to refresh all layer manager UI.
  • Call it at the end of LayerDatabase::saveUsd(), which is where layers get saved.

The interaction between how the stage were initially open or created and how
they were updated did not match. This caused the code that attempted to update
the stage cache when saving anonymous layers to fail to achieve its goal. This
led to the proxy shape next compute to fail to find the original session layer.
This caused the information about edited-as-Maya prim to be lost. This resulted
in the stage being in a weird state where a Maya reference prim was edited but
the stage had forgotten about it.

Fix the code so that the way the stage os open in the proxy shape and in the
function that update the stage cache match.

- Changed how the proxy shape open the USD stage by always initially not loading payloads.
- Also, do not pass an explicit resolver as it would affect which stage could be found in the cache.
- Document in the helper function that updates stage after saving anonymous layer to open the stages the same way.

We also needed to fix the layer manager UI update after save.

The previous code worked by happenstance of the order of indirect operations.
In particular, it only worked if the proxy shape was recomputed at just the
right time. Recomputing the proxy shape emitted a notice that refreshed the
layer manager. For complex reasons, when there is an edited Maya reference, the
order changes, which prevented the layer manager UI from updating with the
latest data.

To avoid this reliance on the exact timing of when the proxy shape might get
recomputed, an explicit call to refresh the underlying model of the layer
manager is done when saving. Unfortunately, due to the complicated design of
the layer manager, the underlying tree model and where the data is kept,
multiple classes had to be modified to provide a path from the save code the
the data model.

- Add functions on the MayaSessionState to refresh the current displayed stage layers.
- (The MayaSessionState is where the layer manager UI keeps its list of loaded USD stages... it really ough to be called LoadedStages instead... MayaSessionState is a combination of three meaningless words.)
- Add a updateLayerModel() abstract function to the AbstractLayerEditorWindow interface.
- Implement updateLayerModel() in MayaLayerEditorWindow by calling the refreshStageEntry() on the MayaSessionStage.
- Add a updateLayerManagers(0 helper function to the LayerDatabase used by the LayerManager (that is, the data holder, not the UI), to refresh all layer manager UI.
- Call it at the end of LayerDatabase::saveUsd(), which is where layers get saved.
AramAzhari-adsk
AramAzhari-adsk previously approved these changes Nov 2, 2023
Copy link
Collaborator

@AramAzhari-adsk AramAzhari-adsk left a comment

Choose a reason for hiding this comment

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

Just some minor comment updates but looks good to me.

lib/mayaUsd/nodes/proxyShapeBase.cpp Outdated Show resolved Hide resolved
lib/mayaUsd/utils/utilSerialization.cpp Outdated Show resolved Hide resolved
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Nov 3, 2023
@seando-adsk seando-adsk added core Related to core library and removed adsk Related to Autodesk plugin labels Nov 3, 2023
@seando-adsk seando-adsk merged commit fd9ab59 into dev Nov 3, 2023
11 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-749/lost-edit-as-maya branch November 3, 2023 16:44
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.

5 participants