Make default/project theme wait for modules before initializing

(cherry picked from commit 33fb44223f)
This commit is contained in:
Yuri Sizov 2021-11-30 18:59:32 +03:00 committed by Rémi Verschelde
parent e463d3daca
commit fce6e13034
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 7 additions and 0 deletions

View File

@ -1462,6 +1462,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
register_platform_apis(); register_platform_apis();
register_module_types(); register_module_types();
// Theme needs modules to be initialized so that sub-resources can be loaded.
initialize_theme();
GLOBAL_DEF("display/mouse_cursor/custom_image", String()); GLOBAL_DEF("display/mouse_cursor/custom_image", String());
GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2()); GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2());
GLOBAL_DEF("display/mouse_cursor/tooltip_position_offset", Point2(10, 10)); GLOBAL_DEF("display/mouse_cursor/tooltip_position_offset", Point2(10, 10));

View File

@ -767,7 +767,9 @@ void register_scene_types() {
GLOBAL_DEF("layer_names/2d_physics/layer_" + itos(i + 1), ""); GLOBAL_DEF("layer_names/2d_physics/layer_" + itos(i + 1), "");
GLOBAL_DEF("layer_names/3d_physics/layer_" + itos(i + 1), ""); GLOBAL_DEF("layer_names/3d_physics/layer_" + itos(i + 1), "");
} }
}
void initialize_theme() {
bool default_theme_hidpi = GLOBAL_DEF("gui/theme/use_hidpi", false); bool default_theme_hidpi = GLOBAL_DEF("gui/theme/use_hidpi", false);
ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/use_hidpi", PropertyInfo(Variant::BOOL, "gui/theme/use_hidpi", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/use_hidpi", PropertyInfo(Variant::BOOL, "gui/theme/use_hidpi", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED));
String theme_path = GLOBAL_DEF_RST("gui/theme/custom", ""); String theme_path = GLOBAL_DEF_RST("gui/theme/custom", "");

View File

@ -34,4 +34,6 @@
void register_scene_types(); void register_scene_types();
void unregister_scene_types(); void unregister_scene_types();
void initialize_theme();
#endif #endif