MayaUsdProxyShapeBase: invalidate stage on recomputeLayers attribute changes#4555
Open
jufrantz wants to merge 1 commit intoAutodesk:devfrom
Open
Conversation
recomputeLayersAttr affects outStageData but did not trigger stage invalidation. Treat it like the other stage-affecting attributes so that stage observers, such as MayaStagesSubject and the VP2RenderDelegate, do not keep stale state. Also make it non-storable, since it is only used as a runtime trigger.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is a targeted fix for one stale
UsdStageMapscenario seen in production withmaya-usd v0.35.0.The crash occurs in workflows like the following:
editAsMayaDAGs, with incomingProxyAccessorvisibility connections from the proxyShape.maya.cmds.exportEdits, which is unrelated to USD content itself.ProxyAccessorcompute path.The crash is caused by calling
MDagPath::isVisible()on an invalidMDagPath. That invalid path comes from a staleUsdStageMap, which does not yet reflect a new stage created after file I/O. In the scenario above, the export creates a newLayerManager, and the later reference reload triggers a proxyShape recompute by bumping therecomputeLayersattribute (see #4443 ).This change makes
recomputeLayersbehave like the other proxyShape attributes that affectoutStageData: it now sendsMayaUsdProxyStageInvalidateNoticeso that stage observers, such asMayaStagesSubject, can invalidate stage-related data likeUsdStageMap, and restores the usual notification flow for this code path: firstStageInvalidate, thenStageSet.I also included a small unrelated cleanup I came across while investigating this issue: making this attribute non-storable, since it is only used as a runtime trigger.
Note
While investigating this issue, we also tried cherry-picking #4491 which looked like a good candidate for the stale
UsdStageMapproblem. It effectively fixed the crash for us, but it also caused other issues on our side.In some scenarios, the map can become incomplete when it is dirtied during its own rebuild. The sequence is:
UsdStageMap::rebuildIfDirty()indirectly callsMayaUsdProxyShapeBase::getUsdStage()getUsdStage()pullsoutStageData, which can trigger a computeMayaUsdProxyShapeBase::computeOutStageData()sendsMayaUsdProxyStageSetNoticeMayaStagesSubjectindirectly callsUsdStageMap::setDirty()onMayaUsdProxyStageSetNotice(since PR4491)setDirty()clears the map in the middle ofrebuildIfDirty(), so previously processed entries are lost,UsdStageMapis incomplete.I cannot provide a standalone reproduction for this yet, it is difficult to isolate. However, I hope the proposed change is clear from the context above.