diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-29 14:02:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 14:02:21 +0200 |
commit | e60086f98b07365d6174677df84c9a22bfb56d15 (patch) | |
tree | b1ff19a2fda6a735d883340a389d85e03c6febf5 /main | |
parent | 0024ba8daddbc7d49458d438ccf578242d900e57 (diff) | |
parent | 6320a0fc18fa84363494df9013b65011a3018a62 (diff) |
Merge pull request #64119 from YuriSizov/theme-init-database
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp index 0089faf129..7964ba8e3e 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; @@ -273,6 +275,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) @@ -475,7 +487,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); @@ -526,6 +539,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(); @@ -2126,7 +2141,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()); @@ -3120,6 +3136,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(); |