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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1129,7 +1129,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_stylebox("normal", "MenuBar", style_widget);
|
||||
theme->set_stylebox("hover", "MenuBar", style_widget_hover);
|
||||
theme->set_stylebox("pressed", "MenuBar", style_widget_pressed);
|
||||
theme->set_stylebox("focus", "MenuBar", style_widget_focus);
|
||||
theme->set_stylebox("disabled", "MenuBar", style_widget_disabled);
|
||||
|
||||
theme->set_color("font_color", "MenuBar", font_color);
|
||||
|
|
@ -2329,7 +2328,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_color("completion_existing_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_existing_color"));
|
||||
theme->set_color("completion_scroll_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_scroll_color"));
|
||||
theme->set_color("completion_scroll_hovered_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_scroll_hovered_color"));
|
||||
theme->set_color("completion_font_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_font_color"));
|
||||
theme->set_color("font_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
||||
theme->set_color("line_number_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/line_number_color"));
|
||||
theme->set_color("caret_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/caret_color"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue