diff options
Diffstat (limited to 'editor/doc_tools.cpp')
-rw-r--r-- | editor/doc_tools.cpp | 93 |
1 files changed, 37 insertions, 56 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index e0b344fc19..ef3981fd3f 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -624,66 +624,47 @@ void DocTools::generate(bool p_basic_types) { // Theme items. { - List<StringName> l; + List<ThemeDB::ThemeItemBind> theme_items; + ThemeDB::get_singleton()->get_class_own_items(cname, &theme_items); + Ref<Theme> default_theme = ThemeDB::get_singleton()->get_default_theme(); - ThemeDB::get_singleton()->get_default_theme()->get_color_list(cname, &l); - for (const StringName &E : l) { + for (const ThemeDB::ThemeItemBind &theme_item : theme_items) { DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "Color"; - tid.data_type = "color"; - tid.default_value = DocData::get_default_value_string(ThemeDB::get_singleton()->get_default_theme()->get_color(E, cname)); - c.theme_properties.push_back(tid); - } - - l.clear(); - ThemeDB::get_singleton()->get_default_theme()->get_constant_list(cname, &l); - for (const StringName &E : l) { - DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "int"; - tid.data_type = "constant"; - tid.default_value = itos(ThemeDB::get_singleton()->get_default_theme()->get_constant(E, cname)); - c.theme_properties.push_back(tid); - } - - l.clear(); - ThemeDB::get_singleton()->get_default_theme()->get_font_list(cname, &l); - for (const StringName &E : l) { - DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "Font"; - tid.data_type = "font"; - c.theme_properties.push_back(tid); - } - - l.clear(); - ThemeDB::get_singleton()->get_default_theme()->get_font_size_list(cname, &l); - for (const StringName &E : l) { - DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "int"; - tid.data_type = "font_size"; - c.theme_properties.push_back(tid); - } + tid.name = theme_item.item_name; + + switch (theme_item.data_type) { + case Theme::DATA_TYPE_COLOR: + tid.type = "Color"; + tid.data_type = "color"; + break; + case Theme::DATA_TYPE_CONSTANT: + tid.type = "int"; + tid.data_type = "constant"; + break; + case Theme::DATA_TYPE_FONT: + tid.type = "Font"; + tid.data_type = "font"; + break; + case Theme::DATA_TYPE_FONT_SIZE: + tid.type = "int"; + tid.data_type = "font_size"; + break; + case Theme::DATA_TYPE_ICON: + tid.type = "Texture2D"; + tid.data_type = "icon"; + break; + case Theme::DATA_TYPE_STYLEBOX: + tid.type = "StyleBox"; + tid.data_type = "style"; + break; + case Theme::DATA_TYPE_MAX: + break; // Can't happen, but silences warning. + } - l.clear(); - ThemeDB::get_singleton()->get_default_theme()->get_icon_list(cname, &l); - for (const StringName &E : l) { - DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "Texture2D"; - tid.data_type = "icon"; - c.theme_properties.push_back(tid); - } + if (theme_item.data_type == Theme::DATA_TYPE_COLOR || theme_item.data_type == Theme::DATA_TYPE_CONSTANT) { + tid.default_value = DocData::get_default_value_string(default_theme->get_theme_item(theme_item.data_type, theme_item.item_name, cname)); + } - l.clear(); - ThemeDB::get_singleton()->get_default_theme()->get_stylebox_list(cname, &l); - for (const StringName &E : l) { - DocData::ThemeItemDoc tid; - tid.name = E; - tid.type = "StyleBox"; - tid.data_type = "style"; c.theme_properties.push_back(tid); } |