diff options
author | Gilles Roudière <gilles.roudiere@gmail.com> | 2022-02-28 14:50:43 +0100 |
---|---|---|
committer | Gilles Roudière <gilles.roudiere@gmail.com> | 2022-02-28 16:03:26 +0100 |
commit | ce512b35c19a4e4c482c63374c22b7dee026d2d9 (patch) | |
tree | bebe7679b58cee6c7e2f7d56f73302a6cc8b53a0 | |
parent | 345b4bb86ae9b3e5d3cee6078a7e452b7c933200 (diff) |
Reorder native extension types initialization, initializing editor last
-rw-r--r-- | core/extension/gdnative_interface.h | 2 | ||||
-rw-r--r-- | core/extension/native_extension.cpp | 1 | ||||
-rw-r--r-- | core/extension/native_extension.h | 2 | ||||
-rw-r--r-- | doc/classes/NativeExtension.xml | 4 | ||||
-rw-r--r-- | main/main.cpp | 15 |
5 files changed, 14 insertions, 10 deletions
diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h index a2e0c7cc73..62934d1d73 100644 --- a/core/extension/gdnative_interface.h +++ b/core/extension/gdnative_interface.h @@ -460,8 +460,8 @@ typedef enum { GDNATIVE_INITIALIZATION_CORE, GDNATIVE_INITIALIZATION_SERVERS, GDNATIVE_INITIALIZATION_SCENE, - GDNATIVE_INITIALIZATION_EDITOR, GDNATIVE_INITIALIZATION_DRIVER, + GDNATIVE_INITIALIZATION_EDITOR, GDNATIVE_MAX_INITIALIZATION_LEVEL, } GDNativeInitializationLevel; diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp index e1db99fe5d..325ccec6c4 100644 --- a/core/extension/native_extension.cpp +++ b/core/extension/native_extension.cpp @@ -325,6 +325,7 @@ void NativeExtension::_bind_methods() { BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_CORE); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SERVERS); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_SCENE); + BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_DRIVER); BIND_ENUM_CONSTANT(INITIALIZATION_LEVEL_EDITOR); } diff --git a/core/extension/native_extension.h b/core/extension/native_extension.h index b98e4925d2..ebfedfb29a 100644 --- a/core/extension/native_extension.h +++ b/core/extension/native_extension.h @@ -71,8 +71,8 @@ public: INITIALIZATION_LEVEL_CORE, INITIALIZATION_LEVEL_SERVERS, INITIALIZATION_LEVEL_SCENE, - INITIALIZATION_LEVEL_EDITOR, INITIALIZATION_LEVEL_DRIVER, + INITIALIZATION_LEVEL_EDITOR, }; bool is_library_open() const; diff --git a/doc/classes/NativeExtension.xml b/doc/classes/NativeExtension.xml index e5e11c1c95..ccdbb617ab 100644 --- a/doc/classes/NativeExtension.xml +++ b/doc/classes/NativeExtension.xml @@ -43,7 +43,9 @@ </constant> <constant name="INITIALIZATION_LEVEL_SCENE" value="2" enum="InitializationLevel"> </constant> - <constant name="INITIALIZATION_LEVEL_EDITOR" value="3" enum="InitializationLevel"> + <constant name="INITIALIZATION_LEVEL_DRIVER" value="3" enum="InitializationLevel"> + </constant> + <constant name="INITIALIZATION_LEVEL_EDITOR" value="4" enum="InitializationLevel"> </constant> </constants> </class> diff --git a/main/main.cpp b/main/main.cpp index 246a26025c..da79020bac 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -425,6 +425,7 @@ Error Main::test_setup() { ResourceLoader::load_path_remaps(); register_scene_types(); + register_driver_types(); #ifdef TOOLS_ENABLED ClassDB::set_current_api(ClassDB::API_EDITOR); @@ -435,7 +436,6 @@ Error Main::test_setup() { register_platform_apis(); register_module_types(); - register_driver_types(); // Theme needs modules to be initialized so that sub-resources can be loaded. initialize_theme(); @@ -458,13 +458,13 @@ void Main::test_cleanup() { ResourceLoader::remove_custom_loaders(); ResourceSaver::remove_custom_savers(); - unregister_driver_types(); #ifdef TOOLS_ENABLED EditorNode::unregister_editor_types(); #endif unregister_module_types(); unregister_platform_apis(); + unregister_driver_types(); unregister_scene_types(); unregister_server_types(); @@ -1890,6 +1890,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) { register_scene_types(); + MAIN_PRINT("Main: Load Driver Types"); + + register_driver_types(); + #ifdef TOOLS_ENABLED ClassDB::set_current_api(ClassDB::API_EDITOR); EditorNode::register_editor_types(); @@ -1925,14 +1929,12 @@ Error Main::setup2(Thread::ID p_main_tid_override) { camera_server = CameraServer::create(); - MAIN_PRINT("Main: Load Physics, Drivers, Scripts"); + MAIN_PRINT("Main: Load Physics"); initialize_physics(); initialize_navigation_server(); register_server_singletons(); - register_driver_types(); - // This loads global classes, so it must happen before custom loaders and savers are registered ScriptServer::init_languages(); @@ -2816,8 +2818,6 @@ void Main::cleanup(bool p_force) { xr_server->set_primary_interface(Ref<XRInterface>()); } - unregister_driver_types(); - #ifdef TOOLS_ENABLED EditorNode::unregister_editor_types(); #endif @@ -2826,6 +2826,7 @@ void Main::cleanup(bool p_force) { unregister_module_types(); unregister_platform_apis(); + unregister_driver_types(); unregister_scene_types(); unregister_server_types(); |