Fix inherited nested scenes not updating #107913
Draft
+40
−3
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 and related issues (#85562 (comment))
However it's broken XD
The bug is twofold. First is that when checking for scene changes, EditorData only checked one level of inheritance. This was trivial to fix and required just 2 lines of change.
The fun begins here:
godot/editor/editor_data.cpp
Line 680 in 88b9932
ss->get_modified_time()
may return either old time or new time.It returns old time from a copy of old SceneState in node.
However higher levels of inheritance keep their SceneState in a PackedScene, which sits in ResourceCache. This means that when base scene is updated, its SceneState gets replaced. At the time
_find_updated_instances()
is called, the base scene has the new state, so modified time is the same.The solution I came up with is discarding base scene path. I just go through the whole inheritance chain and replace SceneState's PackedScene with one that isn't cached, so it doesn't get updated too early. This does work, but in a rather chaotic way. The 2-level inherited scene does refresh properly, but only once. Then you have to reload manually as usual, however the reload may fail or may restore some old state (??). idk what to do about it.
Another related, but probably separate bug, is that root node properties don't get updated to new default values. The method for obtaining default value probably uses wrong state or something.