summaryrefslogtreecommitdiff
path: root/editor/editor_themes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_themes.cpp')
-rw-r--r--editor/editor_themes.cpp196
1 files changed, 130 insertions, 66 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 79525ced51..0d24d5013d 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -44,34 +44,34 @@
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture2D> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
style->set_texture(p_texture);
- style->set_margin_size(MARGIN_LEFT, p_left * EDSCALE);
- style->set_margin_size(MARGIN_RIGHT, p_right * EDSCALE);
- style->set_margin_size(MARGIN_BOTTOM, p_botton * EDSCALE);
- style->set_margin_size(MARGIN_TOP, p_top * EDSCALE);
- style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
- style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
- style->set_default_margin(MARGIN_BOTTOM, p_margin_botton * EDSCALE);
- style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ style->set_margin_size(SIDE_LEFT, p_left * EDSCALE);
+ style->set_margin_size(SIDE_RIGHT, p_right * EDSCALE);
+ style->set_margin_size(SIDE_BOTTOM, p_botton * EDSCALE);
+ style->set_margin_size(SIDE_TOP, p_top * EDSCALE);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_botton * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
style->set_draw_center(p_draw_center);
return style;
}
static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
Ref<StyleBoxEmpty> style(memnew(StyleBoxEmpty));
- style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
- style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
- style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE);
- style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
return style;
}
static Ref<StyleBoxFlat> make_flat_stylebox(Color p_color, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_bottom = -1) {
Ref<StyleBoxFlat> style(memnew(StyleBoxFlat));
style->set_bg_color(p_color);
- style->set_default_margin(MARGIN_LEFT, p_margin_left * EDSCALE);
- style->set_default_margin(MARGIN_RIGHT, p_margin_right * EDSCALE);
- style->set_default_margin(MARGIN_BOTTOM, p_margin_bottom * EDSCALE);
- style->set_default_margin(MARGIN_TOP, p_margin_top * EDSCALE);
+ style->set_default_margin(SIDE_LEFT, p_margin_left * EDSCALE);
+ style->set_default_margin(SIDE_RIGHT, p_margin_right * EDSCALE);
+ style->set_default_margin(SIDE_BOTTOM, p_margin_bottom * EDSCALE);
+ style->set_default_margin(SIDE_TOP, p_margin_top * EDSCALE);
return style;
}
@@ -85,6 +85,25 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1,
return style;
}
+static Ref<Texture2D> flip_icon(Ref<Texture2D> p_texture, bool p_flip_y = false, bool p_flip_x = false) {
+ if (!p_flip_y && !p_flip_x) {
+ return p_texture;
+ }
+
+ Ref<ImageTexture> texture(memnew(ImageTexture));
+ Ref<Image> img = p_texture->get_data();
+
+ if (p_flip_y) {
+ img->flip_y();
+ }
+ if (p_flip_x) {
+ img->flip_x();
+ }
+
+ texture->create_from_image(img);
+ return texture;
+}
+
#ifdef MODULE_SVG_ENABLED
static Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) {
Ref<ImageTexture> icon = memnew(ImageTexture);
@@ -441,7 +460,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Highlighted tabs and border width
Color tab_color = highlight_tabs ? base_color.lerp(font_color, contrast) : base_color;
- const int border_width = CLAMP(border_size, 0, 3) * EDSCALE;
+ // Ensure borders are visible when using an editor scale below 100%.
+ const int border_width = CLAMP(border_size, 0, 3) * MAX(1, EDSCALE);
const int default_margin_size = 4;
const int margin_size_extra = default_margin_size + CLAMP(border_size, 0, 3);
@@ -457,10 +477,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float extra_spacing = EDITOR_GET("interface/theme/additional_spacing");
Ref<StyleBoxFlat> style_widget = style_default->duplicate();
- style_widget->set_default_margin(MARGIN_LEFT, (extra_spacing + 6) * EDSCALE);
- style_widget->set_default_margin(MARGIN_TOP, (extra_spacing + default_margin_size) * EDSCALE);
- style_widget->set_default_margin(MARGIN_RIGHT, (extra_spacing + 6) * EDSCALE);
- style_widget->set_default_margin(MARGIN_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE);
+ style_widget->set_default_margin(SIDE_LEFT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(SIDE_TOP, (extra_spacing + default_margin_size) * EDSCALE);
+ style_widget->set_default_margin(SIDE_RIGHT, (extra_spacing + 6) * EDSCALE);
+ style_widget->set_default_margin(SIDE_BOTTOM, (extra_spacing + default_margin_size) * EDSCALE);
style_widget->set_bg_color(dark_color_1);
style_widget->set_border_color(dark_color_2);
@@ -480,10 +500,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// style for windows, popups, etc..
Ref<StyleBoxFlat> style_popup = style_default->duplicate();
const int popup_margin_size = default_margin_size * EDSCALE * 2;
- style_popup->set_default_margin(MARGIN_LEFT, popup_margin_size);
- style_popup->set_default_margin(MARGIN_TOP, popup_margin_size);
- style_popup->set_default_margin(MARGIN_RIGHT, popup_margin_size);
- style_popup->set_default_margin(MARGIN_BOTTOM, popup_margin_size);
+ style_popup->set_default_margin(SIDE_LEFT, popup_margin_size);
+ style_popup->set_default_margin(SIDE_TOP, popup_margin_size);
+ style_popup->set_default_margin(SIDE_RIGHT, popup_margin_size);
+ style_popup->set_default_margin(SIDE_BOTTOM, popup_margin_size);
style_popup->set_border_color(contrast_color_1);
style_popup->set_border_width_all(MAX(EDSCALE, border_width));
const Color shadow_color = Color(0, 0, 0, dark_theme ? 0.3 : 0.1);
@@ -516,13 +536,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate();
style_tab_selected->set_border_width_all(border_width);
- style_tab_selected->set_border_width(MARGIN_BOTTOM, 0);
+ style_tab_selected->set_border_width(SIDE_BOTTOM, 0);
style_tab_selected->set_border_color(dark_color_3);
- style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width);
- style_tab_selected->set_default_margin(MARGIN_LEFT, tab_default_margin_side);
- style_tab_selected->set_default_margin(MARGIN_RIGHT, tab_default_margin_side);
- style_tab_selected->set_default_margin(MARGIN_BOTTOM, tab_default_margin_vertical);
- style_tab_selected->set_default_margin(MARGIN_TOP, tab_default_margin_vertical);
+ style_tab_selected->set_expand_margin_size(SIDE_BOTTOM, border_width);
+ style_tab_selected->set_default_margin(SIDE_LEFT, tab_default_margin_side);
+ style_tab_selected->set_default_margin(SIDE_RIGHT, tab_default_margin_side);
+ style_tab_selected->set_default_margin(SIDE_BOTTOM, tab_default_margin_vertical);
+ style_tab_selected->set_default_margin(SIDE_TOP, tab_default_margin_vertical);
style_tab_selected->set_bg_color(tab_color);
Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate();
@@ -560,7 +580,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Ref<StyleBoxFlat> style_menu_hover_border = style_widget->duplicate();
style_menu_hover_border->set_draw_center(false);
style_menu_hover_border->set_border_width_all(0);
- style_menu_hover_border->set_border_width(MARGIN_BOTTOM, border_width);
+ style_menu_hover_border->set_border_width(SIDE_BOTTOM, border_width);
style_menu_hover_border->set_border_color(accent_color);
Ref<StyleBoxFlat> style_menu_hover_bg = style_widget->duplicate();
@@ -599,12 +619,18 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("icon_color_pressed", "Button", icon_color_pressed);
// OptionButton
+ theme->set_stylebox("focus", "OptionButton", style_widget_focus);
+
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_stylebox("normal_mirrored", "OptionButton", style_widget);
+ theme->set_stylebox("hover_mirrored", "OptionButton", style_widget_hover);
+ theme->set_stylebox("pressed_mirrored", "OptionButton", style_widget_pressed);
+ theme->set_stylebox("disabled_mirrored", "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);
@@ -626,6 +652,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("off", "CheckButton", theme->get_icon("GuiToggleOff", "EditorIcons"));
theme->set_icon("off_disabled", "CheckButton", theme->get_icon("GuiToggleOffDisabled", "EditorIcons"));
+ theme->set_icon("on_mirrored", "CheckButton", theme->get_icon("GuiToggleOnMirrored", "EditorIcons"));
+ theme->set_icon("on_disabled_mirrored", "CheckButton", theme->get_icon("GuiToggleOnDisabledMirrored", "EditorIcons"));
+ theme->set_icon("off_mirrored", "CheckButton", theme->get_icon("GuiToggleOffMirrored", "EditorIcons"));
+ theme->set_icon("off_disabled_mirrored", "CheckButton", theme->get_icon("GuiToggleOffDisabledMirrored", "EditorIcons"));
+
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);
@@ -637,10 +668,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Checkbox
Ref<StyleBoxFlat> sb_checkbox = style_menu->duplicate();
- sb_checkbox->set_default_margin(MARGIN_LEFT, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_RIGHT, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
- sb_checkbox->set_default_margin(MARGIN_BOTTOM, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_LEFT, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_RIGHT, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ sb_checkbox->set_default_margin(SIDE_BOTTOM, default_margin_size * EDSCALE);
theme->set_stylebox("normal", "CheckBox", sb_checkbox);
theme->set_stylebox("pressed", "CheckBox", sb_checkbox);
@@ -664,7 +695,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("panel", "PopupDialog", style_popup);
// PopupMenu
- theme->set_stylebox("panel", "PopupMenu", style_popup);
+ const int popup_menu_margin_size = default_margin_size * 1.5 * EDSCALE;
+ Ref<StyleBoxFlat> style_popup_menu = style_popup->duplicate();
+ style_popup_menu->set_default_margin(SIDE_LEFT, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_TOP, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_RIGHT, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_BOTTOM, popup_menu_margin_size);
+
+ theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
theme->set_stylebox("separator", "PopupMenu", style_popup_separator);
theme->set_stylebox("labeled_separator_left", "PopupMenu", style_popup_labeled_separator_left);
theme->set_stylebox("labeled_separator_right", "PopupMenu", style_popup_labeled_separator_right);
@@ -673,20 +711,22 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
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_color("font_color_separator", "PopupMenu", font_color_disabled);
theme->set_icon("checked", "PopupMenu", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "PopupMenu", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("radio_checked", "PopupMenu", theme->get_icon("GuiRadioChecked", "EditorIcons"));
theme->set_icon("radio_unchecked", "PopupMenu", theme->get_icon("GuiRadioUnchecked", "EditorIcons"));
theme->set_icon("submenu", "PopupMenu", theme->get_icon("ArrowRight", "EditorIcons"));
+ theme->set_icon("submenu_mirrored", "PopupMenu", theme->get_icon("ArrowLeft", "EditorIcons"));
theme->set_icon("visibility_hidden", "PopupMenu", theme->get_icon("GuiVisibilityHidden", "EditorIcons"));
theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon("GuiVisibilityVisible", "EditorIcons"));
theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon("GuiVisibilityXray", "EditorIcons"));
theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE);
Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1.lerp(accent_color, 0.08), 2, 0, 2, 2);
- sub_inspector_bg->set_border_width(MARGIN_LEFT, 2);
- sub_inspector_bg->set_border_width(MARGIN_RIGHT, 2);
- sub_inspector_bg->set_border_width(MARGIN_BOTTOM, 2);
+ sub_inspector_bg->set_border_width(SIDE_LEFT, 2);
+ sub_inspector_bg->set_border_width(SIDE_RIGHT, 2);
+ sub_inspector_bg->set_border_width(SIDE_BOTTOM, 2);
sub_inspector_bg->set_border_color(accent_color * Color(1, 1, 1, 0.3));
sub_inspector_bg->set_draw_center(true);
@@ -706,6 +746,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons"));
theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
+ theme->set_icon("arrow_collapsed_mirrored", "Tree", theme->get_icon("GuiTreeArrowLeft", "EditorIcons"));
theme->set_icon("updown", "Tree", theme->get_icon("GuiTreeUpdown", "EditorIcons"));
theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons"));
theme->set_stylebox("bg_focus", "Tree", style_focus);
@@ -825,17 +866,17 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
style_content_panel->set_border_color(dark_color_3);
style_content_panel->set_border_width_all(border_width);
// compensate the border
- style_content_panel->set_default_margin(MARGIN_TOP, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_RIGHT, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_BOTTOM, margin_size_extra * EDSCALE);
- style_content_panel->set_default_margin(MARGIN_LEFT, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_TOP, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_RIGHT, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_BOTTOM, margin_size_extra * EDSCALE);
+ style_content_panel->set_default_margin(SIDE_LEFT, margin_size_extra * EDSCALE);
// this is the stylebox used in 3d and 2d viewports (no borders)
Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width * 2);
- style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size * EDSCALE);
- style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width * 2);
- style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_LEFT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_TOP, default_margin_size * EDSCALE);
+ style_content_panel_vp->set_default_margin(SIDE_RIGHT, border_width * 2);
+ style_content_panel_vp->set_default_margin(SIDE_BOTTOM, border_width * 2);
theme->set_stylebox("panel", "TabContainer", style_content_panel);
theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
@@ -846,13 +887,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Debugger
Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate();
- style_panel_debugger->set_border_width(MARGIN_BOTTOM, 0);
+ style_panel_debugger->set_border_width(SIDE_BOTTOM, 0);
theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger);
Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate();
- int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height() + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(MARGIN_TOP);
- style_panel_invisible_top->set_expand_margin_size(MARGIN_TOP, -stylebox_offset);
- style_panel_invisible_top->set_default_margin(MARGIN_TOP, 0);
+ int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height(theme->get_font_size("tab_fg", "TabContainer")) + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(SIDE_TOP);
+ style_panel_invisible_top->set_expand_margin_size(SIDE_TOP, -stylebox_offset);
+ style_panel_invisible_top->set_default_margin(SIDE_TOP, 0);
theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top);
// LineEdit
@@ -917,8 +958,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// WindowDialog
Ref<StyleBoxFlat> style_window = style_popup->duplicate();
style_window->set_border_color(tab_color);
- style_window->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- style_window->set_expand_margin_size(MARGIN_TOP, 24 * EDSCALE);
+ style_window->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ style_window->set_expand_margin_size(SIDE_TOP, 24 * EDSCALE);
theme->set_stylebox("panel", "Window", style_default);
theme->set_stylebox("panel_window", "Window", style_window);
@@ -930,6 +971,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_constant("title_height", "Window", 24 * EDSCALE);
theme->set_constant("resize_margin", "Window", 4 * EDSCALE);
theme->set_font("title_font", "Window", theme->get_font("title", "EditorFonts"));
+ theme->set_font_size("title_font_size", "Window", theme->get_font_size("title_size", "EditorFonts"));
// complex window, for now only Editor settings and Project settings
Ref<StyleBoxFlat> style_complex_window = style_window->duplicate();
@@ -1013,10 +1055,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
float v = MAX(border_size * EDSCALE, 1.0);
- style_tooltip->set_default_margin(MARGIN_LEFT, v);
- style_tooltip->set_default_margin(MARGIN_TOP, v);
- style_tooltip->set_default_margin(MARGIN_RIGHT, v);
- style_tooltip->set_default_margin(MARGIN_BOTTOM, v);
+ style_tooltip->set_default_margin(SIDE_LEFT, v);
+ style_tooltip->set_default_margin(SIDE_TOP, v);
+ style_tooltip->set_default_margin(SIDE_RIGHT, v);
+ style_tooltip->set_default_margin(SIDE_BOTTOM, v);
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(mono_color);
@@ -1051,11 +1093,33 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("more", "GraphEdit", theme->get_icon("ZoomMore", "EditorIcons"));
theme->set_icon("reset", "GraphEdit", theme->get_icon("ZoomReset", "EditorIcons"));
theme->set_icon("snap", "GraphEdit", theme->get_icon("SnapGrid", "EditorIcons"));
+ theme->set_icon("minimap", "GraphEdit", theme->get_icon("GridMinimap", "EditorIcons"));
theme->set_constant("bezier_len_pos", "GraphEdit", 80 * EDSCALE);
theme->set_constant("bezier_len_neg", "GraphEdit", 160 * EDSCALE);
- // GraphNode
+ // GraphEditMinimap
+ theme->set_stylebox("bg", "GraphEditMinimap", make_flat_stylebox(dark_color_1, 0, 0, 0, 0));
+ Ref<StyleBoxFlat> style_minimap_camera;
+ Ref<StyleBoxFlat> style_minimap_node;
+ if (dark_theme) {
+ style_minimap_camera = make_flat_stylebox(Color(0.65, 0.65, 0.65, 0.2), 0, 0, 0, 0);
+ style_minimap_camera->set_border_color(Color(0.65, 0.65, 0.65, 0.45));
+ style_minimap_node = make_flat_stylebox(Color(1, 1, 1), 0, 0, 0, 0);
+ } else {
+ style_minimap_camera = make_flat_stylebox(Color(0.38, 0.38, 0.38, 0.2), 0, 0, 0, 0);
+ style_minimap_camera->set_border_color(Color(0.38, 0.38, 0.38, 0.45));
+ style_minimap_node = make_flat_stylebox(Color(0, 0, 0), 0, 0, 0, 0);
+ }
+ style_minimap_camera->set_border_width_all(1);
+ style_minimap_node->set_corner_radius_all(1);
+ theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera);
+ theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node);
+ Ref<Texture2D> resizer_icon = theme->get_icon("GuiResizer", "EditorIcons");
+ theme->set_icon("resizer", "GraphEditMinimap", flip_icon(resizer_icon, true, true));
+ theme->set_color("resizer_color", "GraphEditMinimap", Color(1, 1, 1, 0.65));
+
+ // GraphNode
const float mv = dark_theme ? 0.0 : 1.0;
const float mv2 = 1.0 - mv;
const int gn_margin_side = 28;
@@ -1091,10 +1155,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
smgraphsbselected->set_shadow_color(shadow_color);
if (use_gn_headers) {
- graphsb->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbcomment->set_border_width(MARGIN_TOP, 24 * EDSCALE);
- graphsbcommentselected->set_border_width(MARGIN_TOP, 24 * EDSCALE);
+ graphsb->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbselected->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbcomment->set_border_width(SIDE_TOP, 24 * EDSCALE);
+ graphsbcommentselected->set_border_width(SIDE_TOP, 24 * EDSCALE);
}
theme->set_stylebox("frame", "GraphNode", graphsb);