Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added INITIALIZATION_LEVEL_READY for extension setup. #60317

Closed
wants to merge 1 commit into from

Conversation

kidrigger
Copy link
Contributor

Adding initialization level after the end of setup and deinitialization
before the start of cleanup so extensions can ensure servers singletons
have finished setting up before any extensions requires them.

@timothyqiu
Copy link
Member

Does this resolve #60238?

@Faless
Copy link
Collaborator

Faless commented Apr 17, 2022

As mentioned in chat, this would re-introduce the bug in exported (non-editor) builds (bug fixed in #58629).
IMO all the init and registration should happen before editor (i.e. editor is supposed to be last, since it's basically a godot project itself).
This means re-organizing the main.cpp registration order, e.g. (for modules, probably need more work to move more stuff like the server singletons):

diff --git a/main/main.cpp b/main/main.cpp
index f20ec94fa558..3b65d91ccfc3 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1930,6 +1930,14 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
 
 	register_driver_types();
 
+	MAIN_PRINT("Main: Load Platform APIs");
+
+	register_platform_apis();
+
+	MAIN_PRINT("Main: Load Modules");
+
+	register_module_types();
+
 #ifdef TOOLS_ENABLED
 	ClassDB::set_current_api(ClassDB::API_EDITOR);
 	EditorNode::register_editor_types();
@@ -1937,12 +1945,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
 	ClassDB::set_current_api(ClassDB::API_CORE);
 
 #endif
-
-	MAIN_PRINT("Main: Load Modules");
-
-	register_platform_apis();
-	register_module_types();
-
 	// Theme needs modules to be initialized so that sub-resources can be loaded.
 	initialize_theme();

Some extensions need singleton servers to be initialized before some
setup. This adds a callback right before editor in order to ensure this.
@kidrigger
Copy link
Contributor Author

@Faless

@akien-mga
Copy link
Member

Superseded by #60723.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants