Improve initializations order, especially with regards to type registration, physics, and navigation. #106875
+166
−128
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.
I've used the warnings introduced in #106873 to sanitize initialization order a bit, reducing the number of warnings by a few tens.
This may fix some subtle bugs, but may also introduce regressions if I've changed anything incorrectly. Hopefully though, it should be better overall than before.
This should be the hardest part of fixing the warnings introduced by #106873. Most of the rest should be switching to
GDSOFTCLASS
, or addingGDREGISTER_CLASS
calls in the appropriate spots.Tagging @smix8 and @mihe for navigation and physics changes, respectively.
Changes
register_core_types
registers important types first (Object
,RefCounted
, etc.)register_server_types
is called before creating server singletons.register_scene_types
is called before creating scene singletons.GDScript
editor types are registered and handled duringEDITOR
initialization instead ofSERVERS
, as this is where it's expected.SCENE
instead ofCORE
, as this is where it's expected.GDSOFTCLASS
as they're not meant to be exposed. This should be followed up with similar changes for other platforms.register_scene_types
andregister_server_types
are rearranged for expected order.