diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-06-07 13:29:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 13:29:16 +0200 |
commit | 0c7cb98780da0e7db52a865690a4e394ea75add5 (patch) | |
tree | ba8da006941b48301defb68b7d8378d80bb6b570 /scene | |
parent | bbd41b014c9609dce01b62ce215bdf276b8eb8d9 (diff) | |
parent | 790d6e602be73377011fd369799da263b23fd9ca (diff) |
Merge pull request #49308 from pycbouh/theme-prevent-type-override
Fix `Theme` overriding existing theme types with empty
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/theme.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 786a96501a..12309f7488 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -553,6 +553,9 @@ void Theme::get_icon_list(StringName p_theme_type, List<StringName> *p_list) con } void Theme::add_icon_type(const StringName &p_theme_type) { + if (icon_map.has(p_theme_type)) { + return; + } icon_map[p_theme_type] = HashMap<StringName, Ref<Texture2D>>(); } @@ -641,6 +644,9 @@ void Theme::get_stylebox_list(StringName p_theme_type, List<StringName> *p_list) } void Theme::add_stylebox_type(const StringName &p_theme_type) { + if (style_map.has(p_theme_type)) { + return; + } style_map[p_theme_type] = HashMap<StringName, Ref<StyleBox>>(); } @@ -730,6 +736,9 @@ void Theme::get_font_list(StringName p_theme_type, List<StringName> *p_list) con } void Theme::add_font_type(const StringName &p_theme_type) { + if (font_map.has(p_theme_type)) { + return; + } font_map[p_theme_type] = HashMap<StringName, Ref<Font>>(); } @@ -807,6 +816,9 @@ void Theme::get_font_size_list(StringName p_theme_type, List<StringName> *p_list } void Theme::add_font_size_type(const StringName &p_theme_type) { + if (font_size_map.has(p_theme_type)) { + return; + } font_size_map[p_theme_type] = HashMap<StringName, int>(); } @@ -882,6 +894,9 @@ void Theme::get_color_list(StringName p_theme_type, List<StringName> *p_list) co } void Theme::add_color_type(const StringName &p_theme_type) { + if (color_map.has(p_theme_type)) { + return; + } color_map[p_theme_type] = HashMap<StringName, Color>(); } @@ -956,6 +971,9 @@ void Theme::get_constant_list(StringName p_theme_type, List<StringName> *p_list) } void Theme::add_constant_type(const StringName &p_theme_type) { + if (constant_map.has(p_theme_type)) { + return; + } constant_map[p_theme_type] = HashMap<StringName, int>(); } |