diff options
Diffstat (limited to 'editor/editor_themes.cpp')
| -rw-r--r-- | editor/editor_themes.cpp | 92 |
1 files changed, 78 insertions, 14 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 98f0f70101..ca2a2ff1d6 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -913,6 +913,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { style_tab_disabled->set_bg_color(disabled_bg_color); style_tab_disabled->set_border_color(disabled_bg_color); + Ref<StyleBoxFlat> style_tab_focus = style_widget_focus->duplicate(); + // Editor background Color background_color_opaque = background_color; background_color_opaque.a = 1.0; @@ -949,7 +951,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { toolbar_stylebox->set_border_color(accent_color); toolbar_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); toolbar_stylebox->set_content_margin(SIDE_BOTTOM, 0); - toolbar_stylebox->set_expand_margin_all(2 * EDSCALE); + toolbar_stylebox->set_expand_margin_individual(4 * EDSCALE, 2 * EDSCALE, 4 * EDSCALE, 4 * EDSCALE); theme->set_stylebox("ContextualToolbar", EditorStringName(EditorStyles), toolbar_stylebox); // Script Editor @@ -1020,6 +1022,30 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("h_separation", "Button", 4 * EDSCALE); theme->set_constant("outline_size", "Button", 0); + // Flat button variations. + + Ref<StyleBoxEmpty> style_flat_button = make_empty_stylebox(); + for (int i = 0; i < 4; i++) { + style_flat_button->set_content_margin((Side)i, style_widget->get_margin((Side)i) + style_widget->get_border_width((Side)i)); + } + + Ref<StyleBoxFlat> style_flat_button_pressed = style_widget_pressed->duplicate(); + Color flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.8, 0.8, 0.8, 0.85); + if (dark_theme) { + flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.6, 0.6, 0.6, 0.85); + } + style_flat_button_pressed->set_bg_color(flat_pressed_color); + + theme->set_stylebox("normal", "FlatButton", style_flat_button); + theme->set_stylebox("hover", "FlatButton", style_flat_button); + theme->set_stylebox("pressed", "FlatButton", style_flat_button_pressed); + theme->set_stylebox("disabled", "FlatButton", style_flat_button); + + theme->set_stylebox("normal", "FlatMenuButton", style_flat_button); + theme->set_stylebox("hover", "FlatMenuButton", style_flat_button); + theme->set_stylebox("pressed", "FlatMenuButton", style_flat_button_pressed); + theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button); + const float ACTION_BUTTON_EXTRA_MARGIN = 32 * EDSCALE; theme->set_type_variation("InspectorActionButton", "Button"); @@ -1536,10 +1562,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("tab_hovered", "TabContainer", style_tab_hovered); theme->set_stylebox("tab_unselected", "TabContainer", style_tab_unselected); theme->set_stylebox("tab_disabled", "TabContainer", style_tab_disabled); + theme->set_stylebox("tab_focus", "TabContainer", style_tab_focus); theme->set_stylebox("tab_selected", "TabBar", style_tab_selected); theme->set_stylebox("tab_hovered", "TabBar", style_tab_hovered); theme->set_stylebox("tab_unselected", "TabBar", style_tab_unselected); theme->set_stylebox("tab_disabled", "TabBar", style_tab_disabled); + theme->set_stylebox("tab_focus", "TabBar", style_tab_focus); theme->set_stylebox("button_pressed", "TabBar", style_menu); theme->set_stylebox("button_highlight", "TabBar", style_menu); theme->set_color("font_selected_color", "TabContainer", font_color); @@ -2014,17 +2042,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { graphn_sb_titlebar_selected->set_expand_margin(SIDE_TOP, 2 * EDSCALE); Ref<StyleBoxEmpty> graphn_sb_slot = make_empty_stylebox(12, 0, 12, 0); - // StateMachine. - const int sm_margin_side = 10; - Ref<StyleBoxFlat> smgraphsb = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), sm_margin_side, 24, sm_margin_side, gn_margin_bottom, corner_width); - smgraphsb->set_border_width_all(border_width); - smgraphsb->set_border_color(graphnode_bg); - Ref<StyleBoxFlat> smgraphsbselected = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.9), sm_margin_side, 24, sm_margin_side, gn_margin_bottom, corner_width); - smgraphsbselected->set_border_width_all(2 * EDSCALE + border_width); - smgraphsbselected->set_border_color(Color(accent_color.r, accent_color.g, accent_color.b, 0.9)); - smgraphsbselected->set_shadow_size(8 * EDSCALE); - smgraphsbselected->set_shadow_color(shadow_color); - theme->set_stylebox("panel", "GraphElement", graphn_sb_panel); theme->set_stylebox("panel_selected", "GraphElement", graphn_sb_panel_selected); theme->set_stylebox("titlebar", "GraphElement", graphn_sb_titlebar); @@ -2059,8 +2076,55 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { port_icon->set_size_override(Size2(12, 12)); theme->set_icon("port", "GraphNode", port_icon); - theme->set_stylebox("state_machine_frame", "GraphNode", smgraphsb); - theme->set_stylebox("state_machine_selected_frame", "GraphNode", smgraphsbselected); + // StateMachine graph + theme->set_stylebox("panel", "GraphStateMachine", style_tree_bg); + theme->set_stylebox("error_panel", "GraphStateMachine", style_tree_bg); + theme->set_color("error_color", "GraphStateMachine", error_color); + + const int sm_margin_side = 10 * EDSCALE; + + Ref<StyleBoxFlat> sm_node_style = make_flat_stylebox(dark_color_3 * Color(1, 1, 1, 0.7), sm_margin_side, 24 * EDSCALE, sm_margin_side, gn_margin_bottom, corner_width); + sm_node_style->set_border_width_all(border_width); + sm_node_style->set_border_color(graphnode_bg); + + Ref<StyleBoxFlat> sm_node_selected_style = make_flat_stylebox(graphnode_bg * Color(1, 1, 1, 0.9), sm_margin_side, 24 * EDSCALE, sm_margin_side, gn_margin_bottom, corner_width); + sm_node_selected_style->set_border_width_all(2 * EDSCALE + border_width); + sm_node_selected_style->set_border_color(accent_color * Color(1, 1, 1, 0.9)); + sm_node_selected_style->set_shadow_size(8 * EDSCALE); + sm_node_selected_style->set_shadow_color(shadow_color); + + Ref<StyleBoxFlat> sm_node_playing_style = sm_node_selected_style->duplicate(); + sm_node_playing_style->set_border_color(warning_color); + sm_node_playing_style->set_shadow_color(warning_color * Color(1, 1, 1, 0.2)); + + theme->set_stylebox("node_frame", "GraphStateMachine", sm_node_style); + theme->set_stylebox("node_frame_selected", "GraphStateMachine", sm_node_selected_style); + theme->set_stylebox("node_frame_playing", "GraphStateMachine", sm_node_playing_style); + + Ref<StyleBoxFlat> sm_node_start_style = sm_node_style->duplicate(); + sm_node_start_style->set_border_width_all(1 * EDSCALE); + sm_node_start_style->set_border_color(success_color.lightened(0.24)); + theme->set_stylebox("node_frame_start", "GraphStateMachine", sm_node_start_style); + + Ref<StyleBoxFlat> sm_node_end_style = sm_node_style->duplicate(); + sm_node_end_style->set_border_width_all(1 * EDSCALE); + sm_node_end_style->set_border_color(error_color); + theme->set_stylebox("node_frame_end", "GraphStateMachine", sm_node_end_style); + + theme->set_font("node_title_font", "GraphStateMachine", theme->get_font(SNAME("font"), SNAME("Label"))); + theme->set_font_size("node_title_font_size", "GraphStateMachine", theme->get_font_size(SNAME("font_size"), SNAME("Label"))); + theme->set_color("node_title_font_color", "GraphStateMachine", font_color); + + theme->set_color("transition_color", "GraphStateMachine", font_color); + theme->set_color("transition_disabled_color", "GraphStateMachine", font_color * Color(1, 1, 1, 0.2)); + theme->set_color("transition_icon_color", "GraphStateMachine", Color(1, 1, 1)); + theme->set_color("transition_icon_disabled_color", "GraphStateMachine", Color(1, 1, 1, 0.2)); + theme->set_color("highlight_color", "GraphStateMachine", accent_color); + theme->set_color("highlight_disabled_color", "GraphStateMachine", accent_color * Color(1, 1, 1, 0.6)); + theme->set_color("guideline_color", "GraphStateMachine", font_color * Color(1, 1, 1, 0.3)); + + theme->set_color("playback_color", "GraphStateMachine", font_color); + theme->set_color("playback_background_color", "GraphStateMachine", font_color * Color(1, 1, 1, 0.3)); // GridContainer theme->set_constant("v_separation", "GridContainer", Math::round(widget_default_margin.y - 2 * EDSCALE)); |
