Fix sub-inherited scene proper node update #73717
Open
+76
−2
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.
Fixes #7984 sub-inherited scenes aren't updating properly because of two reasons:
The problem appears to be that somehow after saving a parent scene, the inherited state is still has old version of the parent scene which allows inherited scenes to check for changes. However, this is not the case for some reason with the ancestor scene states.
So during check_and_update_scene(), the edited scene root is packed so user changes are kept, but the editor doesn't know which nodes that are there were 'original' and which were inherited from an ancestor scene, so it just keeps all the nodes.
For it to detect changes and update properly, the packed scene needs to know which nodes are inherited. This fix adds to edited scenes a set of node paths that only needs to be updated right before an ancestor scene is saved so it knows which nodes are inherited. The set is cleared after each reload of the sub-inherited scene to signal that it's up to date.
(I suspect there is a way to make the base scene states update properly which solves the problem but haven't had time to look at it)