summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-18 16:17:04 +0200
committerGitHub <noreply@github.com>2022-05-18 16:17:04 +0200
commite709a6e2cf018b507b09d198326510ad04ee78db (patch)
tree83c604ebefcb6e63b52ea76b66ca989f7161d409 /scene
parent4155d555e3f6b7ca19cd84cd32f11b78f8a7941a (diff)
parent4e0f11cfdb182e6d71aff5597dc4d691fe2b0d75 (diff)
Merge pull request #61152 from YuriSizov/theme-sets-lists-and-idle-hands
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/theme.cpp44
1 files changed, 38 insertions, 6 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 1e57933000..e14f5f224e 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -1272,12 +1272,44 @@ void Theme::remove_type(const StringName &p_theme_type) {
void Theme::get_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
- get_icon_type_list(p_list);
- get_stylebox_type_list(p_list);
- get_font_type_list(p_list);
- get_font_size_type_list(p_list);
- get_color_type_list(p_list);
- get_constant_type_list(p_list);
+ // This Set guarantees uniqueness.
+ // Because each map can have the same type defined, but for this method
+ // we only want one occurrence of each type.
+ RBSet<StringName> types;
+
+ // Icons.
+ for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : icon_map) {
+ types.insert(E.key);
+ }
+
+ // Styles.
+ for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : style_map) {
+ types.insert(E.key);
+ }
+
+ // Fonts.
+ for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : font_map) {
+ types.insert(E.key);
+ }
+
+ // Font sizes.
+ for (const KeyValue<StringName, HashMap<StringName, int>> &E : font_size_map) {
+ types.insert(E.key);
+ }
+
+ // Colors.
+ for (const KeyValue<StringName, HashMap<StringName, Color>> &E : color_map) {
+ types.insert(E.key);
+ }
+
+ // Constants.
+ for (const KeyValue<StringName, HashMap<StringName, int>> &E : constant_map) {
+ types.insert(E.key);
+ }
+
+ for (RBSet<StringName>::Element *E = types.front(); E; E = E->next()) {
+ p_list->push_back(E->get());
+ }
}
void Theme::get_type_dependencies(const StringName &p_base_type, const StringName &p_type_variation, List<StringName> *p_list) {