mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 07:01:06 +00:00
Use bound theme properties for documentation
This commit is contained in:
parent
36945dad07
commit
596dd726a1
37 changed files with 218 additions and 628 deletions
|
|
@ -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);
|
||||
}
|
||||
tid.name = theme_item.item_name;
|
||||
|
||||
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);
|
||||
}
|
||||
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_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);
|
||||
}
|
||||
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_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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue