GDScript: Only move root scripts in cache #114655
Open
+3
−1
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 somewhat #105485
When an inner class gets to the resource saver for packed scenes it will look like a builtin resource and the resource loader will assign it a builtin id. Previously this would move the main scripts entry in the gdscript cache to this builtin path which makes the cache inconsistent and a second script could be created for the original path, leading to the duplicated script.
This PR prevents the inconsistent cache. It does not intervene when a resource safer tries to safe the inner class. So this might still cause less visible issues. But due to the strange status of builtin classes I'm not really sure how this should be handled since inner classes are just not serializable at all right now. So let's go with the ostrich algorithm for now!