From 1e8048dd45149b8d574cf983e12ff5886d109da0 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 01:06:02 -0500 Subject: Improved theme generation, and other fixes --- editor/animation_editor.cpp | 6 +- editor/editor_node.cpp | 3 +- editor/editor_settings.cpp | 6 +- editor/editor_themes.cpp | 364 ++++++++++++++----------- editor/project_export.cpp | 4 +- modules/visual_script/visual_script_editor.cpp | 2 +- scene/gui/dialogs.cpp | 2 +- 7 files changed, 220 insertions(+), 167 deletions(-) diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index f4e3bf4894..47360ff7fb 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1038,7 +1038,7 @@ void AnimationKeyEditor::_track_pos_draw() { //draw position int pixel = (timeline_pos - h_scroll->get_value()) * zoom_scale; pixel += name_limit; - track_pos->draw_line(ofs + Point2(pixel, 0), ofs + Point2(pixel, size.height), get_color("highlight_color", "Editor")); + track_pos->draw_line(ofs + Point2(pixel, 0), ofs + Point2(pixel, size.height), get_color("accent_color", "Editor")); } } @@ -1101,7 +1101,7 @@ void AnimationKeyEditor::_track_editor_draw() { Color select_color = color; select_color.a = 0.1; Color invalid_path_color = get_color("error_color", "Editor"); - Color track_select_color = get_color("highlight_color", "Editor"); + Color track_select_color = get_color("accent", "Editor"); Ref remove_icon = get_icon("Remove", "EditorIcons"); Ref move_up_icon = get_icon("MoveUp", "EditorIcons"); @@ -1487,7 +1487,7 @@ void AnimationKeyEditor::_track_editor_draw() { switch (click.click) { case ClickOver::CLICK_SELECT_KEYS: { - Color box_color = get_color("highlight_color", "Editor"); + Color box_color = get_color("accent_color", "Editor"); box_color.a = 0.35; te->draw_rect(Rect2(click.at, click.to - click.at), box_color); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b4412014e7..240d3563ae 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4872,6 +4872,7 @@ EditorNode::EditorNode() { gui_base->add_child(dependency_fixer); settings_config_dialog = memnew(EditorSettingsDialog); + // settings_config_dialog->add_style_override("panel", gui_base->get_stylebox("EditorSettingsDialog", "EditorStyles")); gui_base->add_child(settings_config_dialog); project_settings = memnew(ProjectSettingsEditor(&editor_data)); @@ -5029,7 +5030,7 @@ EditorNode::EditorNode() { p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Issue Tracker"), HELP_ISSUES); p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Community"), HELP_COMMUNITY); p->add_separator(); - p->add_icon_item(gui_base->get_icon("GodotDocs", "EditorIcons"), TTR("About"), HELP_ABOUT); + p->add_icon_item(gui_base->get_icon("Godot", "EditorIcons"), TTR("About"), HELP_ABOUT); play_cc = memnew(CenterContainer); play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 50cee6d892..136878e470 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -574,10 +574,10 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { set("interface/theme/icon_and_font_color", 0); hints["interface/theme/icon_and_font_color"] = PropertyInfo(Variant::INT, "interface/theme/icon_and_font_color", PROPERTY_HINT_ENUM, "Auto,Dark,Light", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); set("interface/theme/base_color", Color::html("#323b4f")); - hints["interface/theme/highlight_color"] = PropertyInfo(Variant::COLOR, "interface/theme/highlight_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - set("interface/theme/highlight_color", Color::html("#699ce8")); + hints["interface/theme/accent_color"] = PropertyInfo(Variant::COLOR, "interface/theme/accent_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/theme/accent_color", Color::html("#699ce8")); hints["interface/theme/base_color"] = PropertyInfo(Variant::COLOR, "interface/theme/base_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - set("interface/theme/contrast", 0.2); + set("interface/theme/contrast", 0.25); hints["interface/theme/contrast"] = PropertyInfo(Variant::REAL, "interface/theme/contrast", PROPERTY_HINT_RANGE, "0.01, 1, 0.01"); set("interface/theme/highlight_tabs", false); set("interface/theme/border_size", 1); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index ff0e794a20..9334dc62bd 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -179,9 +179,6 @@ void editor_register_and_generate_icons(Ref p_theme, bool dark_theme = tr #endif } -#define HIGHLIGHT_COLOR_FONT highlight_color.linear_interpolate(dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1), 0.5) -#define HIGHLIGHT_COLOR_BG highlight_color.linear_interpolate(dark_theme ? Color(0, 0, 0, 1) : Color(1, 1, 1, 1), 0.5) - Ref create_editor_theme(const Ref p_theme) { Ref theme = Ref(memnew(Theme)); @@ -189,7 +186,7 @@ Ref create_editor_theme(const Ref p_theme) { const float default_contrast = 0.25; //Theme settings - Color highlight_color = EDITOR_DEF("interface/theme/highlight_color", Color::html("#000000")); + Color accent_color = EDITOR_DEF("interface/theme/accent_color", Color::html("#000000")); Color base_color = EDITOR_DEF("interface/theme/base_color", Color::html("#000000")); float contrast = EDITOR_DEF("interface/theme/contrast", default_contrast); @@ -202,27 +199,27 @@ Ref create_editor_theme(const Ref p_theme) { switch (preset) { case 0: { // Default - highlight_color = Color::html("#699ce8"); + accent_color = Color::html("#699ce8"); base_color = Color::html("#323b4f"); contrast = default_contrast; } break; case 1: { // Grey - highlight_color = Color::html("#3e3e3e"); + accent_color = Color::html("#3e3e3e"); base_color = Color::html("#3d3d3d"); contrast = 0.2; } break; case 2: { // Godot 2 - highlight_color = Color::html("#86ace2"); + accent_color = Color::html("#86ace2"); base_color = Color::html("#3C3A44"); contrast = 0.25; } break; case 3: { // Arc - highlight_color = Color::html("#5294e2"); + accent_color = Color::html("#5294e2"); base_color = Color::html("#383c4a"); contrast = 0.25; } break; case 4: { // Light - highlight_color = Color::html("#2070ff"); + accent_color = Color::html("#2070ff"); base_color = Color::html("#ffffff"); contrast = 0.08; } break; @@ -233,22 +230,29 @@ Ref create_editor_theme(const Ref p_theme) { int LIGHT_COLOR = 2; bool dark_theme = (icon_font_color_setting == AUTO_COLOR && ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5) || icon_font_color_setting == LIGHT_COLOR; - Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast); - Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5); - Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2); + const Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast); + const Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5); + const Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2); - Color contrast_color_1 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), MAX(contrast, default_contrast)); - Color contrast_color_2 = base_color.linear_interpolate((dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)), MAX(contrast * 1.5, default_contrast * 1.5)); + const Color background_color = dark_color_2; - Color font_color = dark_theme ? Color(1, 1, 1) : Color(0, 0, 0); - Color font_color_disabled = dark_theme ? Color(0.6, 0.6, 0.6) : Color(0.45, 0.45, 0.45); + // white (dark theme) or black (light theme), will be used to generate the rest of the colors + const Color mono_color = dark_theme ? Color(1, 1, 1) : Color(0, 0, 0); - Color separator_color = dark_theme ? Color(1, 1, 1, 0.1) : Color(0, 0, 0, 0.1); + const Color contrast_color_1 = base_color.linear_interpolate(mono_color, MAX(contrast, default_contrast)); + const Color contrast_color_2 = base_color.linear_interpolate(mono_color, MAX(contrast * 1.5, default_contrast * 1.5)); - Color tab_color = highlight_tabs ? base_color.linear_interpolate(font_color, contrast) : base_color; - const int border_width = CLAMP(border_size, 0, 3) * EDSCALE; + const Color font_color = mono_color.linear_interpolate(base_color, 0.25); + const Color font_color_hl = mono_color.linear_interpolate(base_color, 0.15); + const Color font_color_disabled = Color(mono_color.r, mono_color.g, mono_color.b, 0.3); + const Color color_disabled = mono_color.inverted().linear_interpolate(base_color, 0.7); + const Color color_disabled_bg = mono_color.inverted().linear_interpolate(base_color, 0.9); + + const Color separator_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.1); + + const Color highlight_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.2); - theme->set_color("highlight_color", "Editor", highlight_color); + theme->set_color("accent_color", "Editor", accent_color); theme->set_color("base_color", "Editor", base_color); theme->set_color("dark_color_1", "Editor", dark_color_1); theme->set_color("dark_color_2", "Editor", dark_color_2); @@ -256,9 +260,9 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("contrast_color_1", "Editor", contrast_color_1); theme->set_color("contrast_color_2", "Editor", contrast_color_2); - Color success_color = highlight_color.linear_interpolate(Color(.6, 1, .6), 0.8); - Color warning_color = highlight_color.linear_interpolate(Color(1, 1, .2), 0.8); - Color error_color = highlight_color.linear_interpolate(Color(1, .2, .2), 0.8); + Color success_color = accent_color.linear_interpolate(Color(.6, 1, .6), 0.8); + Color warning_color = accent_color.linear_interpolate(Color(1, 1, .2), 0.8); + Color error_color = accent_color.linear_interpolate(Color(1, .2, .2), 0.8); theme->set_color("success_color", "Editor", success_color); theme->set_color("warning_color", "Editor", warning_color); theme->set_color("error_color", "Editor", error_color); @@ -280,18 +284,75 @@ Ref create_editor_theme(const Ref p_theme) { editor_register_fonts(theme); + // Highlighted tabs and border width + Color tab_color = highlight_tabs ? base_color.linear_interpolate(font_color, contrast) : base_color; + const int border_width = CLAMP(border_size, 0, 3) * EDSCALE; + + const int default_margin_size = 4 * EDSCALE; + // styleboxes + // this is the most commonly used stylebox, variations should be made as duplicate of this + Ref style_default = make_flat_stylebox(base_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size); + style_default->set_border_width_all(border_width); + style_default->set_border_color_all(base_color); + style_default->set_draw_center(true); + + // Button and widgets + Ref style_widget = style_default->duplicate(); + + // style_widget->set_bg_color(dark_color_1.linear_interpolate(base_color, 0.4)); + style_widget->set_bg_color(dark_color_1); + style_widget->set_default_margin(MARGIN_LEFT, 6 * EDSCALE); + style_widget->set_default_margin(MARGIN_RIGHT, 6 * EDSCALE); + // style_widget->set_border_color_all(contrast_color_1); + style_widget->set_border_color_all(dark_color_2); + + Ref style_widget_disabled = style_widget->duplicate(); + style_widget_disabled->set_border_color_all(color_disabled); + style_widget_disabled->set_bg_color(color_disabled_bg); + + Ref style_widget_focus = style_widget->duplicate(); + style_widget_focus->set_border_color_all(accent_color); + + Ref style_widget_pressed = style_widget->duplicate(); + style_widget_pressed->set_border_color_all(accent_color); + + Ref style_widget_hover = style_widget->duplicate(); + style_widget_hover->set_border_color_all(contrast_color_1); + + // style for windows, popups, etc.. + Ref style_popup = style_default->duplicate(); + style_popup->set_default_margin(MARGIN_LEFT, default_margin_size * 2); + style_popup->set_default_margin(MARGIN_TOP, default_margin_size * 2); + style_popup->set_default_margin(MARGIN_RIGHT, default_margin_size * 2); + style_popup->set_default_margin(MARGIN_BOTTOM, default_margin_size * 2); + style_popup->set_border_color_all(contrast_color_1); + style_popup->set_border_width_all(MAX(EDSCALE, border_width)); + style_popup->set_shadow_color(Color(0, 0, 0, dark_theme ? 0.3 : 0.1)); + style_popup->set_shadow_size(4 * EDSCALE); + + Ref style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size); + + // Tabs + Ref style_tab_selected = style_default->duplicate(); + style_tab_selected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE); + style_tab_selected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE); + style_tab_selected->set_bg_color(tab_color); + + Ref style_tab_unselected = style_empty->duplicate(); + style_tab_unselected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE); + style_tab_unselected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE); + // Editor background - theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(dark_color_2, 4, 4, 4, 4)); + theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size)); // Focus - Ref focus_sbt = make_flat_stylebox(contrast_color_1, 4, 4, 4, 4); - focus_sbt->set_draw_center(false); - focus_sbt->set_border_width_all(1 * EDSCALE); - focus_sbt = change_border_color(focus_sbt, contrast_color_2); - theme->set_stylebox("Focus", "EditorStyles", focus_sbt); + Ref style_focus = style_default->duplicate(); + style_focus->set_draw_center(false); + style_focus->set_border_color_all(contrast_color_2); + theme->set_stylebox("Focus", "EditorStyles", style_focus); // Menu - Ref style_menu = make_empty_stylebox(4, 4, 4, 4); + Ref style_menu = style_empty; theme->set_stylebox("panel", "PanelContainer", style_menu); theme->set_stylebox("MenuPanel", "EditorStyles", style_menu); @@ -300,15 +361,18 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("ScriptEditor", "EditorStyles", make_empty_stylebox(0, 0, 0, 0)); // Play button group - theme->set_stylebox("PlayButtonPanel", "EditorStyles", make_empty_stylebox(8, 4, 8, 4)); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4)); + theme->set_stylebox("PlayButtonPanel", "EditorStyles", style_empty); //make_stylebox(theme->get_icon("GuiPlayButtonGroup", "EditorIcons"), 16, 16, 16, 16, 8, 4, 8, 4)); //MenuButton - Ref style_menu_hover_border = make_flat_stylebox(highlight_color, 4, 4, 4, 4); - Ref style_menu_hover_bg = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); - + Ref style_menu_hover_border = style_default->duplicate(); style_menu_hover_border->set_draw_center(false); - style_menu_hover_border->set_border_width(MARGIN_BOTTOM, 2 * EDSCALE); - style_menu_hover_border->set_border_color_all(highlight_color); + style_menu_hover_border->set_border_width_all(0); + style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width * EDSCALE); + style_menu_hover_border->set_border_color_all(accent_color); + + Ref style_menu_hover_bg = style_default->duplicate(); + style_menu_hover_bg->set_border_width_all(0); + style_menu_hover_bg->set_bg_color(dark_color_1); theme->set_stylebox("normal", "MenuButton", style_menu); theme->set_stylebox("hover", "MenuButton", style_menu); @@ -329,72 +393,66 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("disabled", "ToolButton", style_menu); theme->set_color("font_color", "MenuButton", font_color); - theme->set_color("font_color_hover", "MenuButton", HIGHLIGHT_COLOR_FONT); + theme->set_color("font_color_hover", "MenuButton", font_color_hl); theme->set_color("font_color", "ToolButton", font_color); - theme->set_color("font_color_hover", "ToolButton", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_pressed", "ToolButton", highlight_color); + theme->set_color("font_color_hover", "ToolButton", font_color_hl); + theme->set_color("font_color_pressed", "ToolButton", accent_color); theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border); // Content of each tab - Ref style_content_panel = make_flat_stylebox(base_color, 4, 4, 4, 4); + Ref style_content_panel = style_default->duplicate(); style_content_panel->set_border_color_all(base_color); - style_content_panel->set_border_width_all(border_width); - Ref style_content_panel_vp = make_flat_stylebox(base_color, border_width, 4, border_width, border_width); - style_content_panel_vp->set_border_color_all(base_color); - style_content_panel_vp->set_border_width_all(border_width); + + // this is the stylebox used in 3d and 2d viewports (no borders) + Ref style_content_panel_vp = style_content_panel->duplicate(); + style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width); + style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size); + style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width); + style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width); theme->set_stylebox("panel", "TabContainer", style_content_panel); theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp); - Ref style_button_type = make_flat_stylebox(dark_color_1, 6, 4, 6, 4); - style_button_type->set_draw_center(true); - style_button_type->set_border_width_all(border_width); - style_button_type->set_border_color_all(contrast_color_2); - - Ref style_button_type_disabled = change_border_color(style_button_type, contrast_color_1); - - Color button_font_color = contrast_color_1.linear_interpolate(font_color, .6); + // Buttons + theme->set_stylebox("normal", "Button", style_widget); + theme->set_stylebox("hover", "Button", style_widget_hover); + theme->set_stylebox("pressed", "Button", style_widget_pressed); + theme->set_stylebox("focus", "Button", style_widget_focus); + theme->set_stylebox("disabled", "Button", style_widget_disabled); - // Button - theme->set_stylebox("normal", "Button", style_button_type); - theme->set_stylebox("hover", "Button", change_border_color(style_button_type, HIGHLIGHT_COLOR_FONT)); - theme->set_stylebox("pressed", "Button", change_border_color(style_button_type, highlight_color)); - theme->set_stylebox("focus", "Button", change_border_color(style_button_type, highlight_color)); - theme->set_stylebox("disabled", "Button", style_button_type_disabled); - - theme->set_color("font_color", "Button", button_font_color); - theme->set_color("font_color_hover", "Button", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_pressed", "Button", highlight_color); + theme->set_color("font_color", "Button", font_color); + theme->set_color("font_color_hover", "Button", font_color_hl); + theme->set_color("font_color_pressed", "Button", accent_color); theme->set_color("font_color_disabled", "Button", font_color_disabled); - theme->set_color("icon_color_hover", "Button", HIGHLIGHT_COLOR_FONT); + theme->set_color("icon_color_hover", "Button", font_color_hl); // make icon color value bigger because icon image is not complete white - theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a)); + theme->set_color("icon_color_pressed", "Button", Color(accent_color.r * 1.15, accent_color.g * 1.15, accent_color.b * 1.15, accent_color.a)); // OptionButton - theme->set_stylebox("normal", "OptionButton", style_button_type); - theme->set_stylebox("hover", "OptionButton", change_border_color(style_button_type, contrast_color_1)); - theme->set_stylebox("pressed", "OptionButton", change_border_color(style_button_type, HIGHLIGHT_COLOR_FONT)); - theme->set_stylebox("focus", "OptionButton", change_border_color(style_button_type, highlight_color)); - theme->set_stylebox("disabled", "OptionButton", style_button_type_disabled); - - theme->set_color("font_color", "OptionButton", button_font_color); - theme->set_color("font_color_hover", "OptionButton", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_pressed", "OptionButton", highlight_color); + theme->set_stylebox("normal", "OptionButton", style_widget); + theme->set_stylebox("hover", "OptionButton", style_widget_hover); + theme->set_stylebox("pressed", "OptionButton", style_widget_pressed); + theme->set_stylebox("focus", "OptionButton", style_widget_focus); + theme->set_stylebox("disabled", "OptionButton", style_widget_disabled); + + theme->set_color("font_color", "OptionButton", font_color); + theme->set_color("font_color_hover", "OptionButton", font_color_hl); + theme->set_color("font_color_pressed", "OptionButton", accent_color); theme->set_color("font_color_disabled", "OptionButton", font_color_disabled); - theme->set_color("icon_color_hover", "OptionButton", HIGHLIGHT_COLOR_FONT); + theme->set_color("icon_color_hover", "OptionButton", font_color_hl); theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons")); - theme->set_constant("arrow_margin", "OptionButton", 4); + theme->set_constant("arrow_margin", "OptionButton", 4 * EDSCALE); theme->set_constant("modulate_arrow", "OptionButton", true); // CheckButton theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons")); theme->set_icon("off", "CheckButton", theme->get_icon("GuiToggleOff", "EditorIcons")); - theme->set_color("font_color", "CheckButton", button_font_color); - theme->set_color("font_color_hover", "CheckButton", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_pressed", "CheckButton", highlight_color); + theme->set_color("font_color", "CheckButton", font_color); + theme->set_color("font_color_hover", "CheckButton", font_color_hl); + theme->set_color("font_color_pressed", "CheckButton", accent_color); theme->set_color("font_color_disabled", "CheckButton", font_color_disabled); - theme->set_color("icon_color_hover", "CheckButton", HIGHLIGHT_COLOR_FONT); + theme->set_color("icon_color_hover", "CheckButton", font_color_hl); // Checkbox theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons")); @@ -402,21 +460,19 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons")); theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); - theme->set_color("font_color", "CheckBox", button_font_color); - theme->set_color("font_color_hover", "CheckBox", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_pressed", "CheckBox", highlight_color); + theme->set_color("font_color", "CheckBox", font_color); + theme->set_color("font_color_hover", "CheckBox", font_color_hl); + theme->set_color("font_color_pressed", "CheckBox", accent_color); theme->set_color("font_color_disabled", "CheckBox", font_color_disabled); - theme->set_color("icon_color_hover", "CheckBox", HIGHLIGHT_COLOR_FONT); + theme->set_color("icon_color_hover", "CheckBox", font_color_hl); // PopupMenu - Ref style_popup_menu = make_flat_stylebox(dark_color_1, 8, 8, 8, 8); - style_popup_menu->set_border_width_all(MAX(EDSCALE, border_width)); - style_popup_menu->set_border_color_all(contrast_color_1); + Ref style_popup_menu = style_popup; theme->set_stylebox("panel", "PopupMenu", style_popup_menu); theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, MAX(EDSCALE, border_width), 8 - MAX(EDSCALE, border_width))); theme->set_color("font_color", "PopupMenu", font_color); - theme->set_color("font_color_hover", "PopupMenu", HIGHLIGHT_COLOR_FONT); - theme->set_color("font_color_accel", "PopupMenu", font_color); + theme->set_color("font_color_hover", "PopupMenu", font_color_hl); + theme->set_color("font_color_accel", "PopupMenu", font_color_disabled); theme->set_color("font_color_disabled", "PopupMenu", font_color_disabled); theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); @@ -424,8 +480,8 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons")); // Tree & ItemList background - Ref style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4); - style_tree_bg->set_border_width_all(border_width); + Ref style_tree_bg = style_default->duplicate(); + style_tree_bg->set_bg_color(dark_color_1); style_tree_bg->set_border_color_all(dark_color_3); theme->set_stylebox("bg", "Tree", style_tree_bg); @@ -435,78 +491,84 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons")); theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons")); theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons")); - theme->set_stylebox("bg_focus", "Tree", focus_sbt); + theme->set_stylebox("bg_focus", "Tree", style_focus); theme->set_stylebox("custom_button", "Tree", make_empty_stylebox()); theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox()); - theme->set_stylebox("custom_button_hover", "Tree", style_button_type); - theme->set_color("custom_button_font_highlight", "Tree", HIGHLIGHT_COLOR_FONT); + theme->set_stylebox("custom_button_hover", "Tree", style_widget); + theme->set_color("custom_button_font_highlight", "Tree", font_color_hl); theme->set_color("font_color", "Tree", font_color); theme->set_color("font_color_selected", "Tree", font_color); - Ref style_tree_btn = make_flat_stylebox(contrast_color_1, 2, 4, 2, 4); + Ref style_tree_btn = style_default->duplicate(); + style_tree_btn->set_bg_color(contrast_color_1); + style_tree_btn->set_border_width_all(0); theme->set_stylebox("button_pressed", "Tree", style_tree_btn); - Ref style_tree_focus = make_flat_stylebox(HIGHLIGHT_COLOR_BG, 2, 2, 2, 2); + Ref style_tree_focus = style_default->duplicate(); + style_tree_focus->set_bg_color(highlight_color); + style_tree_focus->set_border_width_all(0); theme->set_stylebox("selected_focus", "Tree", style_tree_focus); - Ref style_tree_selected = make_flat_stylebox(HIGHLIGHT_COLOR_BG, 2, 2, 2, 2); + Ref style_tree_selected = style_tree_focus->duplicate(); theme->set_stylebox("selected", "Tree", style_tree_selected); - Ref style_tree_cursor = make_flat_stylebox(HIGHLIGHT_COLOR_BG, 4, 4, 4, 4); + Ref style_tree_cursor = style_default->duplicate(); style_tree_cursor->set_draw_center(false); style_tree_cursor->set_border_width_all(border_width); style_tree_cursor->set_border_color_all(contrast_color_1); - Ref style_tree_title = make_flat_stylebox(dark_color_3, 4, 4, 4, 4); + Ref style_tree_title = style_default->duplicate(); + style_tree_title->set_bg_color(dark_color_3); + style_tree_title->set_border_width_all(0); theme->set_stylebox("cursor", "Tree", style_tree_cursor); theme->set_stylebox("cursor_unfocused", "Tree", style_tree_cursor); theme->set_stylebox("title_button_normal", "Tree", style_tree_title); theme->set_stylebox("title_button_hover", "Tree", style_tree_title); theme->set_stylebox("title_button_pressed", "Tree", style_tree_title); - Color prop_category_color = dark_theme ? dark_color_1.linear_interpolate(Color(1, 1, 1, 1), 0.12) : dark_color_1.linear_interpolate(Color(0, 0, 0, 1), 0.2); - Color prop_section_color = dark_theme ? dark_color_1.linear_interpolate(Color(1, 1, 1, 1), 0.09) : dark_color_1.linear_interpolate(Color(0, 1, 0, 1), 0.1); - Color prop_subsection_color = dark_theme ? dark_color_1.linear_interpolate(Color(1, 1, 1, 1), 0.06) : dark_color_1.linear_interpolate(Color(0, 0, 0, 1), 0.1); + // Color prop_category_color = dark_color_1.linear_interpolate(mono_color, 0.12) : dark_color_1.linear_interpolate(Color(0, 0, 0, 1), 0.2); + // Color prop_section_color = dark_color_1.linear_interpolate(mono_color, 0.09) : dark_color_1.linear_interpolate(Color(0, 1, 0, 1), 0.1); + // Color prop_subsection_color = dark_color_1.linear_interpolate(mono_color, 0.06) : dark_color_1.linear_interpolate(Color(0, 0, 0, 1), 0.1); + Color prop_category_color = dark_color_1.linear_interpolate(mono_color, 0.12); + Color prop_section_color = dark_color_1.linear_interpolate(mono_color, 0.09); + Color prop_subsection_color = dark_color_1.linear_interpolate(mono_color, 0.06); theme->set_color("prop_category", "Editor", prop_category_color); theme->set_color("prop_section", "Editor", prop_section_color); theme->set_color("prop_subsection", "Editor", prop_subsection_color); - theme->set_color("drop_position_color", "Tree", highlight_color); + theme->set_color("drop_position_color", "Tree", accent_color); // ItemList - Ref style_itemlist_bg = make_flat_stylebox(dark_color_1, 4, 4, 4, 4); + Ref style_itemlist_bg = style_default->duplicate(); + style_itemlist_bg->set_bg_color(dark_color_1); style_itemlist_bg->set_border_width_all(border_width); style_itemlist_bg->set_border_color_all(dark_color_3); - Ref style_itemlist_cursor = make_flat_stylebox(highlight_color, 0, 0, 0, 0); + Ref style_itemlist_cursor = style_default->duplicate(); style_itemlist_cursor->set_draw_center(false); style_itemlist_cursor->set_border_width_all(border_width); - style_itemlist_cursor->set_border_color_all(HIGHLIGHT_COLOR_BG); + style_itemlist_cursor->set_border_color_all(highlight_color); theme->set_stylebox("cursor", "ItemList", style_itemlist_cursor); theme->set_stylebox("cursor_unfocused", "ItemList", style_itemlist_cursor); theme->set_stylebox("selected_focus", "ItemList", style_tree_focus); theme->set_stylebox("selected", "ItemList", style_tree_selected); - theme->set_stylebox("bg_focus", "ItemList", focus_sbt); + theme->set_stylebox("bg_focus", "ItemList", style_focus); theme->set_stylebox("bg", "ItemList", style_itemlist_bg); theme->set_constant("vseparation", "ItemList", 5 * EDSCALE); theme->set_color("font_color", "ItemList", font_color); - Ref style_tab_fg = make_flat_stylebox(tab_color, 15, 5, 15, 5); - Ref style_tab_bg = make_flat_stylebox(tab_color, 15, 5, 15, 5); - style_tab_bg->set_draw_center(false); - // Tabs & TabContainer - theme->set_stylebox("tab_fg", "TabContainer", style_tab_fg); - theme->set_stylebox("tab_bg", "TabContainer", style_tab_bg); - theme->set_stylebox("tab_fg", "Tabs", style_tab_fg); - theme->set_stylebox("tab_bg", "Tabs", style_tab_bg); + theme->set_stylebox("tab_fg", "TabContainer", style_tab_selected); + theme->set_stylebox("tab_bg", "TabContainer", style_tab_unselected); + theme->set_stylebox("tab_fg", "Tabs", style_tab_selected); + theme->set_stylebox("tab_bg", "Tabs", style_tab_unselected); theme->set_color("font_color_fg", "TabContainer", font_color); theme->set_color("font_color_bg", "TabContainer", font_color_disabled); theme->set_color("font_color_fg", "Tabs", font_color); theme->set_color("font_color_bg", "Tabs", font_color_disabled); theme->set_icon("menu", "TabContainer", theme->get_icon("GuiTabMenu", "EditorIcons")); theme->set_icon("menu_hl", "TabContainer", theme->get_icon("GuiTabMenu", "EditorIcons")); - theme->set_stylebox("SceneTabFG", "EditorStyles", make_flat_stylebox(base_color, 10, 5, 10, 5)); - theme->set_stylebox("SceneTabBG", "EditorStyles", make_empty_stylebox(6, 5, 6, 5)); + theme->set_stylebox("SceneTabFG", "EditorStyles", style_tab_selected); + theme->set_stylebox("SceneTabBG", "EditorStyles", style_tab_unselected); theme->set_icon("close", "Tabs", theme->get_icon("GuiClose", "EditorIcons")); theme->set_stylebox("button_pressed", "Tabs", style_menu); theme->set_stylebox("button", "Tabs", style_menu); @@ -516,39 +578,26 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true)); // Debugger - Ref style_panel_debugger = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); + Ref style_panel_debugger = style_default->duplicate(); theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); - Ref style_tab_fg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5); - Ref style_tab_bg_debugger = make_flat_stylebox(dark_color_2, 10, 5, 10, 5); - style_tab_bg_debugger->set_draw_center(false); + Ref style_tab_fg_debugger = style_tab_selected->duplicate(); + style_tab_fg_debugger->set_border_width_all(0); theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger); - theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger); + theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_unselected); // LineEdit - Ref style_line_edit = make_flat_stylebox(dark_color_1, 6, 4, 6, 4); - style_line_edit->set_border_width_all(border_width); - style_line_edit = change_border_color(style_line_edit, contrast_color_1); - Ref style_line_edit_disabled = change_border_color(style_line_edit, dark_color_1); - style_line_edit_disabled->set_bg_color(Color(0, 0, 0, .1)); - Ref style_line_edit_focus = change_border_color(style_line_edit, highlight_color); - theme->set_stylebox("normal", "LineEdit", style_line_edit); - theme->set_stylebox("focus", "LineEdit", style_line_edit_focus); - theme->set_stylebox("read_only", "LineEdit", style_line_edit_disabled); + theme->set_stylebox("normal", "LineEdit", style_widget); + theme->set_stylebox("focus", "LineEdit", style_widget_focus); + theme->set_stylebox("read_only", "LineEdit", style_widget_disabled); theme->set_color("read_only", "LineEdit", font_color_disabled); theme->set_color("font_color", "LineEdit", font_color); theme->set_color("cursor_color", "LineEdit", font_color); // TextEdit - Ref style_textedit_normal(memnew(StyleBoxFlat)); - style_textedit_normal->set_bg_color(dark_color_2); - style_textedit_normal->set_default_margin(MARGIN_LEFT, 0); - style_textedit_normal->set_default_margin(MARGIN_RIGHT, 0); - style_textedit_normal->set_default_margin(MARGIN_BOTTOM, 0); - style_textedit_normal->set_default_margin(MARGIN_TOP, 0); - theme->set_stylebox("normal", "TextEdit", style_textedit_normal); - theme->set_stylebox("focus", "TextEdit", focus_sbt); + theme->set_stylebox("normal", "TextEdit", style_widget); + theme->set_stylebox("focus", "TextEdit", style_widget_hover); theme->set_constant("side_margin", "TabContainer", 0); // H/VSplitContainer @@ -558,13 +607,12 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("grabber", "VSplitContainer", theme->get_icon("GuiVsplitter", "EditorIcons")); theme->set_icon("grabber", "HSplitContainer", theme->get_icon("GuiHsplitter", "EditorIcons")); - theme->set_constant("separation", "HSplitContainer", 8 * EDSCALE); - theme->set_constant("separation", "VSplitContainer", 8 * EDSCALE); + theme->set_constant("separation", "HSplitContainer", default_margin_size * 2 * EDSCALE); + theme->set_constant("separation", "VSplitContainer", default_margin_size * 2 * EDSCALE); // WindowDialog - Ref style_window = make_flat_stylebox(dark_color_2, 4, 4, 4, 4); - style_window->set_border_width_all(MAX(EDSCALE, border_width)); - style_window->set_border_color_all(base_color); + Ref style_window = style_popup->duplicate(); + style_window->set_border_color_all(tab_color); style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE); style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE); theme->set_stylebox("panel", "WindowDialog", style_window); @@ -575,6 +623,14 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("close_v_ofs", "WindowDialog", 20 * EDSCALE); theme->set_constant("title_height", "WindowDialog", 24 * EDSCALE); + // complex window, for now only Editor settings and Project settings + Ref style_complex_window = style_window->duplicate(); + style_complex_window->set_bg_color(dark_color_2); + style_complex_window->set_border_color_all(highlight_tabs ? tab_color : dark_color_2); + theme->set_stylebox("panel", "EditorSettingsDialog", style_complex_window); + theme->set_stylebox("panel", "ProjectSettingsEditor", style_complex_window); + theme->set_stylebox("panel", "EditorAbout", style_complex_window); + // HScrollBar Ref empty_icon = memnew(ImageTexture); @@ -602,12 +658,12 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("decrement_highlight", "VScrollBar", empty_icon); // HSlider - theme->set_stylebox("slider", "HSlider", make_stylebox(theme->get_icon("GuiHsliderBg", "EditorIcons"), 4, 4, 4, 4)); + theme->set_stylebox("slider", "HSlider", make_stylebox(theme->get_icon("GuiHsliderBg", "EditorIcons"), default_margin_size, default_margin_size, default_margin_size, default_margin_size)); theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); theme->set_icon("grabber_highlight", "HSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); // VSlider - theme->set_stylebox("slider", "VSlider", make_stylebox(theme->get_icon("GuiVsliderBg", "EditorIcons"), 4, 4, 4, 4)); + theme->set_stylebox("slider", "VSlider", make_stylebox(theme->get_icon("GuiVsliderBg", "EditorIcons"), default_margin_size, default_margin_size, default_margin_size, default_margin_size)); theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons")); theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons")); @@ -616,7 +672,7 @@ Ref create_editor_theme(const Ref p_theme) { Color rtl_font_color = (rtl_combined_bg_color.r + rtl_combined_bg_color.g + rtl_combined_bg_color.b > 0.5 * 3) ? Color(0, 0, 0) : Color(1, 1, 1); theme->set_color("default_color", "RichTextLabel", rtl_font_color); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); - theme->set_stylebox("normal", "RichTextLabel", make_flat_stylebox(script_bg_color, 6, 6, 6, 6)); + theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); @@ -625,18 +681,15 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("font_color", "Label", font_color); // TooltipPanel - Ref style_tooltip = make_flat_stylebox(Color(1, 1, 1, 0.8), 8, 8, 8, 8); + Ref style_tooltip = style_popup->duplicate(); + style_tooltip->set_bg_color(Color(mono_color.r, mono_color.g, mono_color.b, 0.9)); style_tooltip->set_border_width_all(border_width); - style_tooltip->set_border_color_all(HIGHLIGHT_COLOR_FONT); + style_tooltip->set_border_color_all(mono_color); theme->set_color("font_color", "TooltipPanel", font_color); theme->set_stylebox("panel", "TooltipPanel", style_tooltip); // PopupPanel - Ref style_dock_select = make_flat_stylebox(base_color); - style_dock_select->set_border_color_all(contrast_color_1); - style_dock_select->set_expand_margin_size_all(2); - style_dock_select->set_border_width_all(2); - theme->set_stylebox("panel", "PopupPanel", style_dock_select); + theme->set_stylebox("panel", "PopupPanel", style_popup); // SpinBox theme->set_icon("updown", "SpinBox", theme->get_icon("GuiSpinboxUpdown", "EditorIcons")); @@ -655,6 +708,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons")); // GraphNode + Ref graphsb = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5); graphsb->set_border_width_all(border_width); graphsb->set_border_color_all(Color(1, 1, 1, 0.6)); @@ -677,9 +731,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected); // FileDialog - Color disable_color = contrast_color_2; - disable_color.a = 0.7; - theme->set_color("files_disabled", "FileDialog", disable_color); + theme->set_color("files_disabled", "FileDialog", font_color_disabled); return theme; } diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 7e81513a8b..f4318a670c 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -48,7 +48,7 @@ void ProjectExportDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - delete_preset->set_icon(get_icon("Del", "EditorIcons")); + delete_preset->set_icon(get_icon("Remove", "EditorIcons")); connect("confirmed", this, "_export_pck_zip"); custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree")); } break; @@ -193,7 +193,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { patch->set_checked(0, true); patch->set_tooltip(0, patchlist[i]); patch->set_metadata(0, i); - patch->add_button(0, get_icon("Del", "EditorIcons"), 0); + patch->add_button(0, get_icon("Remove", "EditorIcons"), 0); patch->add_button(0, get_icon("folder", "FileDialog"), 1); } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index dfec1eea60..696a732d3d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -2974,7 +2974,7 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { TreeItem *root = members->get_root(); - Ref del_icon = Control::get_icon("Del", "EditorIcons"); + Ref del_icon = Control::get_icon("Remove", "EditorIcons"); Ref edit_icon = Control::get_icon("Edit", "EditorIcons"); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 140d002387..d4912339da 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -195,7 +195,7 @@ void WindowDialog::_notification(int p_what) { RID canvas = get_canvas_item(); // Draw the background. - Ref panel = get_stylebox("panel", "WindowDialog"); + Ref panel = get_stylebox("panel"); Size2 size = get_size(); panel->draw(canvas, Rect2(0, 0, size.x, size.y)); -- cgit v1.2.3 From 3a05bdbaab2bc45b3d674e9001aab14b58ca7ed6 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 02:32:43 -0500 Subject: Improved alternative size thumbnail generation --- editor/editor_themes.cpp | 47 +++++++++++++++++++++------- editor/filesystem_dock.cpp | 43 +++++-------------------- editor/icons/SCsub | 26 +++++++++++++++ editor/icons/icon_file.svg | 7 +++++ editor/icons/icon_file_big.svg | 7 ----- editor/icons/icon_file_big_broken.svg | 7 ----- editor/icons/icon_file_big_dead.svg | 7 ----- editor/icons/icon_file_big_thumb.svg | 7 +++++ editor/icons/icon_file_broken_big_thumb.svg | 7 +++++ editor/icons/icon_file_dead_big_thumb.svg | 7 +++++ editor/icons/icon_file_dead_medium_thumb.svg | 7 +++++ editor/icons/icon_file_medium_thumb.svg | 7 +++++ editor/icons/icon_folder_big.svg | 5 --- editor/icons/icon_folder_big_thumb.svg | 5 +++ editor/icons/icon_folder_medium_thumb.svg | 5 +++ editor/icons/icon_godot.svg | 3 -- editor/icons/icon_godot_docs.svg | 31 ++++++++++++++++++ editor/icons/icon_logo.svg | 7 +++++ 18 files changed, 159 insertions(+), 76 deletions(-) create mode 100644 editor/icons/icon_file.svg delete mode 100644 editor/icons/icon_file_big.svg delete mode 100644 editor/icons/icon_file_big_broken.svg delete mode 100644 editor/icons/icon_file_big_dead.svg create mode 100644 editor/icons/icon_file_big_thumb.svg create mode 100644 editor/icons/icon_file_broken_big_thumb.svg create mode 100644 editor/icons/icon_file_dead_big_thumb.svg create mode 100644 editor/icons/icon_file_dead_medium_thumb.svg create mode 100644 editor/icons/icon_file_medium_thumb.svg delete mode 100644 editor/icons/icon_folder_big.svg create mode 100644 editor/icons/icon_folder_big_thumb.svg create mode 100644 editor/icons/icon_folder_medium_thumb.svg create mode 100644 editor/icons/icon_godot_docs.svg create mode 100644 editor/icons/icon_logo.svg diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 9334dc62bd..f6eea296c0 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -86,7 +86,7 @@ static Ref change_border_color(Ref p_style, Color p_ return style; } -Ref editor_generate_icon(int p_index, bool dark_theme = true, Dictionary *p_colors = NULL) { +Ref editor_generate_icon(int p_index, bool dark_theme = true, Dictionary *p_colors = NULL, float p_scale = EDSCALE, bool force_filter = false) { Ref icon = memnew(ImageTexture); Ref img = memnew(Image); @@ -94,9 +94,9 @@ Ref editor_generate_icon(int p_index, bool dark_theme = true, Dict // dumb gizmo check bool is_gizmo = String(editor_icons_names[p_index]).begins_with("Gizmo"); - ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], EDSCALE, true, dark_theme ? NULL : p_colors); + ImageLoaderSVG::create_image_from_string(img, editor_icons_sources[p_index], p_scale, true, dark_theme ? NULL : p_colors); - if ((EDSCALE - (float)((int)EDSCALE)) > 0.0 || is_gizmo) + if ((p_scale - (float)((int)p_scale)) > 0.0 || is_gizmo || force_filter) icon->create_from_image(img); // in this case filter really helps else icon->create_from_image(img, 0); @@ -108,10 +108,9 @@ Ref editor_generate_icon(int p_index, bool dark_theme = true, Dict #define ADD_CONVERT_COLOR(dictionary, old_color, new_color) dictionary[Color::html(old_color)] = Color::html(new_color) #endif -void editor_register_and_generate_icons(Ref p_theme, bool dark_theme = true) { +void editor_register_and_generate_icons(Ref p_theme, bool dark_theme = true, int p_thumb_size = 32, bool only_thumbs = false) { #ifdef SVG_ENABLED - Dictionary dark_icon_color_dictionary; //convert color: FROM TO ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#e0e0e0", "#4f4f4f"); // common icon color @@ -161,13 +160,31 @@ void editor_register_and_generate_icons(Ref p_theme, bool dark_theme = tr clock_t begin_time = clock(); - for (int i = 0; i < editor_icons_count; i++) { - List::Element *is_exception = exceptions.find(editor_icons_names[i]); - if (is_exception) { - exceptions.erase(is_exception); + if (!only_thumbs) + for (int i = 0; i < editor_icons_count; i++) { + List::Element *is_exception = exceptions.find(editor_icons_names[i]); + if (is_exception) { + exceptions.erase(is_exception); + } + Ref icon = editor_generate_icon(i, dark_theme, is_exception ? NULL : &dark_icon_color_dictionary); + p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon); + } + + bool force_filter = !(p_thumb_size == 64 && p_thumb_size == 32); // we dont need filter with original resolution + if (p_thumb_size >= 64) { + float scale = (float)p_thumb_size / 64.0 * EDSCALE; + for (int i = 0; i < editor_bg_thumbs_count; i++) { + int index = editor_bg_thumbs_indices[i]; + Ref icon = editor_generate_icon(index, dark_theme, &dark_icon_color_dictionary, scale, force_filter); + p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); + } + } else { + float scale = (float)p_thumb_size / 32.0 * EDSCALE; + for (int i = 0; i < editor_md_thumbs_count; i++) { + int index = editor_md_thumbs_indices[i]; + Ref icon = editor_generate_icon(index, dark_theme, &dark_icon_color_dictionary, scale, force_filter); + p_theme->set_icon(editor_icons_names[index], "EditorIcons", icon); } - Ref icon = editor_generate_icon(i, dark_theme, is_exception ? NULL : &dark_icon_color_dictionary); - p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon); } clock_t end_time = clock(); @@ -267,7 +284,9 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("warning_color", "Editor", warning_color); theme->set_color("error_color", "Editor", error_color); + const int thumb_size = EDITOR_DEF("filesystem/file_dialog/thumbnail_size", 64); theme->set_constant("scale", "Editor", EDSCALE); + theme->set_constant("thumb_size", "Editor", thumb_size); theme->set_constant("dark_theme", "Editor", dark_theme); //Register icons + font @@ -279,7 +298,11 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons")); } } else { - editor_register_and_generate_icons(theme, dark_theme); + editor_register_and_generate_icons(theme, dark_theme, thumb_size); + } + // thumbnail size has changed, so we regenerate the medium sizes + if (p_theme != NULL && fabs(p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) { + editor_register_and_generate_icons(p_theme, dark_theme, thumb_size, true); } editor_register_fonts(theme); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index a66d1724a1..69c1424403 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -215,9 +215,6 @@ void FileSystemDock::_notification(int p_what) { button_hist_next->set_icon(get_icon("Forward", "EditorIcons")); button_hist_prev->set_icon(get_icon("Back", "EditorIcons")); - Theme::get_default()->clear_icon("ResizedFolder", "EditorIcons"); - Theme::get_default()->clear_icon("ResizedFile", "EditorIcons"); - if (new_mode != display_mode) { set_display_mode(new_mode); } else { @@ -437,39 +434,15 @@ void FileSystemDock::_update_files(bool p_keep_selection) { files->set_max_text_lines(2); files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); - if (!has_icon("ResizedFolder", "EditorIcons")) { - Ref folder = get_icon("FolderBig", "EditorIcons"); - Ref img = folder->get_data(); - img = img->duplicate(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_folder = Ref(memnew(ImageTexture)); - resized_folder->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder); - } - - folder_thumbnail = get_icon("ResizedFolder", "EditorIcons"); - - if (!has_icon("ResizedFile", "EditorIcons")) { - Ref file = get_icon("FileBig", "EditorIcons"); - Ref img = file->get_data(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_file = Ref(memnew(ImageTexture)); - resized_file->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file); - } - - if (!has_icon("ResizedFileBroken", "EditorIcons")) { - Ref file = get_icon("FileBigBroken", "EditorIcons"); - Ref img = file->get_data(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_file = Ref(memnew(ImageTexture)); - resized_file->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFileBroken", "EditorIcons", resized_file); + if (thumbnail_size < 64) { + folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons"); + file_thumbnail = get_icon("FileMediumThumb", "EditorIcons"); + file_thumbnail_broken = get_icon("FileDeadMediumThumb", "EditorIcons"); + } else { + folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons"); + file_thumbnail = get_icon("FileBigThumb", "EditorIcons"); + file_thumbnail_broken = get_icon("FileDeadBigThumb", "EditorIcons"); } - - file_thumbnail = get_icon("ResizedFile", "EditorIcons"); - - file_thumbnail_broken = get_icon("ResizedFileBroken", "EditorIcons"); } else { files->set_icon_mode(ItemList::ICON_MODE_LEFT); diff --git a/editor/icons/SCsub b/editor/icons/SCsub index 534a8186a5..e28c229a38 100644 --- a/editor/icons/SCsub +++ b/editor/icons/SCsub @@ -39,18 +39,44 @@ def make_editor_icons_action(target, source, env): s.write(icons_string.getvalue()) s.write('};\n\n') s.write("static const char *editor_icons_names[] = {\n") + + # this is used to store the indices of thumbnail icons + thumb_medium_indices = []; + thumb_big_indices = []; + index = 0 for f in svg_icons: fname = str(f) icon_name = os.path.basename(fname)[5:-4].title().replace("_", "") + if icon_name.endswith("MediumThumb"): # dont know a better way to handle this + thumb_medium_indices.append(str(index)) + if icon_name.endswith("BigThumb"): # dont know a better way to handle this + thumb_big_indices.append(str(index)) s.write('\t"%s"' % icon_name) if fname != svg_icons[-1]: s.write(",") s.write('\n') + + index += 1 + s.write('};\n') + + if thumb_medium_indices: + s.write("\n\n") + s.write("static const int editor_md_thumbs_count = %s;\n" % len(thumb_medium_indices)) + s.write("static const int editor_md_thumbs_indices[] = {") + s.write(", ".join(thumb_medium_indices)) + s.write("};\n") + if thumb_big_indices: + s.write("\n\n") + s.write("static const int editor_bg_thumbs_count = %s;\n" % len(thumb_big_indices)) + s.write("static const int editor_bg_thumbs_indices[] = {") + s.write(", ".join(thumb_big_indices)) + s.write("};\n") + s.write("#endif\n") diff --git a/editor/icons/icon_file.svg b/editor/icons/icon_file.svg new file mode 100644 index 0000000000..67a081a704 --- /dev/null +++ b/editor/icons/icon_file.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_file_big.svg b/editor/icons/icon_file_big.svg deleted file mode 100644 index 569b449a59..0000000000 --- a/editor/icons/icon_file_big.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/editor/icons/icon_file_big_broken.svg b/editor/icons/icon_file_big_broken.svg deleted file mode 100644 index 167bb1bb5f..0000000000 --- a/editor/icons/icon_file_big_broken.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/editor/icons/icon_file_big_dead.svg b/editor/icons/icon_file_big_dead.svg deleted file mode 100644 index c8aab912f1..0000000000 --- a/editor/icons/icon_file_big_dead.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/editor/icons/icon_file_big_thumb.svg b/editor/icons/icon_file_big_thumb.svg new file mode 100644 index 0000000000..569b449a59 --- /dev/null +++ b/editor/icons/icon_file_big_thumb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_file_broken_big_thumb.svg b/editor/icons/icon_file_broken_big_thumb.svg new file mode 100644 index 0000000000..167bb1bb5f --- /dev/null +++ b/editor/icons/icon_file_broken_big_thumb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_file_dead_big_thumb.svg b/editor/icons/icon_file_dead_big_thumb.svg new file mode 100644 index 0000000000..c8aab912f1 --- /dev/null +++ b/editor/icons/icon_file_dead_big_thumb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_file_dead_medium_thumb.svg b/editor/icons/icon_file_dead_medium_thumb.svg new file mode 100644 index 0000000000..60a456a600 --- /dev/null +++ b/editor/icons/icon_file_dead_medium_thumb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_file_medium_thumb.svg b/editor/icons/icon_file_medium_thumb.svg new file mode 100644 index 0000000000..a143aa5c8f --- /dev/null +++ b/editor/icons/icon_file_medium_thumb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/editor/icons/icon_folder_big.svg b/editor/icons/icon_folder_big.svg deleted file mode 100644 index 1c0cd3584e..0000000000 --- a/editor/icons/icon_folder_big.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/editor/icons/icon_folder_big_thumb.svg b/editor/icons/icon_folder_big_thumb.svg new file mode 100644 index 0000000000..a7e830b019 --- /dev/null +++ b/editor/icons/icon_folder_big_thumb.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/editor/icons/icon_folder_medium_thumb.svg b/editor/icons/icon_folder_medium_thumb.svg new file mode 100644 index 0000000000..23b9ffc25c --- /dev/null +++ b/editor/icons/icon_folder_medium_thumb.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/editor/icons/icon_godot.svg b/editor/icons/icon_godot.svg index 32a1eeb6ec..b8bdfcc023 100644 --- a/editor/icons/icon_godot.svg +++ b/editor/icons/icon_godot.svg @@ -26,8 +26,5 @@ - - - diff --git a/editor/icons/icon_godot_docs.svg b/editor/icons/icon_godot_docs.svg new file mode 100644 index 0000000000..9caa09066d --- /dev/null +++ b/editor/icons/icon_godot_docs.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/editor/icons/icon_logo.svg b/editor/icons/icon_logo.svg new file mode 100644 index 0000000000..269fe1b245 --- /dev/null +++ b/editor/icons/icon_logo.svg @@ -0,0 +1,7 @@ + + + + + + + -- cgit v1.2.3 From 60f054d3acf5d629bc3ce0f10d7ead8f9c10f973 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 14:41:44 -0500 Subject: Improved VS node coloring --- editor/editor_themes.cpp | 8 +++++-- modules/visual_script/visual_script_editor.cpp | 32 ++++++++++++++++++-------- modules/visual_script/visual_script_editor.h | 1 + 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index f6eea296c0..bdfecfff10 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -171,6 +171,7 @@ void editor_register_and_generate_icons(Ref p_theme, bool dark_theme = tr } bool force_filter = !(p_thumb_size == 64 && p_thumb_size == 32); // we dont need filter with original resolution + // generate thumb files with the given thumb size if (p_thumb_size >= 64) { float scale = (float)p_thumb_size / 64.0 * EDSCALE; for (int i = 0; i < editor_bg_thumbs_count; i++) { @@ -350,7 +351,8 @@ Ref create_editor_theme(const Ref p_theme) { style_popup->set_default_margin(MARGIN_BOTTOM, default_margin_size * 2); style_popup->set_border_color_all(contrast_color_1); style_popup->set_border_width_all(MAX(EDSCALE, border_width)); - style_popup->set_shadow_color(Color(0, 0, 0, dark_theme ? 0.3 : 0.1)); + const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1); + style_popup->set_shadow_color(shadow_color); style_popup->set_shadow_size(4 * EDSCALE); Ref style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size); @@ -738,7 +740,9 @@ Ref create_editor_theme(const Ref p_theme) { graphsb->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width); Ref graphsbselected = make_flat_stylebox(Color(0, 0, 0, 0.4), 16, 24, 16, 5); graphsbselected->set_border_width_all(border_width); - graphsbselected->set_border_color_all(Color(1, 1, 1, 0.9)); + graphsbselected->set_border_color_all(Color(accent_color.r, accent_color.g, accent_color.b, 0.9)); + graphsbselected->set_shadow_size(8 * EDSCALE); + graphsbselected->set_shadow_color(shadow_color); graphsbselected->set_border_width(MARGIN_TOP, 22 * EDSCALE + border_width); Ref graphsbcomment = make_flat_stylebox(Color(0, 0, 0, 0.3), 16, 24, 16, 5); graphsbcomment->set_border_width_all(border_width); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 696a732d3d..d415618383 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -491,9 +491,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT); } - if (EditorSettings::get_singleton()->has("editors/visual_script/color_" + node->get_category())) { - Color c = EditorSettings::get_singleton()->get("editors/visual_script/color_" + node->get_category()); - gnode->set_self_modulate(c); + if (node_styles.has(node->get_category())) { + gnode->add_style_override("frame", node_styles[node->get_category()]); } gnode->set_meta("__vnode", node); @@ -2743,6 +2742,27 @@ void VisualScriptEditor::_notification(int p_what) { node_filter->add_icon_override("right_icon", Control::get_icon("Search", "EditorIcons")); variable_editor->connect("changed", this, "_update_members"); signal_editor->connect("changed", this, "_update_members"); + + List > colors; + colors.push_back(Pair("functions", Color(1, 0.9, 0.9))); + colors.push_back(Pair("data", Color(0.9, 1.0, 0.9))); + colors.push_back(Pair("operators", Color(0.9, 0.9, 1.0))); + colors.push_back(Pair("flow_control", Color(1.0, 1.0, 1.0))); + colors.push_back(Pair("custom", Color(0.8, 1.0, 1.0))); + colors.push_back(Pair("constants", Color(1.0, 0.8, 1.0))); + + for (List >::Element *E = colors.front(); E; E = E->next()) { + print_line(E->get().first); + Ref sb = EditorNode::get_singleton()->get_theme_base()->get_theme()->get_stylebox("frame", "GraphNode"); + if (sb != NULL) { + Ref frame_style = sb->duplicate(); + Color c = sb->get_border_color(MARGIN_TOP); + Color cn = E->get().second; + cn.a = c.a; + frame_style->set_border_color_all(cn); + node_styles[E->get().first] = frame_style; + } + } } if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { left_vsplit->set_visible(is_visible_in_tree()); @@ -3366,12 +3386,6 @@ void VisualScriptEditor::free_clipboard() { static void register_editor_callback() { ScriptEditor::register_create_script_editor_function(create_editor); - EditorSettings::get_singleton()->set("editors/visual_script/color_functions", Color(1, 0.9, 0.9)); - EditorSettings::get_singleton()->set("editors/visual_script/color_data", Color(0.9, 1.0, 0.9)); - EditorSettings::get_singleton()->set("editors/visual_script/color_operators", Color(0.9, 0.9, 1.0)); - EditorSettings::get_singleton()->set("editors/visual_script/color_flow_control", Color(1.0, 1.0, 1.0)); - EditorSettings::get_singleton()->set("editors/visual_script/color_custom", Color(0.8, 1.0, 1.0)); - EditorSettings::get_singleton()->set("editors/visual_script/color_constants", Color(1.0, 0.8, 1.0)); ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected")); ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 5b8c3ea74e..db54d10300 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -136,6 +136,7 @@ class VisualScriptEditor : public ScriptEditorBase { Vector > args; }; + HashMap, StringNameHasher> node_styles; StringName edited_func; void _update_graph_connections(); -- cgit v1.2.3 From 57fff67580981397420ab8be2b3121ca951f36b8 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 15:39:41 -0500 Subject: Fixed some inconsistent styles, plus some cleanup --- editor/editor_help.cpp | 10 ++++++---- editor/editor_help.h | 1 - editor/editor_log.cpp | 25 +++++-------------------- editor/editor_log.h | 3 --- editor/editor_themes.cpp | 12 +++++++++--- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 7fa2c53275..696eda2536 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1709,6 +1709,10 @@ void EditorHelp::_notification(int p_what) { //forward->set_icon(get_icon("Forward","EditorIcons")); //back->set_icon(get_icon("Back","EditorIcons")); _update_doc(); + + class_desc->add_style_override("normal", class_desc->get_stylebox("code_normal", "RichTextLabel")); + class_desc->add_style_override("focus", class_desc->get_stylebox("code_focus", "RichTextLabel")); + } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { @@ -1784,12 +1788,10 @@ EditorHelp::EditorHelp() { //class_list->set_selection_enabled(true); { - background_panel = memnew(Panel); - background_panel->set_v_size_flags(SIZE_EXPAND_FILL); - vbc->add_child(background_panel); class_desc = memnew(RichTextLabel); - background_panel->add_child(class_desc); + vbc->add_child(class_desc); class_desc->set_area_as_parent_rect(); + class_desc->set_v_size_flags(SIZE_EXPAND_FILL); class_desc->add_color_override("selection_color", EDITOR_DEF("text_editor/highlighting/selection_color", Color(0.2, 0.2, 1))); class_desc->connect("meta_clicked", this, "_class_desc_select"); class_desc->connect("gui_input", this, "_class_desc_input"); diff --git a/editor/editor_help.h b/editor/editor_help.h index 30a535a535..f937e4a723 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -130,7 +130,6 @@ class EditorHelp : public VBoxContainer { HSplitContainer *h_split; static DocData *doc; - Panel *background_panel; ConfirmationDialog *search_dialog; LineEdit *search; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 35291f8f9e..035819f503 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -61,9 +61,6 @@ void EditorLog::_notification(int p_what) { //button->set_icon(get_icon("Console","EditorIcons")); } - if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - _override_logger_styles(); - } /*if (p_what==NOTIFICATION_DRAW) { @@ -129,7 +126,6 @@ void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { void EditorLog::_bind_methods() { ClassDB::bind_method(D_METHOD("_clear_request"), &EditorLog::_clear_request); - ClassDB::bind_method("_override_logger_styles", &EditorLog::_override_logger_styles); //ClassDB::bind_method(D_METHOD("_dragged"),&EditorLog::_dragged ); ADD_SIGNAL(MethodInfo("clear_request")); } @@ -151,21 +147,15 @@ EditorLog::EditorLog() { clearbutton->set_text(TTR("Clear")); clearbutton->connect("pressed", this, "_clear_request"); - ec = memnew(Control); - vb->add_child(ec); - ec->set_custom_minimum_size(Size2(0, 180) * EDSCALE); - ec->set_v_size_flags(SIZE_EXPAND_FILL); - - pc = memnew(PanelContainer); - ec->add_child(pc); - pc->set_area_as_parent_rect(); - pc->connect("tree_entered", this, "_override_logger_styles"); - log = memnew(RichTextLabel); log->set_scroll_follow(true); log->set_selection_enabled(true); log->set_focus_mode(FOCUS_CLICK); - pc->add_child(log); + log->set_custom_minimum_size(Size2(0, 180) * EDSCALE); + log->set_area_as_parent_rect(); + log->set_v_size_flags(SIZE_EXPAND_FILL); + log->set_h_size_flags(SIZE_EXPAND_FILL); + vb->add_child(log); add_message(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur."); //log->add_text("Initialization Complete.\n"); //because it looks cool. @@ -183,10 +173,5 @@ void EditorLog::deinit() { remove_error_handler(&eh); } -void EditorLog::_override_logger_styles() { - - pc->add_style_override("panel", get_stylebox("normal", "TextEdit")); -} - EditorLog::~EditorLog() { } diff --git a/editor/editor_log.h b/editor/editor_log.h index fd919fd692..e551623140 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -50,8 +50,6 @@ class EditorLog : public VBoxContainer { RichTextLabel *log; HBoxContainer *title_hb; //PaneDrag *pd; - Control *ec; - PanelContainer *pc; static void _error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, ErrorHandlerType p_type); @@ -66,7 +64,6 @@ class EditorLog : public VBoxContainer { protected: static void _bind_methods(); void _notification(int p_what); - void _override_logger_styles(); public: void add_message(const String &p_msg, bool p_error = false); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index bdfecfff10..1903514ea6 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -698,6 +698,12 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("default_color", "RichTextLabel", rtl_font_color); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); + Ref style_code = style_tree_bg->duplicate(); + style_code->set_bg_color(rtl_combined_bg_color); + theme->set_stylebox("code_normal", "RichTextLabel", style_code); + Ref style_code_focus = style_tree_focus->duplicate(); + style_code_focus->set_bg_color(rtl_combined_bg_color); + theme->set_stylebox("code_focus", "RichTextLabel", style_code_focus); // Panel theme->set_stylebox("panel", "Panel", make_flat_stylebox(dark_color_1, 6, 4, 6, 4)); @@ -725,9 +731,9 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("font_color", "ProgressBar", font_color); // GraphEdit - theme->set_stylebox("bg", "GraphEdit", make_flat_stylebox(dark_color_2, 4, 4, 4, 4)); - theme->set_color("grid_major", "GraphEdit", Color(font_color.r, font_color.g, font_color.b, 0.2)); - theme->set_color("grid_minor", "GraphEdit", Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.2)); + theme->set_stylebox("bg", "GraphEdit", style_tree_bg); + theme->set_color("grid_major", "GraphEdit", Color(font_color.r, font_color.g, font_color.b, 0.1)); + theme->set_color("grid_minor", "GraphEdit", Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.05)); theme->set_icon("minus", "GraphEdit", theme->get_icon("ZoomLess", "EditorIcons")); theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons")); theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons")); -- cgit v1.2.3