diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/main/main.cpp b/main/main.cpp index 9b2b9d4c49..5216f2abf2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -63,6 +63,7 @@ #include "scene/main/window.h" #include "scene/register_scene_types.h" #include "scene/resources/packed_scene.h" +#include "scene/theme/theme_db.h" #include "servers/audio_server.h" #include "servers/camera_server.h" #include "servers/display_server.h" @@ -129,6 +130,7 @@ static PhysicsServer3D *physics_server_3d = nullptr; static PhysicsServer2D *physics_server_2d = nullptr; static NavigationServer3D *navigation_server_3d = nullptr; static NavigationServer2D *navigation_server_2d = nullptr; +static ThemeDB *theme_db = nullptr; // We error out if setup2() doesn't turn this true static bool _start_success = false; @@ -275,6 +277,16 @@ void finalize_navigation_server() { navigation_server_2d = nullptr; } +void initialize_theme_db() { + theme_db = memnew(ThemeDB); + theme_db->initialize_theme(); +} + +void finalize_theme_db() { + memdelete(theme_db); + theme_db = nullptr; +} + //#define DEBUG_INIT #ifdef DEBUG_INIT #define MAIN_PRINT(m_txt) print_line(m_txt) @@ -477,7 +489,8 @@ Error Main::test_setup() { register_platform_apis(); // Theme needs modules to be initialized so that sub-resources can be loaded. - initialize_theme(); + initialize_theme_db(); + register_scene_singletons(); ERR_FAIL_COND_V(TextServerManager::get_singleton()->get_interface_count() == 0, ERR_CANT_CREATE); @@ -528,6 +541,8 @@ void Main::test_cleanup() { unregister_driver_types(); unregister_scene_types(); + finalize_theme_db(); + NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS); unregister_server_types(); @@ -1927,7 +1942,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: Setup Logo"); -#if defined(JAVASCRIPT_ENABLED) || defined(ANDROID_ENABLED) +#if defined(WEB_ENABLED) || defined(ANDROID_ENABLED) bool show_logo = false; #else bool show_logo = true; @@ -2150,7 +2165,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) { register_platform_apis(); // Theme needs modules to be initialized so that sub-resources can be loaded. - initialize_theme(); + initialize_theme_db(); + register_scene_singletons(); GLOBAL_DEF_BASIC("display/mouse_cursor/custom_image", String()); GLOBAL_DEF_BASIC("display/mouse_cursor/custom_image_hotspot", Vector2()); @@ -3144,6 +3160,8 @@ void Main::cleanup(bool p_force) { unregister_driver_types(); unregister_scene_types(); + finalize_theme_db(); + NativeExtensionManager::get_singleton()->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS); unregister_server_types(); |