| 1 | /**************************************************************************/ |
| 2 | /* theme_modern.cpp */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #include "theme_modern.h" |
| 32 | |
| 33 | #include "core/math/math_defs.h" |
| 34 | #include "editor/editor_string_names.h" |
| 35 | #include "editor/settings/editor_settings.h" |
| 36 | #include "editor/themes/editor_scale.h" |
| 37 | #include "editor/themes/editor_theme_manager.h" |
| 38 | #include "scene/gui/graph_edit.h" |
| 39 | #include "scene/resources/dpi_texture.h" |
| 40 | #include "scene/resources/image_texture.h" |
| 41 | #include "scene/resources/style_box_flat.h" |
| 42 | #include "scene/resources/style_box_line.h" |
| 43 | |
| 44 | // Helper. |
| 45 | static Color _get_base_color(EditorThemeManager::ThemeConfiguration &p_config, float p_dimness_ofs = 0.0, float p_saturation_mult = 1.0) { |
| 46 | Color color = p_config.base_color; |
| 47 | const float final_contrast = (p_dimness_ofs < 0) ? CLAMP(p_config.contrast, -0.1, 0.5) : p_config.contrast; |
| 48 | color.set_v(CLAMP(Math::lerp(color.get_v(), 0, final_contrast * p_dimness_ofs), 0, 1)); |
| 49 | color.set_s(color.get_s() * p_saturation_mult); |
| 50 | return color; |
| 51 | } |
| 52 | |
| 53 | void ThemeModern::populate_shared_styles(const Ref<EditorTheme> &p_theme, EditorThemeManager::ThemeConfiguration &p_config) { |
| 54 | // Colors. |
| 55 | { |
| 56 | // Base colors. |
| 57 | |
| 58 | p_theme->set_color("base_color", EditorStringName(Editor), p_config.base_color); |
| 59 | p_theme->set_color("accent_color", EditorStringName(Editor), p_config.accent_color); |
| 60 | |
| 61 | // White (dark theme) or black (light theme), will be used to generate the rest of the colors |
| 62 | p_config.mono_color = p_config.dark_theme ? Color(1, 1, 1) : Color(0, 0, 0); |
| 63 | p_config.mono_color_font = p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(0, 0, 0); |
| 64 | p_config.mono_color_inv = p_config.dark_theme ? Color(0, 0, 0) : Color(1, 1, 1); |
| 65 | |
| 66 | // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues. |
| 67 | // Some places in the editor use 8-bit integer colors. |
| 68 | p_config.dark_color_1 = p_config.base_color.lerp(Color(0, 0, 0, 1), p_config.contrast * 1.15).clamp(); |
| 69 | p_config.dark_color_2 = p_config.dark_theme ? Color(0, 0, 0, 0.3) : Color(1, 1, 1, 0.3); |
| 70 | p_config.dark_color_3 = _get_base_color(p_config, 0.8, 0.9); |
| 71 | |
| 72 | p_config.contrast_color_1 = p_config.base_color.lerp(p_config.mono_color, MAX(p_config.contrast * 1.15, p_config.default_contrast * 1.15)); |
| 73 | p_config.contrast_color_2 = p_config.base_color.lerp(p_config.mono_color, MAX(p_config.contrast * 1.725, p_config.default_contrast * 1.725)); |
| 74 | |
| 75 | p_config.highlight_color = Color(p_config.accent_color.r, p_config.accent_color.g, p_config.accent_color.b, 0.275); |
| 76 | p_config.highlight_disabled_color = p_config.highlight_color.lerp(p_config.dark_theme ? Color(0, 0, 0) : Color(1, 1, 1), 0.5); |
| 77 | |
| 78 | p_config.success_color = Color(0.45, 0.95, 0.5); |
| 79 | p_config.warning_color = Color(0.83, 0.78, 0.62); |
| 80 | p_config.error_color = Color(1, 0.47, 0.42); |
| 81 | |
| 82 | // Keep dark theme colors accessible for use in the frame time gradient in the 3D editor. |
| 83 | // This frame time gradient is used to colorize text for a dark background, so it should keep using bright colors |
| 84 | // even when using a light theme. |
| 85 | p_theme->set_color("success_color_dark_background", EditorStringName(Editor), p_config.success_color); |
| 86 | p_theme->set_color("warning_color_dark_background", EditorStringName(Editor), p_config.warning_color); |
| 87 | p_theme->set_color("error_color_dark_background", EditorStringName(Editor), p_config.error_color); |
| 88 | |
| 89 | if (!p_config.dark_icon_and_font) { |
| 90 | // Darken some colors to be readable on a light background. |
| 91 | p_config.success_color = p_config.success_color.lerp(p_config.mono_color_font, 0.35); |
| 92 | p_config.warning_color = Color(0.83, 0.49, 0.01); |
| 93 | p_config.error_color = Color(0.8, 0.22, 0.22); |
| 94 | } |
| 95 | |
| 96 | p_theme->set_color("mono_color", EditorStringName(Editor), p_config.mono_color); |
| 97 | p_theme->set_color("dark_color_1", EditorStringName(Editor), p_config.dark_color_1); |
| 98 | p_theme->set_color("dark_color_2", EditorStringName(Editor), p_config.dark_color_2); |
| 99 | p_theme->set_color("dark_color_3", EditorStringName(Editor), p_config.dark_color_3); |
| 100 | p_theme->set_color("contrast_color_1", EditorStringName(Editor), p_config.contrast_color_1); |
| 101 | p_theme->set_color("contrast_color_2", EditorStringName(Editor), p_config.contrast_color_2); |
| 102 | p_theme->set_color("highlight_color", EditorStringName(Editor), p_config.highlight_color); |
| 103 | p_theme->set_color("highlight_disabled_color", EditorStringName(Editor), p_config.highlight_disabled_color); |
| 104 | p_theme->set_color("success_color", EditorStringName(Editor), p_config.success_color); |
| 105 | p_theme->set_color("warning_color", EditorStringName(Editor), p_config.warning_color); |
| 106 | p_theme->set_color("error_color", EditorStringName(Editor), p_config.error_color); |
| 107 | p_theme->set_color("ruler_color", EditorStringName(Editor), p_config.base_color.lerp(p_config.mono_color_inv, 0.3) * Color(1, 1, 1, 0.8)); |
| 108 | #ifndef DISABLE_DEPRECATED // Used before 4.3. |
| 109 | p_theme->set_color("disabled_highlight_color", EditorStringName(Editor), p_config.highlight_disabled_color); |
| 110 | #endif |
| 111 | |
| 112 | // Only used when the Draw Extra Borders editor setting is enabled. |
| 113 | p_config.extra_border_color_1 = p_config.dark_theme ? Color(1, 1, 1, 0.4) : Color(0, 0, 0, 0.4); |
| 114 | p_config.extra_border_color_2 = p_config.dark_theme ? Color(1, 1, 1, 0.2) : Color(0, 0, 0, 0.2); |
| 115 | |
| 116 | p_theme->set_color("extra_border_color_1", EditorStringName(Editor), p_config.extra_border_color_1); |
| 117 | p_theme->set_color("extra_border_color_2", EditorStringName(Editor), p_config.extra_border_color_2); |
| 118 | |
| 119 | // Font colors. |
| 120 | |
| 121 | p_config.font_color = p_config.mono_color_font * Color(1, 1, 1, 0.75); |
| 122 | p_config.font_secondary_color = p_config.mono_color_font * Color(1, 1, 1, 0.55); |
| 123 | p_config.font_focus_color = p_config.mono_color_font; |
| 124 | p_config.font_hover_color = p_config.mono_color_font * Color(1, 1, 1, 0.85); |
| 125 | p_config.font_pressed_color = p_config.mono_color_font * Color(1, 1, 1, 0.85); |
| 126 | p_config.font_hover_pressed_color = p_config.mono_color_font; |
| 127 | p_config.font_disabled_color = p_config.mono_color_font * Color(1, 1, 1, p_config.dark_icon_and_font ? 0.35 : 0.5); |
| 128 | p_config.font_readonly_color = Color(p_config.mono_color_font.r, p_config.mono_color_font.g, p_config.mono_color_font.b, 0.65); |
| 129 | p_config.font_placeholder_color = p_config.font_disabled_color; |
| 130 | p_config.font_outline_color = Color(1, 1, 1, 0); |
| 131 | |
| 132 | // Colors designed for dark backgrounds, even when using a light theme. |
| 133 | // This is used for 3D editor overlay texts. |
| 134 | if (p_config.dark_theme) { |
| 135 | p_config.font_dark_background_color = p_config.font_color; |
| 136 | p_config.font_dark_background_focus_color = p_config.font_focus_color; |
| 137 | p_config.font_dark_background_hover_color = p_config.font_hover_color; |
| 138 | p_config.font_dark_background_pressed_color = p_config.font_pressed_color; |
| 139 | p_config.font_dark_background_hover_pressed_color = p_config.font_hover_pressed_color; |
| 140 | } else { |
| 141 | p_config.font_dark_background_color = p_config.mono_color.inverted().lerp(p_config.base_color, 0.75); |
| 142 | p_config.font_dark_background_focus_color = p_config.mono_color.inverted().lerp(p_config.base_color, 0.25); |
| 143 | p_config.font_dark_background_hover_color = p_config.mono_color.inverted().lerp(p_config.base_color, 0.25); |
| 144 | p_config.font_dark_background_pressed_color = p_config.font_dark_background_color.lerp(p_config.accent_color, 0.74); |
| 145 | p_config.font_dark_background_hover_pressed_color = p_config.font_dark_background_color.lerp(p_config.accent_color, 0.5); |
| 146 | } |
| 147 | |
| 148 | p_theme->set_color(SceneStringName(font_color), EditorStringName(Editor), p_config.font_color); |
| 149 | p_theme->set_color("font_focus_color", EditorStringName(Editor), p_config.font_focus_color); |
| 150 | p_theme->set_color("font_hover_color", EditorStringName(Editor), p_config.font_hover_color); |
| 151 | p_theme->set_color("font_pressed_color", EditorStringName(Editor), p_config.font_pressed_color); |
| 152 | p_theme->set_color("font_hover_pressed_color", EditorStringName(Editor), p_config.font_hover_pressed_color); |
| 153 | p_theme->set_color("font_disabled_color", EditorStringName(Editor), p_config.font_disabled_color); |
| 154 | p_theme->set_color("font_readonly_color", EditorStringName(Editor), p_config.font_readonly_color); |
| 155 | p_theme->set_color("font_placeholder_color", EditorStringName(Editor), p_config.font_placeholder_color); |
| 156 | p_theme->set_color("font_outline_color", EditorStringName(Editor), p_config.font_outline_color); |
| 157 | |
| 158 | p_theme->set_color("font_dark_background_color", EditorStringName(Editor), p_config.font_dark_background_color); |
| 159 | p_theme->set_color("font_dark_background_focus_color", EditorStringName(Editor), p_config.font_dark_background_focus_color); |
| 160 | p_theme->set_color("font_dark_background_hover_color", EditorStringName(Editor), p_config.font_dark_background_hover_color); |
| 161 | p_theme->set_color("font_dark_background_pressed_color", EditorStringName(Editor), p_config.font_dark_background_pressed_color); |
| 162 | p_theme->set_color("font_dark_background_hover_pressed_color", EditorStringName(Editor), p_config.font_dark_background_hover_pressed_color); |
| 163 | |
| 164 | #ifndef DISABLE_DEPRECATED // Used before 4.3. |
| 165 | p_theme->set_color("readonly_font_color", EditorStringName(Editor), p_config.font_readonly_color); |
| 166 | p_theme->set_color("disabled_font_color", EditorStringName(Editor), p_config.font_disabled_color); |
| 167 | p_theme->set_color("readonly_color", EditorStringName(Editor), p_config.font_readonly_color); |
| 168 | p_theme->set_color("highlighted_font_color", EditorStringName(Editor), p_config.font_hover_color); // Closest equivalent. |
| 169 | #endif |
| 170 | |
| 171 | // Icon colors. |
| 172 | |
| 173 | p_config.icon_normal_color = Color(1, 1, 1, p_config.dark_icon_and_font ? 0.85 : 0.95); |
| 174 | p_config.icon_secondary_color = Color(1, 1, 1, p_config.dark_icon_and_font ? 0.6 : 0.75); |
| 175 | p_config.icon_focus_color = Color(1, 1, 1); |
| 176 | p_config.icon_hover_color = Color(1, 1, 1); |
| 177 | p_config.icon_pressed_color = p_config.accent_color * (p_config.dark_icon_and_font ? 1.15 : 3.5); |
| 178 | p_config.icon_pressed_color.a = 1.0; |
| 179 | p_config.icon_disabled_color = Color(1, 1, 1, p_config.dark_icon_and_font ? 0.35 : 0.5); |
| 180 | |
| 181 | p_theme->set_color("icon_normal_color", EditorStringName(Editor), p_config.icon_normal_color); |
| 182 | p_theme->set_color("icon_focus_color", EditorStringName(Editor), p_config.icon_focus_color); |
| 183 | p_theme->set_color("icon_hover_color", EditorStringName(Editor), p_config.icon_hover_color); |
| 184 | p_theme->set_color("icon_pressed_color", EditorStringName(Editor), p_config.icon_pressed_color); |
| 185 | p_theme->set_color("icon_disabled_color", EditorStringName(Editor), p_config.icon_disabled_color); |
| 186 | |
| 187 | // Additional GUI colors. |
| 188 | |
| 189 | p_config.surface_popup_color = _get_base_color(p_config, 1.9, 0.9); |
| 190 | p_config.surface_lowest_color = _get_base_color(p_config, 1.7, 0.9); |
| 191 | p_config.surface_lower_color = _get_base_color(p_config, 1.1, 0.9); |
| 192 | p_config.surface_low_color = _get_base_color(p_config, 0.8); |
| 193 | p_config.surface_base_color = _get_base_color(p_config); |
| 194 | p_config.surface_high_color = _get_base_color(p_config, -1.3, 0.8); |
| 195 | p_config.surface_higher_color = _get_base_color(p_config, -1.5, 0.8); |
| 196 | p_config.surface_highest_color = _get_base_color(p_config, -2.2, 0.6); |
| 197 | |
| 198 | p_config.button_normal_color = _get_base_color(p_config, -2.0, 0.85); |
| 199 | p_config.button_hover_color = _get_base_color(p_config, -2.9, 0.75); |
| 200 | p_config.button_pressed_color = _get_base_color(p_config, -3.2, 0.75); |
| 201 | p_config.button_disabled_color = _get_base_color(p_config, -1.4, 0.75); |
| 202 | p_config.button_border_normal_color = _get_base_color(p_config, -2.5, 0.75); |
| 203 | p_config.button_border_hover_color = _get_base_color(p_config, -3.4, 0.75); |
| 204 | p_config.button_border_pressed_color = _get_base_color(p_config, -3.7, 0.75); |
| 205 | |
| 206 | p_config.flat_button_hover_color = _get_base_color(p_config, -1.2, 0.75); |
| 207 | p_config.flat_button_pressed_color = _get_base_color(p_config, -2.0, 0.75); |
| 208 | p_config.flat_button_hover_pressed_color = _get_base_color(p_config, -2.4, 0.75); |
| 209 | |
| 210 | p_config.shadow_color = Color(0, 0, 0, p_config.dark_theme ? 0.3 : 0.1); |
| 211 | p_config.selection_color = p_config.accent_color * Color(1, 1, 1, 0.4); |
| 212 | p_config.disabled_border_color = p_config.mono_color.inverted().lerp(p_config.base_color, 0.7); |
| 213 | p_config.disabled_bg_color = p_config.mono_color.inverted().lerp(p_config.base_color, 0.9); |
| 214 | p_config.separator_color = p_config.dark_theme ? Color(0, 0, 0, 0.4) : Color(0, 0, 0, 0.2); |
| 215 | |
| 216 | p_theme->set_color("selection_color", EditorStringName(Editor), p_config.selection_color); |
| 217 | p_theme->set_color("disabled_border_color", EditorStringName(Editor), p_config.disabled_border_color); |
| 218 | p_theme->set_color("disabled_bg_color", EditorStringName(Editor), p_config.disabled_bg_color); |
| 219 | p_theme->set_color("separator_color", EditorStringName(Editor), p_config.separator_color); |
| 220 | |
| 221 | // Additional editor colors. |
| 222 | |
| 223 | p_theme->set_color("box_selection_fill_color", EditorStringName(Editor), p_config.mono_color * Color(1, 1, 1, 0.12)); |
| 224 | p_theme->set_color("box_selection_stroke_color", EditorStringName(Editor), p_config.mono_color * Color(1, 1, 1, 0.4)); |
| 225 | |
| 226 | p_theme->set_color("axis_x_color", EditorStringName(Editor), Color(0.96, 0.20, 0.32)); |
| 227 | p_theme->set_color("axis_y_color", EditorStringName(Editor), Color(0.53, 0.84, 0.01)); |
| 228 | p_theme->set_color("axis_z_color", EditorStringName(Editor), Color(0.16, 0.55, 0.96)); |
| 229 | p_theme->set_color("axis_w_color", EditorStringName(Editor), Color(0.55, 0.55, 0.55)); |
| 230 | |
| 231 | p_theme->set_color("property_color_x", EditorStringName(Editor), p_config.dark_icon_and_font ? Color(0.88, 0.38, 0.47) : Color(0.40, 0.04, 0.09)); |
| 232 | p_theme->set_color("property_color_y", EditorStringName(Editor), p_config.dark_icon_and_font ? Color(0.76, 0.93, 0.40) : Color(0.27, 0.37, 0.06)); |
| 233 | p_theme->set_color("property_color_z", EditorStringName(Editor), p_config.dark_icon_and_font ? Color(0.42, 0.67, 0.96) : Color(0.08, 0.22, 0.38)); |
| 234 | p_theme->set_color("property_color_w", EditorStringName(Editor), p_config.font_color); |
| 235 | |
| 236 | // Special colors for rendering methods. |
| 237 | |
| 238 | p_theme->set_color("forward_plus_color", EditorStringName(Editor), Color::hex(0x5d8c3fff)); |
| 239 | p_theme->set_color("mobile_color", EditorStringName(Editor), Color::hex(0xa5557dff)); |
| 240 | p_theme->set_color("gl_compatibility_color", EditorStringName(Editor), Color::hex(0x5586a4ff)); |
| 241 | } |
| 242 | |
| 243 | // Constants. |
| 244 | { |
| 245 | // Can't save single float in theme, so using Color. |
| 246 | p_theme->set_color("icon_saturation", EditorStringName(Editor), Color(p_config.icon_saturation, p_config.icon_saturation, p_config.icon_saturation)); |
| 247 | |
| 248 | // Controls may rely on the scale for their internal drawing logic. |
| 249 | p_theme->set_default_base_scale(EDSCALE); |
| 250 | p_theme->set_constant("scale", EditorStringName(Editor), EDSCALE); |
| 251 | |
| 252 | p_theme->set_constant("thumb_size", EditorStringName(Editor), p_config.thumb_size); |
| 253 | p_theme->set_constant("class_icon_size", EditorStringName(Editor), p_config.class_icon_size); |
| 254 | p_theme->set_constant("gizmo_handle_scale", EditorStringName(Editor), p_config.gizmo_handle_scale); |
| 255 | |
| 256 | p_theme->set_constant("base_margin", EditorStringName(Editor), p_config.base_margin); |
| 257 | p_theme->set_constant("increased_margin", EditorStringName(Editor), p_config.increased_margin); |
| 258 | p_theme->set_constant("window_border_margin", EditorStringName(Editor), p_config.window_border_margin); |
| 259 | p_theme->set_constant("top_bar_separation", EditorStringName(Editor), p_config.top_bar_separation); |
| 260 | |
| 261 | p_theme->set_constant("dark_theme", EditorStringName(Editor), p_config.dark_theme); |
| 262 | } |
| 263 | |
| 264 | // Styleboxes. |
| 265 | { |
| 266 | // This is the basic stylebox, used as a base for most other styleboxes (through `duplicate()`). |
| 267 | p_config.base_style = EditorThemeManager::make_flat_stylebox(p_config.base_color, p_config.increased_margin * 1.5, p_config.increased_margin * 1.5, p_config.increased_margin * 1.5, p_config.increased_margin * 1.5, p_config.corner_radius); |
| 268 | |
| 269 | p_config.focus_style = p_config.base_style->duplicate(); |
| 270 | p_config.focus_style->set_draw_center(false); |
| 271 | p_config.focus_style->set_border_color(p_config.accent_color * Color(1, 1, 1, 0.8)); |
| 272 | p_config.focus_style->set_border_width_all(2); |
| 273 | |
| 274 | p_config.base_empty_style = EditorThemeManager::make_empty_stylebox(); |
| 275 | |
| 276 | p_config.base_empty_wide_style = EditorThemeManager::make_empty_stylebox(); |
| 277 | // Ensure minimum margin for wide flat buttons otherwise the topbar looks broken. |
| 278 | float base_empty_wide_margin = MAX(p_config.base_margin, 3.0); |
| 279 | p_config.base_empty_wide_style->set_content_margin_individual(base_empty_wide_margin * 1.5 * EDSCALE, base_empty_wide_margin * EDSCALE, base_empty_wide_margin * 1.5 * EDSCALE, base_empty_wide_margin * EDSCALE); |
| 280 | |
| 281 | // Button styles. |
| 282 | { |
| 283 | p_config.widget_margin = Vector2(p_config.increased_margin + 2, p_config.increased_margin + 1) * EDSCALE; |
| 284 | |
| 285 | p_config.button_style = p_config.base_style->duplicate(); |
| 286 | p_config.button_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE); |
| 287 | p_config.button_style->set_bg_color(p_config.button_normal_color); |
| 288 | p_config.button_style->set_border_width_all(Math::round(EDSCALE)); |
| 289 | p_config.button_style->set_shadow_color(p_config.dark_theme ? Color(0, 0, 0, 0.005) : Color(1, 1, 1, 0.005)); |
| 290 | p_config.button_style->set_shadow_size(Math::ceil(8 * EDSCALE)); |
| 291 | p_config.button_style->set_shadow_offset(Vector2(0, 4) * EDSCALE); |
| 292 | if (p_config.draw_extra_borders) { |
| 293 | p_config.button_style->set_border_color(p_config.extra_border_color_1); |
| 294 | } else { |
| 295 | p_config.button_style->set_border_color(p_config.button_border_normal_color); |
| 296 | } |
| 297 | |
| 298 | p_config.button_style_disabled = p_config.button_style->duplicate(); |
| 299 | p_config.button_style_disabled->set_bg_color(p_config.button_disabled_color); |
| 300 | if (p_config.draw_extra_borders) { |
| 301 | p_config.button_style_disabled->set_border_color(p_config.extra_border_color_2 * Color(1, 1, 1, 0.5)); |
| 302 | } else { |
| 303 | p_config.button_style_disabled->set_border_width_all(0); |
| 304 | } |
| 305 | |
| 306 | p_config.button_style_pressed = p_config.button_style->duplicate(); |
| 307 | p_config.button_style_pressed->set_bg_color(p_config.button_pressed_color); |
| 308 | if (p_config.draw_extra_borders) { |
| 309 | p_config.button_style_pressed->set_border_color(p_config.extra_border_color_1); |
| 310 | } else { |
| 311 | p_config.button_style_pressed->set_border_color(p_config.button_border_pressed_color); |
| 312 | } |
| 313 | |
| 314 | p_config.button_style_hover = p_config.button_style->duplicate(); |
| 315 | p_config.button_style_hover->set_bg_color(p_config.button_hover_color); |
| 316 | if (p_config.draw_extra_borders) { |
| 317 | p_config.button_style_pressed->set_border_color(p_config.extra_border_color_1); |
| 318 | } else { |
| 319 | p_config.button_style_hover->set_border_color(p_config.button_border_hover_color); |
| 320 | } |
| 321 | |
| 322 | p_config.flat_button_hover = p_config.base_style->duplicate(); |
| 323 | p_config.flat_button_hover->set_bg_color(p_config.flat_button_hover_color); |
| 324 | // This affects buttons in Tree so top and bottom margins should be kept low. |
| 325 | p_config.flat_button_hover->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.9 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.9 * EDSCALE); |
| 326 | if (p_config.draw_extra_borders) { |
| 327 | p_config.button_style_hover->set_border_color(p_config.extra_border_color_1); |
| 328 | } |
| 329 | |
| 330 | p_config.flat_button_pressed = p_config.flat_button_hover->duplicate(); |
| 331 | p_config.flat_button_pressed->set_bg_color(p_config.flat_button_pressed_color); |
| 332 | if (p_config.draw_extra_borders) { |
| 333 | p_config.flat_button_pressed->set_border_color(p_config.extra_border_color_1); |
| 334 | } |
| 335 | |
| 336 | p_config.flat_button_hover_pressed = p_config.flat_button_hover->duplicate(); |
| 337 | p_config.flat_button_hover_pressed->set_bg_color(p_config.flat_button_hover_pressed_color); |
| 338 | if (p_config.draw_extra_borders) { |
| 339 | p_config.flat_button_hover_pressed->set_border_color(p_config.extra_border_color_1); |
| 340 | } |
| 341 | |
| 342 | p_config.flat_button = p_config.flat_button_hover->duplicate(); |
| 343 | p_config.flat_button->set_draw_center(false); |
| 344 | } |
| 345 | |
| 346 | // Windows and popups. |
| 347 | { |
| 348 | p_config.popup_panel_style = p_config.base_style->duplicate(); |
| 349 | p_config.popup_panel_style->set_bg_color(p_config.surface_popup_color); |
| 350 | p_config.popup_panel_style->set_shadow_color(Color(0, 0, 0, 0.3)); |
| 351 | p_config.popup_panel_style->set_shadow_size(p_config.base_margin * 0.75 * EDSCALE); |
| 352 | p_config.popup_panel_style->set_content_margin_all(p_config.popup_margin * EDSCALE); |
| 353 | p_config.popup_panel_style->set_corner_radius_all(0); |
| 354 | if (p_config.draw_extra_borders) { |
| 355 | p_config.popup_panel_style->set_border_width_all(Math::round(EDSCALE)); |
| 356 | p_config.popup_panel_style->set_border_color(p_config.extra_border_color_2); |
| 357 | } |
| 358 | |
| 359 | p_config.window_style = p_config.base_style->duplicate(); |
| 360 | p_config.window_style->set_content_margin_all(p_config.popup_margin); |
| 361 | p_config.window_style->set_shadow_color(p_config.shadow_color); |
| 362 | p_config.window_style->set_shadow_size(4 * EDSCALE); |
| 363 | p_config.window_style->set_border_color(p_config.base_color); |
| 364 | p_config.window_style->set_border_width(SIDE_TOP, 24 * EDSCALE); |
| 365 | p_config.window_style->set_expand_margin(SIDE_TOP, 24 * EDSCALE); |
| 366 | p_config.window_style->set_corner_radius_all(0); |
| 367 | |
| 368 | p_config.window_complex_style = p_config.window_style->duplicate(); |
| 369 | p_config.window_complex_style->set_bg_color(p_config.surface_lowest_color); |
| 370 | |
| 371 | p_config.dialog_style = p_config.base_style->duplicate(); |
| 372 | p_config.dialog_style->set_content_margin_all(p_config.popup_margin); |
| 373 | p_config.dialog_style->set_corner_radius_all(0); |
| 374 | } |
| 375 | |
| 376 | // Panels. |
| 377 | { |
| 378 | p_config.panel_container_style = p_config.button_style->duplicate(); |
| 379 | p_config.panel_container_style->set_draw_center(false); |
| 380 | p_config.panel_container_style->set_border_width_all(0); |
| 381 | |
| 382 | // Content panel for tabs and similar containers. |
| 383 | |
| 384 | // Compensate for the border. |
| 385 | const int content_panel_margin = p_config.base_margin * EDSCALE + p_config.border_width; |
| 386 | |
| 387 | p_config.content_panel_style = p_config.base_style->duplicate(); |
| 388 | p_config.content_panel_style->set_border_color(p_config.dark_color_3); |
| 389 | p_config.content_panel_style->set_border_width_all(p_config.border_width); |
| 390 | p_config.content_panel_style->set_border_width(Side::SIDE_TOP, 0); |
| 391 | p_config.content_panel_style->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 392 | p_config.content_panel_style->set_corner_radius(CORNER_TOP_RIGHT, 0); |
| 393 | p_config.content_panel_style->set_content_margin_individual(content_panel_margin, 2 * EDSCALE + content_panel_margin, content_panel_margin, content_panel_margin); |
| 394 | |
| 395 | p_config.tab_container_style = p_config.base_style->duplicate(); |
| 396 | p_config.tab_container_style->set_content_margin_all(p_config.increased_margin * 1.5 * EDSCALE); |
| 397 | p_config.tab_container_style->set_corner_radius_individual(0, 0, p_config.corner_radius * EDSCALE, p_config.corner_radius * EDSCALE); |
| 398 | |
| 399 | p_config.foreground_panel = p_config.tab_container_style->duplicate(); |
| 400 | p_config.foreground_panel->set_corner_radius(CORNER_TOP_LEFT, p_config.tab_container_style->get_corner_radius(CORNER_BOTTOM_LEFT)); |
| 401 | p_config.foreground_panel->set_corner_radius(CORNER_TOP_RIGHT, p_config.tab_container_style->get_corner_radius(CORNER_BOTTOM_RIGHT)); |
| 402 | |
| 403 | // Trees and similarly inset panels. |
| 404 | |
| 405 | p_config.tree_panel_style = p_config.base_style->duplicate(); |
| 406 | // Make Trees easier to distinguish from other controls by using a darker background color. |
| 407 | p_config.tree_panel_style->set_bg_color(p_config.dark_color_1.lerp(p_config.dark_color_2, 0.5)); |
| 408 | if (p_config.draw_extra_borders) { |
| 409 | p_config.tree_panel_style->set_border_width_all(Math::round(EDSCALE)); |
| 410 | p_config.tree_panel_style->set_border_color(p_config.extra_border_color_2); |
| 411 | } else { |
| 412 | p_config.tree_panel_style->set_border_color(p_config.dark_color_3); |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, EditorThemeManager::ThemeConfiguration &p_config) { |
| 419 | // Panels. |
| 420 | { |
| 421 | // Panel. |
| 422 | p_theme->set_stylebox(SceneStringName(panel), "Panel", EditorThemeManager::make_flat_stylebox(p_config.dark_color_1, 6, 4, 6, 4, p_config.corner_radius)); |
| 423 | |
| 424 | // PanelContainer. |
| 425 | p_theme->set_stylebox(SceneStringName(panel), "PanelContainer", p_config.base_empty_wide_style); |
| 426 | |
| 427 | // TooltipPanel & TooltipLabel. |
| 428 | { |
| 429 | // TooltipPanel is also used for custom tooltips, while TooltipLabel |
| 430 | // is only relevant for default tooltips. |
| 431 | |
| 432 | p_theme->set_color(SceneStringName(font_color), "TooltipLabel", p_config.font_hover_color); |
| 433 | p_theme->set_color("font_shadow_color", "TooltipLabel", Color(1, 1, 1, 0)); |
| 434 | |
| 435 | Ref<StyleBoxFlat> tooltip_style = p_config.base_style->duplicate(); |
| 436 | tooltip_style->set_bg_color(p_config.surface_popup_color); |
| 437 | tooltip_style->set_content_margin_all(0); |
| 438 | tooltip_style->set_corner_radius_all(0); |
| 439 | if (p_config.draw_extra_borders) { |
| 440 | tooltip_style->set_border_width_all(Math::round(EDSCALE)); |
| 441 | tooltip_style->set_border_color(p_config.extra_border_color_2); |
| 442 | } |
| 443 | p_theme->set_stylebox(SceneStringName(panel), "TooltipPanel", tooltip_style); |
| 444 | } |
| 445 | |
| 446 | // PopupPanel |
| 447 | Ref<StyleBoxFlat> popup_panel_style = p_config.base_style->duplicate(); |
| 448 | popup_panel_style->set_bg_color(p_config.surface_popup_color); |
| 449 | popup_panel_style->set_shadow_color(Color(0, 0, 0, 0.3)); |
| 450 | popup_panel_style->set_shadow_size(p_config.base_margin * 0.75 * EDSCALE); |
| 451 | popup_panel_style->set_content_margin_all(p_config.popup_margin); |
| 452 | popup_panel_style->set_corner_radius_all(0); |
| 453 | if (p_config.draw_extra_borders) { |
| 454 | popup_panel_style->set_border_width_all(Math::round(EDSCALE)); |
| 455 | popup_panel_style->set_border_color(p_config.extra_border_color_2); |
| 456 | } |
| 457 | p_theme->set_stylebox(SceneStringName(panel), "PopupPanel", p_config.popup_panel_style); |
| 458 | } |
| 459 | |
| 460 | // Buttons. |
| 461 | { |
| 462 | // Button. |
| 463 | |
| 464 | p_theme->set_stylebox(CoreStringName(normal), "Button", p_config.button_style); |
| 465 | p_theme->set_stylebox(SceneStringName(hover), "Button", p_config.button_style_hover); |
| 466 | p_theme->set_stylebox(SceneStringName(pressed), "Button", p_config.button_style_pressed); |
| 467 | p_theme->set_stylebox("hover_pressed", "Button", p_config.button_style_pressed); |
| 468 | p_theme->set_stylebox("focus", "Button", p_config.focus_style); |
| 469 | p_theme->set_stylebox("disabled", "Button", p_config.button_style_disabled); |
| 470 | |
| 471 | p_theme->set_stylebox("normal_mirrored", "Button", p_config.button_style); |
| 472 | p_theme->set_stylebox("hover_mirrored", "Button", p_config.button_style_hover); |
| 473 | p_theme->set_stylebox("pressed_mirrored", "Button", p_config.button_style_pressed); |
| 474 | p_theme->set_stylebox("hover_pressed_mirrored", "Button", p_config.button_style_pressed); |
| 475 | p_theme->set_stylebox("disabled_mirrored", "Button", p_config.button_style_disabled); |
| 476 | |
| 477 | p_theme->set_color(SceneStringName(font_color), "Button", p_config.font_color); |
| 478 | p_theme->set_color("font_hover_color", "Button", p_config.font_hover_color); |
| 479 | p_theme->set_color("font_hover_pressed_color", "Button", p_config.font_hover_pressed_color); |
| 480 | p_theme->set_color("font_focus_color", "Button", p_config.font_focus_color); |
| 481 | p_theme->set_color("font_pressed_color", "Button", p_config.font_pressed_color); |
| 482 | p_theme->set_color("font_disabled_color", "Button", p_config.font_disabled_color); |
| 483 | p_theme->set_color("font_outline_color", "Button", p_config.font_outline_color); |
| 484 | |
| 485 | p_theme->set_color("icon_normal_color", "Button", p_config.icon_normal_color); |
| 486 | p_theme->set_color("icon_hover_color", "Button", p_config.icon_hover_color); |
| 487 | p_theme->set_color("icon_focus_color", "Button", p_config.icon_focus_color); |
| 488 | p_theme->set_color("icon_hover_pressed_color", "Button", p_config.icon_pressed_color); |
| 489 | p_theme->set_color("icon_pressed_color", "Button", p_config.icon_pressed_color); |
| 490 | p_theme->set_color("icon_disabled_color", "Button", p_config.icon_disabled_color); |
| 491 | |
| 492 | p_theme->set_constant("h_separation", "Button", 4 * EDSCALE); |
| 493 | p_theme->set_constant("outline_size", "Button", 0); |
| 494 | |
| 495 | p_theme->set_constant("outline_size", "Button", 0); |
| 496 | p_theme->set_constant("align_to_largest_stylebox", "Button", 1); // Enabled. |
| 497 | |
| 498 | // MenuBar. |
| 499 | |
| 500 | p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style); |
| 501 | p_theme->set_stylebox(SceneStringName(hover), "MenuBar", p_config.button_style_hover); |
| 502 | p_theme->set_stylebox(SceneStringName(pressed), "MenuBar", p_config.button_style_pressed); |
| 503 | p_theme->set_stylebox("disabled", "MenuBar", p_config.button_style_disabled); |
| 504 | |
| 505 | p_theme->set_color(SceneStringName(font_color), "MenuBar", p_config.font_color); |
| 506 | p_theme->set_color("font_hover_color", "MenuBar", p_config.font_hover_color); |
| 507 | p_theme->set_color("font_hover_pressed_color", "MenuBar", p_config.font_hover_pressed_color); |
| 508 | p_theme->set_color("font_focus_color", "MenuBar", p_config.font_focus_color); |
| 509 | p_theme->set_color("font_pressed_color", "MenuBar", p_config.font_pressed_color); |
| 510 | p_theme->set_color("font_disabled_color", "MenuBar", p_config.font_disabled_color); |
| 511 | p_theme->set_color("font_outline_color", "MenuBar", p_config.font_outline_color); |
| 512 | |
| 513 | p_theme->set_constant("h_separation", "MenuBar", 4 * EDSCALE); |
| 514 | p_theme->set_constant("outline_size", "MenuBar", 0); |
| 515 | |
| 516 | // OptionButton. |
| 517 | |
| 518 | p_theme->set_icon("arrow", "OptionButton", p_theme->get_icon(SNAME("GuiOptionArrow"), EditorStringName(EditorIcons))); |
| 519 | p_theme->set_constant("arrow_margin", "OptionButton", p_config.base_margin * 2 * EDSCALE); |
| 520 | p_theme->set_constant("modulate_arrow", "OptionButton", true); |
| 521 | p_theme->set_constant("h_separation", "OptionButton", 4 * EDSCALE); |
| 522 | |
| 523 | // CheckButton. |
| 524 | |
| 525 | p_theme->set_stylebox(CoreStringName(normal), "CheckButton", p_config.panel_container_style); |
| 526 | p_theme->set_stylebox(SceneStringName(pressed), "CheckButton", p_config.panel_container_style); |
| 527 | p_theme->set_stylebox("disabled", "CheckButton", p_config.panel_container_style); |
| 528 | p_theme->set_stylebox(SceneStringName(hover), "CheckButton", p_config.panel_container_style); |
| 529 | p_theme->set_stylebox("hover_pressed", "CheckButton", p_config.panel_container_style); |
| 530 | |
| 531 | p_theme->set_stylebox("normal_mirrored", "CheckButton", p_config.panel_container_style); |
| 532 | p_theme->set_stylebox("pressed_mirrored", "CheckButton", p_config.panel_container_style); |
| 533 | p_theme->set_stylebox("disabled_mirrored", "CheckButton", p_config.panel_container_style); |
| 534 | p_theme->set_stylebox("hover_mirrored", "CheckButton", p_config.panel_container_style); |
| 535 | p_theme->set_stylebox("hover_pressed_mirrored", "CheckButton", p_config.panel_container_style); |
| 536 | |
| 537 | p_theme->set_icon("checked", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOn"), EditorStringName(EditorIcons))); |
| 538 | p_theme->set_icon("checked_disabled", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOnDisabled"), EditorStringName(EditorIcons))); |
| 539 | p_theme->set_icon("unchecked", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOff"), EditorStringName(EditorIcons))); |
| 540 | p_theme->set_icon("unchecked_disabled", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOffDisabled"), EditorStringName(EditorIcons))); |
| 541 | |
| 542 | p_theme->set_icon("checked_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOnMirrored"), EditorStringName(EditorIcons))); |
| 543 | p_theme->set_icon("checked_disabled_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOnDisabledMirrored"), EditorStringName(EditorIcons))); |
| 544 | p_theme->set_icon("unchecked_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOffMirrored"), EditorStringName(EditorIcons))); |
| 545 | p_theme->set_icon("unchecked_disabled_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOffDisabledMirrored"), EditorStringName(EditorIcons))); |
| 546 | |
| 547 | p_theme->set_constant("h_separation", "CheckButton", 8 * EDSCALE); |
| 548 | p_theme->set_constant("check_v_offset", "CheckButton", 0); |
| 549 | p_theme->set_constant("outline_size", "CheckButton", 0); |
| 550 | |
| 551 | // CheckBox. |
| 552 | { |
| 553 | Ref<StyleBoxFlat> checkbox_style = p_config.panel_container_style->duplicate(); |
| 554 | checkbox_style->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE); |
| 555 | Ref<StyleBoxFlat> checkbox_style_normal = checkbox_style->duplicate(); |
| 556 | checkbox_style_normal->set_draw_center(false); |
| 557 | |
| 558 | p_theme->set_stylebox(CoreStringName(normal), "CheckBox", checkbox_style_normal); |
| 559 | p_theme->set_stylebox(SceneStringName(pressed), "CheckBox", checkbox_style); |
| 560 | p_theme->set_stylebox("disabled", "CheckBox", checkbox_style); |
| 561 | p_theme->set_stylebox(SceneStringName(hover), "CheckBox", checkbox_style); |
| 562 | p_theme->set_stylebox("hover_pressed", "CheckBox", checkbox_style); |
| 563 | |
| 564 | p_theme->set_stylebox("normal_mirrored", "CheckBox", checkbox_style_normal); |
| 565 | p_theme->set_stylebox("pressed_mirrored", "CheckBox", checkbox_style); |
| 566 | p_theme->set_stylebox("disabled_mirrored", "CheckBox", checkbox_style); |
| 567 | p_theme->set_stylebox("hover_mirrored", "CheckBox", checkbox_style); |
| 568 | p_theme->set_stylebox("hover_pressed_mirrored", "CheckBox", checkbox_style); |
| 569 | |
| 570 | p_theme->set_icon("checked", "CheckBox", p_theme->get_icon(SNAME("GuiChecked"), EditorStringName(EditorIcons))); |
| 571 | |
| 572 | p_theme->set_icon("unchecked", "CheckBox", p_theme->get_icon(SNAME("GuiUnchecked"), EditorStringName(EditorIcons))); |
| 573 | p_theme->set_icon("radio_checked", "CheckBox", p_theme->get_icon(SNAME("GuiRadioChecked"), EditorStringName(EditorIcons))); |
| 574 | p_theme->set_icon("radio_unchecked", "CheckBox", p_theme->get_icon(SNAME("GuiRadioUnchecked"), EditorStringName(EditorIcons))); |
| 575 | p_theme->set_icon("checked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiCheckedDisabled"), EditorStringName(EditorIcons))); |
| 576 | p_theme->set_icon("unchecked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiUncheckedDisabled"), EditorStringName(EditorIcons))); |
| 577 | p_theme->set_icon("radio_checked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiRadioCheckedDisabled"), EditorStringName(EditorIcons))); |
| 578 | p_theme->set_icon("radio_unchecked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiRadioUncheckedDisabled"), EditorStringName(EditorIcons))); |
| 579 | |
| 580 | p_theme->set_constant("h_separation", "CheckBox", 8 * EDSCALE); |
| 581 | p_theme->set_constant("check_v_offset", "CheckBox", 0); |
| 582 | p_theme->set_constant("outline_size", "CheckBox", 0); |
| 583 | } |
| 584 | |
| 585 | // LinkButton. |
| 586 | |
| 587 | p_theme->set_stylebox("focus", "LinkButton", p_config.base_empty_style); |
| 588 | |
| 589 | p_theme->set_color(SceneStringName(font_color), "LinkButton", p_config.font_color); |
| 590 | p_theme->set_color("font_hover_color", "LinkButton", p_config.font_hover_color); |
| 591 | p_theme->set_color("font_hover_pressed_color", "LinkButton", p_config.font_hover_pressed_color); |
| 592 | p_theme->set_color("font_focus_color", "LinkButton", p_config.font_focus_color); |
| 593 | p_theme->set_color("font_pressed_color", "LinkButton", p_config.font_pressed_color); |
| 594 | p_theme->set_color("font_disabled_color", "LinkButton", p_config.font_disabled_color); |
| 595 | p_theme->set_color("font_outline_color", "LinkButton", p_config.font_outline_color); |
| 596 | |
| 597 | p_theme->set_constant("outline_size", "LinkButton", 0); |
| 598 | } |
| 599 | |
| 600 | // Tree & ItemList. |
| 601 | { |
| 602 | // Tree. |
| 603 | { |
| 604 | // Use empty stylebox for trees to avoid drawing unnecessary borders in docks. |
| 605 | Ref<StyleBoxEmpty> style_tree_panel = p_config.base_empty_style->duplicate(); |
| 606 | style_tree_panel->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 2.5 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 2.5 * EDSCALE); |
| 607 | |
| 608 | Ref<StyleBoxFlat> style_button_pressed = p_config.flat_button_pressed->duplicate(); |
| 609 | style_button_pressed->set_content_margin_individual(p_config.base_margin, 0, p_config.base_margin, 0); |
| 610 | |
| 611 | p_theme->set_icon("checked", "Tree", p_theme->get_icon(SNAME("GuiChecked"), EditorStringName(EditorIcons))); |
| 612 | p_theme->set_icon("checked_disabled", "Tree", p_theme->get_icon(SNAME("GuiCheckedDisabled"), EditorStringName(EditorIcons))); |
| 613 | p_theme->set_icon("indeterminate", "Tree", p_theme->get_icon(SNAME("GuiIndeterminate"), EditorStringName(EditorIcons))); |
| 614 | p_theme->set_icon("indeterminate_disabled", "Tree", p_theme->get_icon(SNAME("GuiIndeterminateDisabled"), EditorStringName(EditorIcons))); |
| 615 | p_theme->set_icon("unchecked", "Tree", p_theme->get_icon(SNAME("GuiUnchecked"), EditorStringName(EditorIcons))); |
| 616 | p_theme->set_icon("unchecked_disabled", "Tree", p_theme->get_icon(SNAME("GuiUncheckedDisabled"), EditorStringName(EditorIcons))); |
| 617 | p_theme->set_icon("arrow", "Tree", p_theme->get_icon(SNAME("GuiTreeArrowDown"), EditorStringName(EditorIcons))); |
| 618 | p_theme->set_icon("arrow_collapsed", "Tree", p_theme->get_icon(SNAME("GuiTreeArrowRight"), EditorStringName(EditorIcons))); |
| 619 | p_theme->set_icon("arrow_collapsed_mirrored", "Tree", p_theme->get_icon(SNAME("GuiTreeArrowLeft"), EditorStringName(EditorIcons))); |
| 620 | p_theme->set_icon("updown", "Tree", p_theme->get_icon(SNAME("GuiTreeUpdown"), EditorStringName(EditorIcons))); |
| 621 | p_theme->set_icon("select_arrow", "Tree", p_theme->get_icon(SNAME("GuiDropdown"), EditorStringName(EditorIcons))); |
| 622 | |
| 623 | p_theme->set_stylebox(SceneStringName(panel), "Tree", style_tree_panel); |
| 624 | p_theme->set_stylebox("focus", "Tree", p_config.focus_style); |
| 625 | p_theme->set_stylebox("button_pressed", "Tree", style_button_pressed); |
| 626 | p_theme->set_stylebox("custom_button", "Tree", p_config.flat_button); |
| 627 | p_theme->set_stylebox("custom_button_pressed", "Tree", style_button_pressed); |
| 628 | |
| 629 | p_theme->set_color("custom_button_font_highlight", "Tree", p_config.font_hover_color); |
| 630 | p_theme->set_color(SceneStringName(font_color), "Tree", p_config.font_color); |
| 631 | p_theme->set_color("font_hovered_color", "Tree", p_config.font_hover_color); |
| 632 | p_theme->set_color("font_hovered_dimmed_color", "Tree", p_config.font_hover_color); |
| 633 | p_theme->set_color("font_hovered_selected_color", "Tree", p_config.mono_color_font); |
| 634 | p_theme->set_color("font_selected_color", "Tree", p_config.mono_color_font); |
| 635 | p_theme->set_color("font_disabled_color", "Tree", p_config.font_disabled_color); |
| 636 | p_theme->set_color("font_outline_color", "Tree", p_config.font_outline_color); |
| 637 | p_theme->set_color("title_button_color", "Tree", p_config.font_color); |
| 638 | p_theme->set_color("drop_position_color", "Tree", p_config.accent_color); |
| 639 | |
| 640 | int tree_v_sep = p_config.enable_touch_optimizations ? (p_config.separation_margin * 0.9) : Math::pow(p_config.base_margin * 0.175 * EDSCALE, 3); |
| 641 | p_theme->set_constant("v_separation", "Tree", tree_v_sep); |
| 642 | p_theme->set_constant("h_separation", "Tree", (p_config.increased_margin + 2) * EDSCALE); |
| 643 | p_theme->set_constant("guide_width", "Tree", p_config.border_width); |
| 644 | p_theme->set_constant("item_margin", "Tree", MAX(3 * p_config.increased_margin * EDSCALE, 12 * EDSCALE)); |
| 645 | p_theme->set_constant("inner_item_margin_top", "Tree", p_config.base_margin * 0.75 * EDSCALE); |
| 646 | p_theme->set_constant("inner_item_margin_bottom", "Tree", p_config.base_margin * 0.75 * EDSCALE); |
| 647 | p_theme->set_constant("inner_item_margin_left", "Tree", p_config.base_margin * EDSCALE); |
| 648 | p_theme->set_constant("inner_item_margin_right", "Tree", p_config.base_margin * EDSCALE); |
| 649 | p_theme->set_constant("check_h_separation", "Tree", p_config.base_margin * 1.5 * EDSCALE); |
| 650 | p_theme->set_constant("icon_h_separation", "Tree", p_config.base_margin * 1.5 * EDSCALE); |
| 651 | p_theme->set_constant("button_margin", "Tree", p_config.base_margin * EDSCALE); |
| 652 | p_theme->set_constant("dragging_unfold_wait_msec", "Tree", p_config.dragging_hover_wait_msec); |
| 653 | p_theme->set_constant("scroll_border", "Tree", 40 * EDSCALE); |
| 654 | p_theme->set_constant("scroll_speed", "Tree", 12); |
| 655 | p_theme->set_constant("outline_size", "Tree", 0); |
| 656 | p_theme->set_constant("scrollbar_margin_left", "Tree", 0); |
| 657 | p_theme->set_constant("scrollbar_margin_top", "Tree", 0); |
| 658 | p_theme->set_constant("scrollbar_margin_right", "Tree", 0); |
| 659 | p_theme->set_constant("scrollbar_margin_bottom", "Tree", 0); |
| 660 | p_theme->set_constant("scrollbar_h_separation", "Tree", 1 * EDSCALE); |
| 661 | p_theme->set_constant("scrollbar_v_separation", "Tree", 1 * EDSCALE); |
| 662 | |
| 663 | Color relationship_line_color = p_config.mono_color * Color(1, 1, 1, p_config.relationship_line_opacity); |
| 664 | Color highlight_line_color = p_config.mono_color * Color(1, 1, 1, p_config.relationship_line_opacity * 2); |
| 665 | |
| 666 | int draw_relationship_lines = 0; |
| 667 | int relationship_line_width = 0; |
| 668 | int highlighted_line_width = Math::ceil(EDSCALE); |
| 669 | if (p_config.draw_relationship_lines == EditorThemeManager::RELATIONSHIP_ALL) { |
| 670 | draw_relationship_lines = 1; |
| 671 | relationship_line_width = 1; |
| 672 | } else if (p_config.draw_relationship_lines == EditorThemeManager::RELATIONSHIP_SELECTED_ONLY) { |
| 673 | draw_relationship_lines = 1; |
| 674 | } |
| 675 | |
| 676 | p_theme->set_constant("draw_guides", "Tree", 0); |
| 677 | p_theme->set_constant("draw_relationship_lines", "Tree", draw_relationship_lines && p_config.relationship_line_opacity >= 0.01); |
| 678 | p_theme->set_constant("relationship_line_width", "Tree", relationship_line_width); |
| 679 | p_theme->set_constant("parent_hl_line_width", "Tree", highlighted_line_width); |
| 680 | p_theme->set_constant("children_hl_line_width", "Tree", 1); |
| 681 | p_theme->set_constant("parent_hl_line_margin", "Tree", 3); |
| 682 | p_theme->set_color("relationship_line_color", "Tree", relationship_line_color); |
| 683 | p_theme->set_color("parent_hl_line_color", "Tree", highlight_line_color); |
| 684 | p_theme->set_color("children_hl_line_color", "Tree", relationship_line_color); |
| 685 | p_theme->set_color("drop_position_color", "Tree", p_config.icon_normal_color); |
| 686 | p_theme->set_color("guide_color", "Tree", Color(1, 1, 1, 0)); |
| 687 | p_theme->set_color("scroll_hint_color", "Tree", Color(0, 0, 0, p_config.dark_theme ? 1.0 : 0.5)); |
| 688 | |
| 689 | Ref<StyleBoxFlat> style_tree_hover = p_config.flat_button_hover->duplicate(); |
| 690 | style_tree_hover->set_content_margin_all(0); |
| 691 | |
| 692 | p_theme->set_stylebox("button_hover", "Tree", style_tree_hover); |
| 693 | p_theme->set_stylebox("hovered", "Tree", style_tree_hover); |
| 694 | p_theme->set_stylebox("hovered_dimmed", "Tree", style_tree_hover); |
| 695 | p_theme->set_stylebox("custom_button_hover", "Tree", style_tree_hover); |
| 696 | |
| 697 | Ref<StyleBoxFlat> style_tree_selected = p_config.flat_button_pressed->duplicate(); |
| 698 | style_tree_selected->set_content_margin_all(0); |
| 699 | |
| 700 | p_theme->set_stylebox("selected", "Tree", style_tree_selected); |
| 701 | p_theme->set_stylebox("selected_focus", "Tree", p_config.focus_style); |
| 702 | |
| 703 | Ref<StyleBoxFlat> style_tree_hovered_selected = p_config.flat_button_hover_pressed->duplicate(); |
| 704 | style_tree_hovered_selected->set_content_margin_all(0); |
| 705 | |
| 706 | p_theme->set_stylebox("hovered_selected", "Tree", style_tree_hovered_selected); |
| 707 | p_theme->set_stylebox("hovered_selected_focus", "Tree", p_config.focus_style); |
| 708 | |
| 709 | // Cursor is drawn on top of the item so it needs to be transparent. |
| 710 | Ref<StyleBoxFlat> style_tree_cursor = p_config.base_style->duplicate(); |
| 711 | style_tree_cursor->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.04)); |
| 712 | |
| 713 | Ref<StyleBoxFlat> style_tree_title = p_config.base_style->duplicate(); |
| 714 | style_tree_title->set_bg_color(p_config.surface_lower_color); |
| 715 | // Use a transparent border to separate rounded column titles. |
| 716 | style_tree_title->set_border_color(Color(p_config.surface_lower_color, 0)); |
| 717 | style_tree_title->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 718 | style_tree_title->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 719 | |
| 720 | p_theme->set_stylebox("cursor", "Tree", style_tree_cursor); |
| 721 | p_theme->set_stylebox("cursor_unfocused", "Tree", style_tree_cursor); |
| 722 | p_theme->set_stylebox("title_button_normal", "Tree", style_tree_title); |
| 723 | p_theme->set_stylebox("title_button_hover", "Tree", style_tree_title); |
| 724 | p_theme->set_stylebox("title_button_pressed", "Tree", style_tree_title); |
| 725 | } |
| 726 | |
| 727 | // ProjectList. |
| 728 | { |
| 729 | Ref<StyleBoxFlat> style_project_list_hover = p_config.flat_button_hover->duplicate(); |
| 730 | style_project_list_hover->set_bg_color(_get_base_color(p_config, -0.2, 0.75)); |
| 731 | style_project_list_hover->set_content_margin_all(0); |
| 732 | |
| 733 | Ref<StyleBoxFlat> style_project_list_selected = style_project_list_hover->duplicate(); |
| 734 | style_project_list_selected->set_bg_color(_get_base_color(p_config, -1.0, 0.75)); |
| 735 | |
| 736 | Ref<StyleBoxFlat> style_project_list_hover_pressed = style_project_list_selected->duplicate(); |
| 737 | style_project_list_hover_pressed->set_bg_color(_get_base_color(p_config, -1.2, 0.75)); |
| 738 | |
| 739 | p_theme->set_stylebox("hovered", "ProjectList", style_project_list_hover); |
| 740 | p_theme->set_stylebox("selected", "ProjectList", style_project_list_selected); |
| 741 | p_theme->set_stylebox("hover_pressed", "ProjectList", style_project_list_hover_pressed); |
| 742 | p_theme->set_stylebox("focus", "ProjectList", p_config.focus_style); |
| 743 | |
| 744 | p_theme->set_color(SceneStringName(font_color), "ProjectList", p_config.font_color); |
| 745 | p_theme->set_color("guide_color", "ProjectList", Color(1, 1, 1, 0)); |
| 746 | } |
| 747 | |
| 748 | // ItemList. |
| 749 | { |
| 750 | Ref<StyleBoxFlat> style_itemlist_bg = p_config.base_style->duplicate(); |
| 751 | style_itemlist_bg->set_content_margin_all(p_config.base_margin * 2 * EDSCALE); |
| 752 | Ref<StyleBoxFlat> style_itemlist_cursor = p_config.base_style->duplicate(); |
| 753 | style_itemlist_cursor->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.04)); |
| 754 | |
| 755 | p_theme->set_stylebox(SceneStringName(panel), "ItemList", style_itemlist_bg); |
| 756 | p_theme->set_stylebox("focus", "ItemList", p_config.focus_style); |
| 757 | p_theme->set_stylebox("cursor", "ItemList", style_itemlist_cursor); |
| 758 | p_theme->set_stylebox("cursor_unfocused", "ItemList", style_itemlist_cursor); |
| 759 | p_theme->set_stylebox("selected_focus", "ItemList", p_config.focus_style); |
| 760 | p_theme->set_stylebox("selected", "ItemList", p_config.flat_button_pressed); |
| 761 | p_theme->set_stylebox("hovered", "ItemList", p_config.flat_button_hover); |
| 762 | p_theme->set_stylebox("hovered_selected", "ItemList", p_config.flat_button_hover_pressed); |
| 763 | p_theme->set_stylebox("hovered_selected_focus", "ItemList", p_config.focus_style); |
| 764 | p_theme->set_color(SceneStringName(font_color), "ItemList", p_config.font_color); |
| 765 | p_theme->set_color("font_hovered_color", "ItemList", p_config.font_hover_color); |
| 766 | p_theme->set_color("font_hovered_selected_color", "ItemList", p_config.font_hover_pressed_color); |
| 767 | p_theme->set_color("font_selected_color", "ItemList", p_config.font_pressed_color); |
| 768 | p_theme->set_color("font_outline_color", "ItemList", p_config.font_outline_color); |
| 769 | p_theme->set_color("guide_color", "ItemList", Color(1, 1, 1, 0)); |
| 770 | p_theme->set_color("scroll_hint_color", "ItemList", Color(0, 0, 0, p_config.dark_theme ? 1.0 : 0.5)); |
| 771 | p_theme->set_constant("v_separation", "ItemList", p_config.base_margin * 1.5 * EDSCALE); |
| 772 | p_theme->set_constant("h_separation", "ItemList", (p_config.increased_margin + 2) * EDSCALE); |
| 773 | p_theme->set_constant("icon_margin", "ItemList", (p_config.increased_margin + 2) * EDSCALE); |
| 774 | p_theme->set_constant(SceneStringName(line_separation), "ItemList", p_config.separation_margin); |
| 775 | p_theme->set_constant("outline_size", "ItemList", 0); |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | // TabBar & TabContainer. |
| 780 | { |
| 781 | Ref<StyleBoxFlat> style_tab_selected = p_config.base_style->duplicate(); |
| 782 | style_tab_selected->set_content_margin_individual(p_config.base_margin * 4 * EDSCALE, p_config.base_margin * 2.1 * EDSCALE, p_config.base_margin * 4 * EDSCALE, p_config.base_margin * 2.1 * EDSCALE); |
| 783 | style_tab_selected->set_corner_radius_individual(p_config.corner_radius * EDSCALE, p_config.corner_radius * EDSCALE, 0, 0); |
| 784 | |
| 785 | Ref<StyleBoxFlat> style_tab_focus = style_tab_selected->duplicate(); |
| 786 | style_tab_focus->set_bg_color(p_config.base_color); |
| 787 | style_tab_focus->set_border_color(p_config.accent_color); |
| 788 | |
| 789 | Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate(); |
| 790 | style_tab_unselected->set_bg_color(p_config.surface_lowest_color); |
| 791 | style_tab_unselected->set_border_width_all(0); |
| 792 | |
| 793 | Ref<StyleBoxFlat> style_tab_hovered = style_tab_unselected->duplicate(); |
| 794 | style_tab_hovered->set_bg_color(p_config.surface_base_color * Color(1, 1, 1, 0.6)); |
| 795 | |
| 796 | Color drop_mark_color = p_config.dark_color_2.lerp(p_config.accent_color, 0.75); |
| 797 | |
| 798 | Ref<StyleBoxFlat> style_tabbar_background = p_config.base_style->duplicate(); |
| 799 | style_tabbar_background->set_bg_color(p_config.surface_lowest_color); |
| 800 | style_tabbar_background->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 801 | style_tabbar_background->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 802 | style_tabbar_background->set_content_margin_individual(0, 0, p_config.base_margin * 0.25 * EDSCALE, 0); |
| 803 | |
| 804 | p_theme->set_stylebox("tabbar_background", "TabContainer", style_tabbar_background); |
| 805 | p_theme->set_stylebox(SceneStringName(panel), "TabContainer", p_config.tab_container_style); |
| 806 | |
| 807 | p_theme->set_stylebox("tab_selected", "TabContainer", style_tab_selected); |
| 808 | p_theme->set_stylebox("tab_hovered", "TabContainer", style_tab_hovered); |
| 809 | p_theme->set_stylebox("tab_unselected", "TabContainer", style_tab_unselected); |
| 810 | p_theme->set_stylebox("tab_disabled", "TabContainer", style_tab_unselected); |
| 811 | p_theme->set_stylebox("tab_focus", "TabContainer", p_config.focus_style); |
| 812 | p_theme->set_stylebox("tab_selected", "TabBar", style_tab_selected); |
| 813 | p_theme->set_stylebox("tab_hovered", "TabBar", style_tab_hovered); |
| 814 | p_theme->set_stylebox("tab_unselected", "TabBar", style_tab_unselected); |
| 815 | p_theme->set_stylebox("tab_disabled", "TabBar", style_tab_unselected); |
| 816 | p_theme->set_stylebox("tab_focus", "TabBar", p_config.focus_style); |
| 817 | p_theme->set_stylebox("button_pressed", "TabBar", p_config.panel_container_style); |
| 818 | p_theme->set_stylebox("button_highlight", "TabBar", p_config.panel_container_style); |
| 819 | |
| 820 | p_theme->set_color("font_selected_color", "TabContainer", p_config.font_color); |
| 821 | p_theme->set_color("font_hovered_color", "TabContainer", p_config.font_hover_color); |
| 822 | p_theme->set_color("font_unselected_color", "TabContainer", p_config.font_secondary_color); |
| 823 | p_theme->set_color("font_disabled_color", "TabContainer", p_config.font_disabled_color * Color(1, 1, 1, 0.55)); |
| 824 | p_theme->set_color("font_outline_color", "TabContainer", p_config.font_outline_color); |
| 825 | p_theme->set_color("font_selected_color", "TabBar", p_config.font_color); |
| 826 | p_theme->set_color("font_hovered_color", "TabBar", p_config.font_hover_color); |
| 827 | p_theme->set_color("font_unselected_color", "TabBar", p_config.font_secondary_color); |
| 828 | p_theme->set_color("font_disabled_color", "TabBar", p_config.font_disabled_color * Color(1, 1, 1, 0.55)); |
| 829 | p_theme->set_color("font_outline_color", "TabBar", p_config.font_outline_color); |
| 830 | p_theme->set_color("drop_mark_color", "TabContainer", drop_mark_color); |
| 831 | p_theme->set_color("drop_mark_color", "TabBar", drop_mark_color); |
| 832 | |
| 833 | p_theme->set_color("icon_selected_color", "TabContainer", p_config.icon_normal_color); |
| 834 | p_theme->set_color("icon_hovered_color", "TabContainer", p_config.icon_hover_color); |
| 835 | p_theme->set_color("icon_unselected_color", "TabContainer", p_config.icon_secondary_color); |
| 836 | p_theme->set_color("icon_disabled_color", "TabContainer", p_config.icon_disabled_color * Color(1, 1, 1, 0.55)); |
| 837 | p_theme->set_color("icon_selected_color", "TabBar", p_config.icon_normal_color); |
| 838 | p_theme->set_color("icon_hovered_color", "TabBar", p_config.icon_hover_color); |
| 839 | p_theme->set_color("icon_unselected_color", "TabBar", p_config.icon_secondary_color); |
| 840 | p_theme->set_color("icon_disabled_color", "TabBar", p_config.icon_disabled_color * Color(1, 1, 1, 0.55)); |
| 841 | |
| 842 | p_theme->set_icon("menu", "TabContainer", p_theme->get_icon(SNAME("GuiTabMenu"), EditorStringName(EditorIcons))); |
| 843 | p_theme->set_icon("menu_highlight", "TabContainer", p_theme->get_icon(SNAME("GuiTabMenuHl"), EditorStringName(EditorIcons))); |
| 844 | p_theme->set_icon("close", "TabBar", p_theme->get_icon(SNAME("GuiClose"), EditorStringName(EditorIcons))); |
| 845 | p_theme->set_icon("increment", "TabContainer", p_theme->get_icon(SNAME("GuiScrollArrowRight"), EditorStringName(EditorIcons))); |
| 846 | p_theme->set_icon("decrement", "TabContainer", p_theme->get_icon(SNAME("GuiScrollArrowLeft"), EditorStringName(EditorIcons))); |
| 847 | p_theme->set_icon("increment", "TabBar", p_theme->get_icon(SNAME("GuiScrollArrowRight"), EditorStringName(EditorIcons))); |
| 848 | p_theme->set_icon("decrement", "TabBar", p_theme->get_icon(SNAME("GuiScrollArrowLeft"), EditorStringName(EditorIcons))); |
| 849 | p_theme->set_icon("increment_highlight", "TabBar", p_theme->get_icon(SNAME("GuiScrollArrowRightHl"), EditorStringName(EditorIcons))); |
| 850 | p_theme->set_icon("decrement_highlight", "TabBar", p_theme->get_icon(SNAME("GuiScrollArrowLeftHl"), EditorStringName(EditorIcons))); |
| 851 | p_theme->set_icon("increment_highlight", "TabContainer", p_theme->get_icon(SNAME("GuiScrollArrowRightHl"), EditorStringName(EditorIcons))); |
| 852 | p_theme->set_icon("decrement_highlight", "TabContainer", p_theme->get_icon(SNAME("GuiScrollArrowLeftHl"), EditorStringName(EditorIcons))); |
| 853 | p_theme->set_icon("drop_mark", "TabContainer", p_theme->get_icon(SNAME("GuiTabDropMark"), EditorStringName(EditorIcons))); |
| 854 | p_theme->set_icon("drop_mark", "TabBar", p_theme->get_icon(SNAME("GuiTabDropMark"), EditorStringName(EditorIcons))); |
| 855 | |
| 856 | p_theme->set_constant("side_margin", "TabContainer", 0); |
| 857 | p_theme->set_constant("outline_size", "TabContainer", 0); |
| 858 | p_theme->set_constant("h_separation", "TabBar", 4 * EDSCALE); |
| 859 | p_theme->set_constant("outline_size", "TabBar", 0); |
| 860 | p_theme->set_constant("hover_switch_wait_msec", "TabBar", p_config.dragging_hover_wait_msec); |
| 861 | } |
| 862 | |
| 863 | // Separators. |
| 864 | { |
| 865 | Ref<StyleBoxLine> style_h_separator = EditorThemeManager::make_line_stylebox(p_config.separator_color, Math::round(2 * EDSCALE), p_config.base_margin * -1 * EDSCALE, p_config.base_margin * -1 * EDSCALE); |
| 866 | p_theme->set_stylebox("separator", "HSeparator", style_h_separator); |
| 867 | |
| 868 | Ref<StyleBoxLine> style_v_separator = style_h_separator->duplicate(); |
| 869 | style_v_separator->set_vertical(true); |
| 870 | p_theme->set_stylebox("separator", "VSeparator", style_v_separator); |
| 871 | |
| 872 | p_theme->set_constant("separation", "Separator", p_config.base_margin * 2 * EDSCALE); |
| 873 | } |
| 874 | |
| 875 | // LineEdit & TextEdit. |
| 876 | { |
| 877 | Ref<StyleBoxFlat> text_editor_style = p_config.base_style->duplicate(); |
| 878 | text_editor_style->set_bg_color(p_config.surface_lower_color); |
| 879 | text_editor_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, ((p_config.base_margin * 0.75) + 1) * EDSCALE, p_config.base_margin * 2 * EDSCALE, ((p_config.base_margin * 0.75) + 1) * EDSCALE); |
| 880 | if (p_config.draw_extra_borders) { |
| 881 | text_editor_style->set_border_width_all(Math::round(EDSCALE)); |
| 882 | text_editor_style->set_border_color(p_config.extra_border_color_1); |
| 883 | } |
| 884 | |
| 885 | Ref<StyleBoxFlat> text_editor_disabled_style = text_editor_style->duplicate(); |
| 886 | // Using transparent background for readonly otherwise it looks bad in the master audio bus. |
| 887 | text_editor_disabled_style->set_bg_color(p_config.dark_theme ? Color(0, 0, 0, 0.2) : Color(1, 1, 1, 0.5)); |
| 888 | |
| 889 | // LineEdit. |
| 890 | |
| 891 | p_theme->set_stylebox(CoreStringName(normal), "LineEdit", text_editor_style); |
| 892 | p_theme->set_stylebox("focus", "LineEdit", p_config.focus_style); |
| 893 | p_theme->set_stylebox("read_only", "LineEdit", text_editor_disabled_style); |
| 894 | |
| 895 | p_theme->set_icon("clear", "LineEdit", p_theme->get_icon(SNAME("GuiClose"), EditorStringName(EditorIcons))); |
| 896 | |
| 897 | p_theme->set_color(SceneStringName(font_color), "LineEdit", p_config.font_color); |
| 898 | p_theme->set_color("font_selected_color", "LineEdit", p_config.font_pressed_color); |
| 899 | p_theme->set_color("font_uneditable_color", "LineEdit", p_config.font_readonly_color); |
| 900 | p_theme->set_color("font_placeholder_color", "LineEdit", p_config.font_placeholder_color); |
| 901 | p_theme->set_color("font_outline_color", "LineEdit", p_config.font_outline_color); |
| 902 | p_theme->set_color("caret_color", "LineEdit", p_config.font_color); |
| 903 | p_theme->set_color("selection_color", "LineEdit", p_config.selection_color); |
| 904 | p_theme->set_color("clear_button_color", "LineEdit", p_config.font_color); |
| 905 | p_theme->set_color("clear_button_color_pressed", "LineEdit", p_config.accent_color); |
| 906 | |
| 907 | p_theme->set_constant("minimum_character_width", "LineEdit", 4); |
| 908 | p_theme->set_constant("outline_size", "LineEdit", 0); |
| 909 | p_theme->set_constant("caret_width", "LineEdit", 1); |
| 910 | |
| 911 | // TextEdit. |
| 912 | |
| 913 | p_theme->set_stylebox(CoreStringName(normal), "TextEdit", text_editor_style); |
| 914 | p_theme->set_stylebox("focus", "TextEdit", p_config.focus_style); |
| 915 | p_theme->set_stylebox("read_only", "TextEdit", text_editor_disabled_style); |
| 916 | |
| 917 | p_theme->set_icon("tab", "TextEdit", p_theme->get_icon(SNAME("GuiTab"), EditorStringName(EditorIcons))); |
| 918 | p_theme->set_icon("space", "TextEdit", p_theme->get_icon(SNAME("GuiSpace"), EditorStringName(EditorIcons))); |
| 919 | |
| 920 | p_theme->set_color(SceneStringName(font_color), "TextEdit", p_config.font_color); |
| 921 | p_theme->set_color("font_readonly_color", "TextEdit", p_config.font_readonly_color); |
| 922 | p_theme->set_color("font_placeholder_color", "TextEdit", p_config.font_placeholder_color); |
| 923 | p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color); |
| 924 | p_theme->set_color("caret_color", "TextEdit", p_config.font_color); |
| 925 | p_theme->set_color("selection_color", "TextEdit", p_config.selection_color); |
| 926 | |
| 927 | p_theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE); |
| 928 | p_theme->set_constant("outline_size", "TextEdit", 0); |
| 929 | p_theme->set_constant("caret_width", "TextEdit", 1); |
| 930 | } |
| 931 | |
| 932 | // Containers. |
| 933 | { |
| 934 | p_theme->set_constant("separation", "BoxContainer", p_config.separation_margin); |
| 935 | p_theme->set_constant("separation", "HBoxContainer", p_config.separation_margin); |
| 936 | p_theme->set_constant("separation", "VBoxContainer", p_config.separation_margin); |
| 937 | p_theme->set_constant("margin_left", "MarginContainer", 0); |
| 938 | p_theme->set_constant("margin_top", "MarginContainer", 0); |
| 939 | p_theme->set_constant("margin_right", "MarginContainer", 0); |
| 940 | p_theme->set_constant("margin_bottom", "MarginContainer", 0); |
| 941 | p_theme->set_constant("h_separation", "GridContainer", p_config.separation_margin); |
| 942 | p_theme->set_constant("v_separation", "GridContainer", p_config.separation_margin); |
| 943 | p_theme->set_constant("h_separation", "FlowContainer", p_config.separation_margin); |
| 944 | p_theme->set_constant("v_separation", "FlowContainer", p_config.separation_margin); |
| 945 | p_theme->set_constant("h_separation", "HFlowContainer", p_config.separation_margin); |
| 946 | p_theme->set_constant("v_separation", "HFlowContainer", p_config.separation_margin); |
| 947 | p_theme->set_constant("h_separation", "VFlowContainer", p_config.separation_margin); |
| 948 | p_theme->set_constant("v_separation", "VFlowContainer", p_config.separation_margin); |
| 949 | |
| 950 | // SplitContainer. |
| 951 | |
| 952 | p_theme->set_icon("h_grabber", "SplitContainer", p_theme->get_icon(SNAME("GuiHsplitter"), EditorStringName(EditorIcons))); |
| 953 | p_theme->set_icon("v_grabber", "SplitContainer", p_theme->get_icon(SNAME("GuiVsplitter"), EditorStringName(EditorIcons))); |
| 954 | p_theme->set_icon("grabber", "VSplitContainer", p_theme->get_icon(SNAME("GuiVsplitter"), EditorStringName(EditorIcons))); |
| 955 | p_theme->set_icon("grabber", "HSplitContainer", p_theme->get_icon(SNAME("GuiHsplitter"), EditorStringName(EditorIcons))); |
| 956 | |
| 957 | p_theme->set_constant("separation", "SplitContainer", p_config.base_margin * 0.75 * EDSCALE); |
| 958 | p_theme->set_constant("separation", "HSplitContainer", p_config.base_margin * 0.75 * EDSCALE); |
| 959 | p_theme->set_constant("separation", "VSplitContainer", p_config.base_margin * 0.75 * EDSCALE); |
| 960 | |
| 961 | p_theme->set_constant("autohide", "SplitContainer", 1); |
| 962 | p_theme->set_constant("autohide", "HSplitContainer", 1); |
| 963 | p_theme->set_constant("autohide", "VSplitContainer", 1); |
| 964 | |
| 965 | p_theme->set_constant("minimum_grab_thickness", "SplitContainer", p_config.base_margin * 2 * EDSCALE); |
| 966 | p_theme->set_constant("minimum_grab_thickness", "HSplitContainer", p_config.base_margin * 2 * EDSCALE); |
| 967 | p_theme->set_constant("minimum_grab_thickness", "VSplitContainer", p_config.base_margin * 2 * EDSCALE); |
| 968 | |
| 969 | // GridContainer. |
| 970 | p_theme->set_constant("v_separation", "GridContainer", Math::round(p_config.widget_margin.y - 2 * EDSCALE)); |
| 971 | |
| 972 | // FoldableContainer |
| 973 | |
| 974 | Ref<StyleBoxFlat> foldable_container_title = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1.darkened(0.125), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin); |
| 975 | foldable_container_title->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 976 | foldable_container_title->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 977 | p_theme->set_stylebox("title_panel", "FoldableContainer", foldable_container_title); |
| 978 | Ref<StyleBoxFlat> foldable_container_hover = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1.lerp(p_config.base_color, 0.4), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin); |
| 979 | foldable_container_hover->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 980 | foldable_container_hover->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 981 | p_theme->set_stylebox("title_hover_panel", "FoldableContainer", foldable_container_hover); |
| 982 | p_theme->set_stylebox("title_collapsed_panel", "FoldableContainer", EditorThemeManager::make_flat_stylebox(p_config.dark_color_1.darkened(0.125), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin)); |
| 983 | p_theme->set_stylebox("title_collapsed_hover_panel", "FoldableContainer", EditorThemeManager::make_flat_stylebox(p_config.dark_color_1.lerp(p_config.base_color, 0.4), p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin)); |
| 984 | Ref<StyleBoxFlat> foldable_container_panel = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1, p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin); |
| 985 | foldable_container_panel->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 986 | foldable_container_panel->set_corner_radius(CORNER_TOP_RIGHT, 0); |
| 987 | p_theme->set_stylebox(SceneStringName(panel), "FoldableContainer", foldable_container_panel); |
| 988 | p_theme->set_stylebox("focus", "FoldableContainer", p_config.focus_style); |
| 989 | |
| 990 | p_theme->set_font(SceneStringName(font), "FoldableContainer", p_theme->get_font(SceneStringName(font), SNAME("HeaderSmall"))); |
| 991 | p_theme->set_font_size(SceneStringName(font_size), "FoldableContainer", p_theme->get_font_size(SceneStringName(font_size), SNAME("HeaderSmall"))); |
| 992 | |
| 993 | p_theme->set_color(SceneStringName(font_color), "FoldableContainer", p_config.font_color); |
| 994 | p_theme->set_color("hover_font_color", "FoldableContainer", p_config.font_hover_color); |
| 995 | p_theme->set_color("collapsed_font_color", "FoldableContainer", p_config.font_pressed_color); |
| 996 | p_theme->set_color("font_outline_color", "FoldableContainer", p_config.font_outline_color); |
| 997 | |
| 998 | p_theme->set_icon("expanded_arrow", "FoldableContainer", p_theme->get_icon(SNAME("GuiTreeArrowDown"), EditorStringName(EditorIcons))); |
| 999 | p_theme->set_icon("expanded_arrow_mirrored", "FoldableContainer", p_theme->get_icon(SNAME("GuiArrowUp"), EditorStringName(EditorIcons))); |
| 1000 | p_theme->set_icon("folded_arrow", "FoldableContainer", p_theme->get_icon(SNAME("GuiTreeArrowRight"), EditorStringName(EditorIcons))); |
| 1001 | p_theme->set_icon("folded_arrow_mirrored", "FoldableContainer", p_theme->get_icon(SNAME("GuiTreeArrowLeft"), EditorStringName(EditorIcons))); |
| 1002 | |
| 1003 | p_theme->set_constant("outline_size", "FoldableContainer", 0); |
| 1004 | p_theme->set_constant("h_separation", "FoldableContainer", p_config.separation_margin); |
| 1005 | } |
| 1006 | |
| 1007 | // Window and dialogs. |
| 1008 | { |
| 1009 | // Window. |
| 1010 | |
| 1011 | p_theme->set_stylebox("embedded_border", "Window", p_config.window_style); |
| 1012 | p_theme->set_stylebox("embedded_unfocused_border", "Window", p_config.window_style); |
| 1013 | |
| 1014 | p_theme->set_color("title_color", "Window", p_config.font_color); |
| 1015 | p_theme->set_icon("close", "Window", p_theme->get_icon(SNAME("GuiClose"), EditorStringName(EditorIcons))); |
| 1016 | p_theme->set_icon("close_pressed", "Window", p_theme->get_icon(SNAME("GuiClose"), EditorStringName(EditorIcons))); |
| 1017 | p_theme->set_constant("close_h_offset", "Window", 22 * EDSCALE); |
| 1018 | p_theme->set_constant("close_v_offset", "Window", 20 * EDSCALE); |
| 1019 | p_theme->set_constant("title_height", "Window", 24 * EDSCALE); |
| 1020 | p_theme->set_constant("resize_margin", "Window", 4 * EDSCALE); |
| 1021 | p_theme->set_font("title_font", "Window", p_theme->get_font(SNAME("title"), EditorStringName(EditorFonts))); |
| 1022 | p_theme->set_font_size("title_font_size", "Window", p_theme->get_font_size(SNAME("title_size"), EditorStringName(EditorFonts))); |
| 1023 | |
| 1024 | // AcceptDialog. |
| 1025 | p_theme->set_stylebox(SceneStringName(panel), "AcceptDialog", p_config.dialog_style); |
| 1026 | p_theme->set_constant("buttons_separation", "AcceptDialog", 8 * EDSCALE); |
| 1027 | // Make buttons with short texts such as "OK" easier to click/tap. |
| 1028 | p_theme->set_constant("buttons_min_width", "AcceptDialog", p_config.dialogs_buttons_min_size.x * EDSCALE); |
| 1029 | p_theme->set_constant("buttons_min_height", "AcceptDialog", p_config.dialogs_buttons_min_size.y * EDSCALE); |
| 1030 | |
| 1031 | // FileDialog. |
| 1032 | p_theme->set_icon("folder", "FileDialog", p_theme->get_icon("Folder", EditorStringName(EditorIcons))); |
| 1033 | p_theme->set_icon("file", "FileDialog", p_theme->get_icon("File", EditorStringName(EditorIcons))); |
| 1034 | p_theme->set_icon("folder_thumbnail", "FileDialog", p_theme->get_icon("FolderBigThumb", EditorStringName(EditorIcons))); |
| 1035 | p_theme->set_icon("file_thumbnail", "FileDialog", p_theme->get_icon("FileBigThumb", EditorStringName(EditorIcons))); |
| 1036 | p_theme->set_icon("parent_folder", "FileDialog", p_theme->get_icon("ArrowUp", EditorStringName(EditorIcons))); |
| 1037 | p_theme->set_icon("back_folder", "FileDialog", p_theme->get_icon("Back", EditorStringName(EditorIcons))); |
| 1038 | p_theme->set_icon("forward_folder", "FileDialog", p_theme->get_icon("Forward", EditorStringName(EditorIcons))); |
| 1039 | p_theme->set_icon("reload", "FileDialog", p_theme->get_icon("Reload", EditorStringName(EditorIcons))); |
| 1040 | p_theme->set_icon("toggle_hidden", "FileDialog", p_theme->get_icon("GuiVisibilityVisible", EditorStringName(EditorIcons))); |
| 1041 | p_theme->set_icon("toggle_filename_filter", "FileDialog", p_theme->get_icon("FilenameFilter", EditorStringName(EditorIcons))); |
| 1042 | p_theme->set_icon("thumbnail_mode", "FileDialog", p_theme->get_icon("FileThumbnail", EditorStringName(EditorIcons))); |
| 1043 | p_theme->set_icon("list_mode", "FileDialog", p_theme->get_icon("FileList", EditorStringName(EditorIcons))); |
| 1044 | p_theme->set_icon("sort", "FileDialog", p_theme->get_icon("Sort", EditorStringName(EditorIcons))); |
| 1045 | p_theme->set_icon("favorite", "FileDialog", p_theme->get_icon("Favorites", EditorStringName(EditorIcons))); |
| 1046 | p_theme->set_icon("favorite_up", "FileDialog", p_theme->get_icon("MoveUp", EditorStringName(EditorIcons))); |
| 1047 | p_theme->set_icon("favorite_down", "FileDialog", p_theme->get_icon("MoveDown", EditorStringName(EditorIcons))); |
| 1048 | p_theme->set_icon("create_folder", "FileDialog", p_theme->get_icon("FolderCreate", EditorStringName(EditorIcons))); |
| 1049 | // Use a different color for folder icons to make them easier to distinguish from files. |
| 1050 | // On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color. |
| 1051 | p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7)); |
| 1052 | p_theme->set_color("file_disabled_color", "FileDialog", p_config.font_disabled_color); |
| 1053 | |
| 1054 | p_theme->set_constant("thumbnail_size", "EditorFileDialog", p_config.thumb_size); |
| 1055 | |
| 1056 | // PopupDialog. |
| 1057 | p_theme->set_stylebox(SceneStringName(panel), "PopupDialog", p_config.dialog_style); |
| 1058 | |
| 1059 | // PopupMenu. |
| 1060 | { |
| 1061 | Ref<StyleBoxFlat> style_popup_menu = p_config.base_style->duplicate(); |
| 1062 | style_popup_menu->set_bg_color(p_config.surface_popup_color); |
| 1063 | style_popup_menu->set_content_margin_all(p_config.popup_margin); |
| 1064 | style_popup_menu->set_corner_radius_all(0); |
| 1065 | if (p_config.draw_extra_borders) { |
| 1066 | style_popup_menu->set_border_width_all(Math::round(EDSCALE)); |
| 1067 | style_popup_menu->set_border_color(p_config.extra_border_color_2); |
| 1068 | } |
| 1069 | p_theme->set_stylebox(SceneStringName(panel), "PopupMenu", style_popup_menu); |
| 1070 | |
| 1071 | Ref<StyleBoxFlat> style_popup_hover = p_config.flat_button_hover->duplicate(); |
| 1072 | style_popup_hover->set_bg_color(_get_base_color(p_config, -0.5, 0.75)); |
| 1073 | |
| 1074 | p_theme->set_stylebox(SceneStringName(hover), "PopupMenu", style_popup_hover); |
| 1075 | |
| 1076 | Ref<StyleBoxLine> style_popup_separator = EditorThemeManager::make_line_stylebox(p_config.mono_color * Color(1, 1, 1, p_config.dark_theme ? 0.075 : 0.125), Math::round(2 * EDSCALE), p_config.base_margin * -2 * EDSCALE, p_config.base_margin * -2 * EDSCALE); |
| 1077 | |
| 1078 | p_theme->set_stylebox("separator", "PopupMenu", style_popup_separator); |
| 1079 | p_theme->set_stylebox("labeled_separator_left", "PopupMenu", style_popup_separator); |
| 1080 | p_theme->set_stylebox("labeled_separator_right", "PopupMenu", style_popup_separator); |
| 1081 | |
| 1082 | p_theme->set_color(SceneStringName(font_color), "PopupMenu", p_config.font_color); |
| 1083 | p_theme->set_color("font_hover_color", "PopupMenu", p_config.font_hover_color); |
| 1084 | p_theme->set_color("font_accelerator_color", "PopupMenu", p_config.font_disabled_color); |
| 1085 | p_theme->set_color("font_disabled_color", "PopupMenu", p_config.font_disabled_color); |
| 1086 | p_theme->set_color("font_separator_color", "PopupMenu", p_config.font_disabled_color); |
| 1087 | p_theme->set_color("font_outline_color", "PopupMenu", p_config.font_outline_color); |
| 1088 | |
| 1089 | p_theme->set_icon("checked", "PopupMenu", p_theme->get_icon(SNAME("GuiChecked"), EditorStringName(EditorIcons))); |
| 1090 | p_theme->set_icon("unchecked", "PopupMenu", p_theme->get_icon(SNAME("GuiUnchecked"), EditorStringName(EditorIcons))); |
| 1091 | p_theme->set_icon("radio_checked", "PopupMenu", p_theme->get_icon(SNAME("GuiRadioChecked"), EditorStringName(EditorIcons))); |
| 1092 | p_theme->set_icon("radio_unchecked", "PopupMenu", p_theme->get_icon(SNAME("GuiRadioUnchecked"), EditorStringName(EditorIcons))); |
| 1093 | p_theme->set_icon("checked_disabled", "PopupMenu", p_theme->get_icon(SNAME("GuiCheckedDisabled"), EditorStringName(EditorIcons))); |
| 1094 | p_theme->set_icon("unchecked_disabled", "PopupMenu", p_theme->get_icon(SNAME("GuiUncheckedDisabled"), EditorStringName(EditorIcons))); |
| 1095 | p_theme->set_icon("radio_checked_disabled", "PopupMenu", p_theme->get_icon(SNAME("GuiRadioCheckedDisabled"), EditorStringName(EditorIcons))); |
| 1096 | p_theme->set_icon("radio_unchecked_disabled", "PopupMenu", p_theme->get_icon(SNAME("GuiRadioUncheckedDisabled"), EditorStringName(EditorIcons))); |
| 1097 | p_theme->set_icon("submenu", "PopupMenu", p_theme->get_icon(SNAME("ArrowRight"), EditorStringName(EditorIcons))); |
| 1098 | p_theme->set_icon("submenu_mirrored", "PopupMenu", p_theme->get_icon(SNAME("ArrowLeft"), EditorStringName(EditorIcons))); |
| 1099 | |
| 1100 | p_theme->set_constant("h_separation", "PopupMenu", p_config.base_margin * 1.75 * EDSCALE); |
| 1101 | int v_sep = (p_config.enable_touch_optimizations ? 12 : p_config.base_margin * 1.75) * EDSCALE; |
| 1102 | p_theme->set_constant("v_separation", "PopupMenu", v_sep); |
| 1103 | p_theme->set_constant("outline_size", "PopupMenu", 0); |
| 1104 | p_theme->set_constant("item_start_padding", "PopupMenu", p_config.popup_margin); |
| 1105 | p_theme->set_constant("item_end_padding", "PopupMenu", p_config.popup_margin); |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | // Sliders and scrollbars. |
| 1110 | { |
| 1111 | Ref<Texture2D> empty_icon = memnew(ImageTexture); |
| 1112 | |
| 1113 | Ref<StyleBoxFlat> grabber_style = p_config.base_style->duplicate(); |
| 1114 | grabber_style->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.225)); |
| 1115 | |
| 1116 | Ref<StyleBoxFlat> grabber_hl_style = p_config.base_style->duplicate(); |
| 1117 | grabber_hl_style->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.5)); |
| 1118 | |
| 1119 | int scroll_margin = (p_config.enable_touch_optimizations ? 10 : 3) * EDSCALE; |
| 1120 | |
| 1121 | // HScrollBar. |
| 1122 | |
| 1123 | Ref<StyleBoxEmpty> h_scroll_style = p_config.base_empty_style->duplicate(); |
| 1124 | h_scroll_style->set_content_margin_individual(0, scroll_margin, 0, scroll_margin); |
| 1125 | |
| 1126 | p_theme->set_stylebox("scroll", "HScrollBar", h_scroll_style); |
| 1127 | p_theme->set_stylebox("scroll_focus", "HScrollBar", p_config.focus_style); |
| 1128 | p_theme->set_stylebox("grabber", "HScrollBar", grabber_style); |
| 1129 | p_theme->set_stylebox("grabber_highlight", "HScrollBar", grabber_hl_style); |
| 1130 | p_theme->set_stylebox("grabber_pressed", "HScrollBar", grabber_hl_style); |
| 1131 | |
| 1132 | p_theme->set_icon("increment", "HScrollBar", empty_icon); |
| 1133 | p_theme->set_icon("increment_highlight", "HScrollBar", empty_icon); |
| 1134 | p_theme->set_icon("increment_pressed", "HScrollBar", empty_icon); |
| 1135 | p_theme->set_icon("decrement", "HScrollBar", empty_icon); |
| 1136 | p_theme->set_icon("decrement_highlight", "HScrollBar", empty_icon); |
| 1137 | p_theme->set_icon("decrement_pressed", "HScrollBar", empty_icon); |
| 1138 | |
| 1139 | p_theme->set_constant("padding_top", "HScrollBar", p_config.base_margin * EDSCALE); |
| 1140 | p_theme->set_constant("padding_bottom", "HScrollBar", p_config.base_margin * EDSCALE); |
| 1141 | |
| 1142 | // VScrollBar. |
| 1143 | |
| 1144 | Ref<StyleBoxEmpty> v_scroll_style = p_config.base_empty_style->duplicate(); |
| 1145 | v_scroll_style->set_content_margin_individual(scroll_margin, 0, scroll_margin, 0); |
| 1146 | |
| 1147 | p_theme->set_stylebox("scroll", "VScrollBar", v_scroll_style); |
| 1148 | p_theme->set_stylebox("scroll_focus", "VScrollBar", p_config.focus_style); |
| 1149 | p_theme->set_stylebox("grabber", "VScrollBar", grabber_style); |
| 1150 | p_theme->set_stylebox("grabber_highlight", "VScrollBar", grabber_hl_style); |
| 1151 | p_theme->set_stylebox("grabber_pressed", "VScrollBar", grabber_hl_style); |
| 1152 | |
| 1153 | p_theme->set_icon("increment", "VScrollBar", empty_icon); |
| 1154 | p_theme->set_icon("increment_highlight", "VScrollBar", empty_icon); |
| 1155 | p_theme->set_icon("increment_pressed", "VScrollBar", empty_icon); |
| 1156 | p_theme->set_icon("decrement", "VScrollBar", empty_icon); |
| 1157 | p_theme->set_icon("decrement_highlight", "VScrollBar", empty_icon); |
| 1158 | p_theme->set_icon("decrement_pressed", "VScrollBar", empty_icon); |
| 1159 | |
| 1160 | p_theme->set_constant("padding_left", "VScrollBar", p_config.base_margin * EDSCALE); |
| 1161 | p_theme->set_constant("padding_right", "VScrollBar", p_config.base_margin * EDSCALE); |
| 1162 | |
| 1163 | // Slider |
| 1164 | const int background_margin = MAX(2, p_config.base_margin / 2); |
| 1165 | |
| 1166 | Ref<StyleBoxFlat> style_h_slider = p_config.base_style->duplicate(); |
| 1167 | style_h_slider->set_bg_color(p_config.mono_color_inv * Color(1, 1, 1, 0.35)); |
| 1168 | style_h_slider->set_content_margin_individual(0, 2 * EDSCALE, 0, 2 * EDSCALE); |
| 1169 | |
| 1170 | // HSlider. |
| 1171 | p_theme->set_icon("grabber_highlight", "HSlider", p_theme->get_icon(SNAME("GuiSliderGrabberHl"), EditorStringName(EditorIcons))); |
| 1172 | p_theme->set_icon("grabber", "HSlider", p_theme->get_icon(SNAME("GuiSliderGrabber"), EditorStringName(EditorIcons))); |
| 1173 | p_theme->set_stylebox("slider", "HSlider", style_h_slider); |
| 1174 | p_theme->set_stylebox("grabber_area", "HSlider", EditorThemeManager::make_flat_stylebox(p_config.contrast_color_1, 0, background_margin, 0, background_margin, p_config.corner_radius)); |
| 1175 | p_theme->set_stylebox("grabber_area_highlight", "HSlider", EditorThemeManager::make_flat_stylebox(p_config.contrast_color_1, 0, background_margin, 0, background_margin)); |
| 1176 | p_theme->set_constant("center_grabber", "HSlider", 0); |
| 1177 | p_theme->set_constant("grabber_offset", "HSlider", 0); |
| 1178 | |
| 1179 | Ref<StyleBoxFlat> style_v_slider = style_h_slider->duplicate(); |
| 1180 | style_v_slider->set_content_margin_individual(2 * EDSCALE, 0, 2 * EDSCALE, 0); |
| 1181 | |
| 1182 | // VSlider. |
| 1183 | p_theme->set_icon("grabber", "VSlider", p_theme->get_icon(SNAME("GuiSliderGrabber"), EditorStringName(EditorIcons))); |
| 1184 | p_theme->set_icon("grabber_highlight", "VSlider", p_theme->get_icon(SNAME("GuiSliderGrabberHl"), EditorStringName(EditorIcons))); |
| 1185 | p_theme->set_stylebox("slider", "VSlider", style_v_slider); |
| 1186 | p_theme->set_stylebox("grabber_area", "VSlider", EditorThemeManager::make_flat_stylebox(p_config.contrast_color_1, background_margin, 0, background_margin, 0, p_config.corner_radius)); |
| 1187 | p_theme->set_stylebox("grabber_area_highlight", "VSlider", EditorThemeManager::make_flat_stylebox(p_config.contrast_color_1, background_margin, 0, background_margin, 0)); |
| 1188 | p_theme->set_constant("center_grabber", "VSlider", 0); |
| 1189 | p_theme->set_constant("grabber_offset", "VSlider", 0); |
| 1190 | } |
| 1191 | |
| 1192 | // Labels. |
| 1193 | { |
| 1194 | // RichTextLabel. |
| 1195 | |
| 1196 | Ref<StyleBoxFlat> rich_text_style = p_config.base_style->duplicate(); |
| 1197 | rich_text_style->set_bg_color(p_config.surface_low_color); |
| 1198 | rich_text_style->set_content_margin_all(p_config.base_margin * 2 * EDSCALE); |
| 1199 | |
| 1200 | p_theme->set_stylebox(CoreStringName(normal), "RichTextLabel", rich_text_style); |
| 1201 | p_theme->set_stylebox("focus", "RichTextLabel", EditorThemeManager::make_empty_stylebox()); |
| 1202 | |
| 1203 | p_theme->set_color("default_color", "RichTextLabel", p_config.font_color); |
| 1204 | p_theme->set_color("font_shadow_color", "RichTextLabel", Color(1, 1, 1, 0)); |
| 1205 | p_theme->set_color("font_outline_color", "RichTextLabel", p_config.font_outline_color); |
| 1206 | p_theme->set_color("selection_color", "RichTextLabel", p_config.selection_color); |
| 1207 | |
| 1208 | p_theme->set_constant("shadow_offset_x", "RichTextLabel", 1 * EDSCALE); |
| 1209 | p_theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * EDSCALE); |
| 1210 | p_theme->set_constant("shadow_outline_size", "RichTextLabel", 1 * EDSCALE); |
| 1211 | p_theme->set_constant("outline_size", "RichTextLabel", 0); |
| 1212 | |
| 1213 | // Label. |
| 1214 | |
| 1215 | Ref<StyleBoxEmpty> label_style = p_config.base_empty_style->duplicate(); |
| 1216 | label_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE); |
| 1217 | |
| 1218 | p_theme->set_stylebox(CoreStringName(normal), "Label", label_style); |
| 1219 | p_theme->set_stylebox("focus", "Label", p_config.focus_style); |
| 1220 | |
| 1221 | p_theme->set_color(SceneStringName(font_color), "Label", p_config.font_color); |
| 1222 | p_theme->set_color("font_shadow_color", "Label", Color(1, 1, 1, 0)); |
| 1223 | p_theme->set_color("font_outline_color", "Label", p_config.font_outline_color); |
| 1224 | |
| 1225 | p_theme->set_constant("shadow_offset_x", "Label", 1 * EDSCALE); |
| 1226 | p_theme->set_constant("shadow_offset_y", "Label", 1 * EDSCALE); |
| 1227 | p_theme->set_constant("shadow_outline_size", "Label", 1 * EDSCALE); |
| 1228 | p_theme->set_constant("line_spacing", "Label", 3 * EDSCALE); |
| 1229 | p_theme->set_constant("outline_size", "Label", 0); |
| 1230 | } |
| 1231 | |
| 1232 | // SpinBox. |
| 1233 | { |
| 1234 | Ref<Texture2D> empty_icon = memnew(ImageTexture); |
| 1235 | p_theme->set_icon("updown", "SpinBox", empty_icon); |
| 1236 | p_theme->set_icon("up", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons))); |
| 1237 | p_theme->set_icon("up_hover", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons))); |
| 1238 | p_theme->set_icon("up_pressed", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons))); |
| 1239 | p_theme->set_icon("up_disabled", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons))); |
| 1240 | p_theme->set_icon("down", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons))); |
| 1241 | p_theme->set_icon("down_hover", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons))); |
| 1242 | p_theme->set_icon("down_pressed", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons))); |
| 1243 | p_theme->set_icon("down_disabled", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons))); |
| 1244 | |
| 1245 | p_theme->set_stylebox("up_background", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1246 | p_theme->set_stylebox("up_background_hovered", "SpinBox", p_config.button_style_hover); |
| 1247 | p_theme->set_stylebox("up_background_pressed", "SpinBox", p_config.button_style_pressed); |
| 1248 | p_theme->set_stylebox("up_background_disabled", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1249 | p_theme->set_stylebox("down_background", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1250 | p_theme->set_stylebox("down_background_hovered", "SpinBox", p_config.button_style_hover); |
| 1251 | p_theme->set_stylebox("down_background_pressed", "SpinBox", p_config.button_style_pressed); |
| 1252 | p_theme->set_stylebox("down_background_disabled", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1253 | |
| 1254 | p_theme->set_color("up_icon_modulate", "SpinBox", p_config.icon_normal_color); |
| 1255 | p_theme->set_color("up_hover_icon_modulate", "SpinBox", p_config.icon_hover_color); |
| 1256 | p_theme->set_color("up_pressed_icon_modulate", "SpinBox", p_config.icon_pressed_color); |
| 1257 | p_theme->set_color("up_disabled_icon_modulate", "SpinBox", p_config.icon_disabled_color); |
| 1258 | p_theme->set_color("down_icon_modulate", "SpinBox", p_config.icon_normal_color); |
| 1259 | p_theme->set_color("down_hover_icon_modulate", "SpinBox", p_config.icon_hover_color); |
| 1260 | p_theme->set_color("down_pressed_icon_modulate", "SpinBox", p_config.icon_pressed_color); |
| 1261 | p_theme->set_color("down_disabled_icon_modulate", "SpinBox", p_config.icon_disabled_color); |
| 1262 | |
| 1263 | p_theme->set_stylebox("field_and_buttons_separator", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1264 | p_theme->set_stylebox("up_down_buttons_separator", "SpinBox", EditorThemeManager::make_empty_stylebox()); |
| 1265 | |
| 1266 | p_theme->set_constant("buttons_vertical_separation", "SpinBox", 0); |
| 1267 | p_theme->set_constant("field_and_buttons_separation", "SpinBox", 2); |
| 1268 | p_theme->set_constant("buttons_width", "SpinBox", 16); |
| 1269 | #ifndef DISABLE_DEPRECATED |
| 1270 | p_theme->set_constant("set_min_buttons_width_from_icons", "SpinBox", 1); |
| 1271 | #endif |
| 1272 | } |
| 1273 | |
| 1274 | // ProgressBar. |
| 1275 | |
| 1276 | Ref<StyleBoxFlat> progress_bar_style = p_config.base_style->duplicate(); |
| 1277 | progress_bar_style->set_bg_color(p_config.surface_lowest_color); |
| 1278 | progress_bar_style->set_expand_margin(SIDE_TOP, p_config.base_margin * 0.5 * EDSCALE); |
| 1279 | progress_bar_style->set_expand_margin(SIDE_BOTTOM, p_config.base_margin * 0.5 * EDSCALE); |
| 1280 | progress_bar_style->set_content_margin_all(p_config.base_margin * EDSCALE); |
| 1281 | if (p_config.draw_extra_borders) { |
| 1282 | progress_bar_style->set_border_width_all(Math::round(EDSCALE)); |
| 1283 | progress_bar_style->set_border_color(p_config.extra_border_color_2); |
| 1284 | } |
| 1285 | |
| 1286 | Ref<StyleBoxFlat> progress_fill_style = progress_bar_style->duplicate(); |
| 1287 | progress_fill_style->set_bg_color(p_config.button_normal_color); |
| 1288 | if (p_config.draw_extra_borders) { |
| 1289 | progress_fill_style->set_border_color(p_config.extra_border_color_1); |
| 1290 | } |
| 1291 | |
| 1292 | p_theme->set_stylebox("background", "ProgressBar", progress_bar_style); |
| 1293 | p_theme->set_stylebox("fill", "ProgressBar", progress_fill_style); |
| 1294 | p_theme->set_color(SceneStringName(font_color), "ProgressBar", p_config.font_color); |
| 1295 | p_theme->set_color("font_outline_color", "ProgressBar", p_config.font_outline_color); |
| 1296 | p_theme->set_constant("outline_size", "ProgressBar", 0); |
| 1297 | |
| 1298 | // PopupProgressBar |
| 1299 | |
| 1300 | p_theme->set_type_variation("PopupProgressBar", "ProgressBar"); |
| 1301 | |
| 1302 | Ref<StyleBoxFlat> popup_progress_bar_style = progress_bar_style->duplicate(); |
| 1303 | popup_progress_bar_style->set_bg_color(_get_base_color(p_config, 0.4, 0.9)); |
| 1304 | |
| 1305 | Ref<StyleBoxFlat> popup_progress_fill_style = progress_fill_style->duplicate(); |
| 1306 | popup_progress_fill_style->set_bg_color(_get_base_color(p_config, -1.6, 0.9)); |
| 1307 | if (p_config.draw_extra_borders) { |
| 1308 | popup_progress_fill_style->set_border_color(p_config.extra_border_color_1); |
| 1309 | } |
| 1310 | |
| 1311 | p_theme->set_stylebox("background", "PopupProgressBar", popup_progress_bar_style); |
| 1312 | p_theme->set_stylebox("fill", "PopupProgressBar", popup_progress_fill_style); |
| 1313 | |
| 1314 | // GraphEdit and related nodes. |
| 1315 | { |
| 1316 | // GraphEdit. |
| 1317 | |
| 1318 | Ref<StyleBoxFlat> ge_panel_style = p_config.base_style->duplicate(); |
| 1319 | ge_panel_style->set_bg_color(p_config.surface_lowest_color); |
| 1320 | |
| 1321 | p_theme->set_stylebox(SceneStringName(panel), "GraphEdit", ge_panel_style); |
| 1322 | p_theme->set_stylebox("panel_focus", "GraphEdit", p_config.focus_style); |
| 1323 | p_theme->set_stylebox("menu_panel", "GraphEdit", EditorThemeManager::make_flat_stylebox(p_config.surface_low_color * Color(1, 1, 1, 0.5), 4, 2, 4, 2, 3)); |
| 1324 | |
| 1325 | float grid_base_brightness = p_config.dark_theme ? 1.0 : 0.0; |
| 1326 | GraphEdit::GridPattern grid_pattern = (GraphEdit::GridPattern) int(EDITOR_GET("editors/visual_editors/grid_pattern")); |
| 1327 | switch (grid_pattern) { |
| 1328 | case GraphEdit::GRID_PATTERN_LINES: |
| 1329 | p_theme->set_color("grid_major", "GraphEdit", Color(grid_base_brightness, grid_base_brightness, grid_base_brightness, 0.10)); |
| 1330 | p_theme->set_color("grid_minor", "GraphEdit", Color(grid_base_brightness, grid_base_brightness, grid_base_brightness, 0.05)); |
| 1331 | break; |
| 1332 | case GraphEdit::GRID_PATTERN_DOTS: |
| 1333 | p_theme->set_color("grid_major", "GraphEdit", Color(grid_base_brightness, grid_base_brightness, grid_base_brightness, 0.07)); |
| 1334 | p_theme->set_color("grid_minor", "GraphEdit", Color(grid_base_brightness, grid_base_brightness, grid_base_brightness, 0.07)); |
| 1335 | break; |
| 1336 | default: |
| 1337 | WARN_PRINT("Unknown grid pattern."); |
| 1338 | break; |
| 1339 | } |
| 1340 | |
| 1341 | p_theme->set_color("selection_fill", "GraphEdit", p_theme->get_color(SNAME("box_selection_fill_color"), EditorStringName(Editor))); |
| 1342 | p_theme->set_color("selection_stroke", "GraphEdit", p_theme->get_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor))); |
| 1343 | p_theme->set_color("activity", "GraphEdit", p_config.mono_color); |
| 1344 | |
| 1345 | p_theme->set_color("connection_hover_tint_color", "GraphEdit", p_config.dark_color_2); |
| 1346 | p_theme->set_constant("connection_hover_thickness", "GraphEdit", 0); |
| 1347 | p_theme->set_color("connection_valid_target_tint_color", "GraphEdit", p_config.extra_border_color_1); |
| 1348 | p_theme->set_color("connection_rim_color", "GraphEdit", p_config.tree_panel_style->get_bg_color()); |
| 1349 | |
| 1350 | p_theme->set_icon("zoom_out", "GraphEdit", p_theme->get_icon(SNAME("ZoomLess"), EditorStringName(EditorIcons))); |
| 1351 | p_theme->set_icon("zoom_in", "GraphEdit", p_theme->get_icon(SNAME("ZoomMore"), EditorStringName(EditorIcons))); |
| 1352 | p_theme->set_icon("zoom_reset", "GraphEdit", p_theme->get_icon(SNAME("ZoomReset"), EditorStringName(EditorIcons))); |
| 1353 | p_theme->set_icon("grid_toggle", "GraphEdit", p_theme->get_icon(SNAME("GridToggle"), EditorStringName(EditorIcons))); |
| 1354 | p_theme->set_icon("minimap_toggle", "GraphEdit", p_theme->get_icon(SNAME("GridMinimap"), EditorStringName(EditorIcons))); |
| 1355 | p_theme->set_icon("snapping_toggle", "GraphEdit", p_theme->get_icon(SNAME("SnapGrid"), EditorStringName(EditorIcons))); |
| 1356 | p_theme->set_icon("layout", "GraphEdit", p_theme->get_icon(SNAME("GridLayout"), EditorStringName(EditorIcons))); |
| 1357 | |
| 1358 | // GraphEditMinimap. |
| 1359 | { |
| 1360 | Ref<StyleBoxFlat> style_minimap_bg = EditorThemeManager::make_flat_stylebox(p_config.surface_low_color * Color(1, 1, 1, 0.3), 0, 0, 0, 0); |
| 1361 | style_minimap_bg->set_border_color(p_config.dark_color_3); |
| 1362 | style_minimap_bg->set_border_width_all(1); |
| 1363 | p_theme->set_stylebox(SceneStringName(panel), "GraphEditMinimap", style_minimap_bg); |
| 1364 | |
| 1365 | Ref<StyleBoxFlat> style_minimap_camera; |
| 1366 | Ref<StyleBoxFlat> style_minimap_node; |
| 1367 | if (p_config.dark_theme) { |
| 1368 | style_minimap_camera = EditorThemeManager::make_flat_stylebox(Color(0.65, 0.65, 0.65, 0.2), 0, 0, 0, 0); |
| 1369 | style_minimap_camera->set_border_color(Color(0.65, 0.65, 0.65, 0.45)); |
| 1370 | style_minimap_node = EditorThemeManager::make_flat_stylebox(Color(1, 1, 1), 0, 0, 0, 0); |
| 1371 | } else { |
| 1372 | style_minimap_camera = EditorThemeManager::make_flat_stylebox(Color(0.38, 0.38, 0.38, 0.1), 0, 0, 0, 0); |
| 1373 | style_minimap_camera->set_border_color(Color(0.38, 0.38, 0.38, 0.45)); |
| 1374 | style_minimap_node = EditorThemeManager::make_flat_stylebox(Color(0, 0, 0), 0, 0, 0, 0); |
| 1375 | } |
| 1376 | style_minimap_camera->set_border_width_all(1); |
| 1377 | style_minimap_node->set_anti_aliased(false); |
| 1378 | p_theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera); |
| 1379 | p_theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node); |
| 1380 | |
| 1381 | const Color minimap_resizer_color = p_config.dark_theme ? Color(1, 1, 1, 0.65) : Color(0, 0, 0, 0.65); |
| 1382 | p_theme->set_icon("resizer", "GraphEditMinimap", p_theme->get_icon(SNAME("GuiResizerTopLeft"), EditorStringName(EditorIcons))); |
| 1383 | p_theme->set_color("resizer_color", "GraphEditMinimap", minimap_resizer_color); |
| 1384 | } |
| 1385 | |
| 1386 | // GraphElement, GraphNode & GraphFrame. |
| 1387 | { |
| 1388 | const int gn_margin_top = 2; |
| 1389 | const int gn_margin_side = 2; |
| 1390 | const int gn_margin_bottom = 2; |
| 1391 | |
| 1392 | const int gn_corner_radius = 3; |
| 1393 | |
| 1394 | const Color gn_bg_color = p_config.dark_theme ? p_config.dark_color_3 : p_config.dark_color_1.lerp(p_config.mono_color, 0.09); |
| 1395 | const Color gn_frame_bg = _get_base_color(p_config, 2.4, 0.9); |
| 1396 | |
| 1397 | const bool high_contrast_borders = p_config.draw_extra_borders && p_config.dark_theme; |
| 1398 | |
| 1399 | Ref<StyleBoxFlat> gn_panel_style = EditorThemeManager::make_flat_stylebox(gn_frame_bg, gn_margin_side, gn_margin_top, gn_margin_side, gn_margin_bottom, p_config.corner_radius); |
| 1400 | gn_panel_style->set_border_width(SIDE_BOTTOM, 2 * EDSCALE); |
| 1401 | gn_panel_style->set_border_width(SIDE_LEFT, 2 * EDSCALE); |
| 1402 | gn_panel_style->set_border_width(SIDE_RIGHT, 2 * EDSCALE); |
| 1403 | gn_panel_style->set_border_color(high_contrast_borders ? gn_bg_color.lightened(0.2) : gn_bg_color.darkened(0.3)); |
| 1404 | gn_panel_style->set_corner_radius_individual(0, 0, gn_corner_radius * EDSCALE, gn_corner_radius * EDSCALE); |
| 1405 | gn_panel_style->set_anti_aliased(true); |
| 1406 | |
| 1407 | Ref<StyleBoxFlat> gn_panel_selected_style = gn_panel_style->duplicate(); |
| 1408 | gn_panel_selected_style->set_bg_color(p_config.dark_theme ? gn_bg_color.lightened(0.15) : gn_bg_color.darkened(0.15)); |
| 1409 | gn_panel_selected_style->set_border_width(SIDE_TOP, 0); |
| 1410 | gn_panel_selected_style->set_border_width(SIDE_BOTTOM, 2 * EDSCALE); |
| 1411 | gn_panel_selected_style->set_border_width(SIDE_LEFT, 2 * EDSCALE); |
| 1412 | gn_panel_selected_style->set_border_width(SIDE_RIGHT, 2 * EDSCALE); |
| 1413 | gn_panel_selected_style->set_border_color(p_config.mono_color); |
| 1414 | |
| 1415 | const int gn_titlebar_margin_top = 8; |
| 1416 | const int gn_titlebar_margin_side = 12; |
| 1417 | const int gn_titlebar_margin_bottom = 8; |
| 1418 | |
| 1419 | Ref<StyleBoxFlat> gn_titlebar_style = EditorThemeManager::make_flat_stylebox(gn_bg_color, gn_titlebar_margin_side, gn_titlebar_margin_top, gn_titlebar_margin_side, gn_titlebar_margin_bottom, p_config.corner_radius); |
| 1420 | gn_titlebar_style->set_border_width(SIDE_TOP, 2 * EDSCALE); |
| 1421 | gn_titlebar_style->set_border_width(SIDE_LEFT, 2 * EDSCALE); |
| 1422 | gn_titlebar_style->set_border_width(SIDE_RIGHT, 2 * EDSCALE); |
| 1423 | gn_titlebar_style->set_border_color(high_contrast_borders ? gn_bg_color.lightened(0.2) : gn_bg_color.darkened(0.3)); |
| 1424 | gn_titlebar_style->set_expand_margin(SIDE_TOP, 2 * EDSCALE); |
| 1425 | gn_titlebar_style->set_corner_radius_individual(gn_corner_radius * EDSCALE, gn_corner_radius * EDSCALE, 0, 0); |
| 1426 | gn_titlebar_style->set_anti_aliased(true); |
| 1427 | |
| 1428 | Ref<StyleBoxFlat> gn_titlebar_selected_style = gn_titlebar_style->duplicate(); |
| 1429 | gn_titlebar_selected_style->set_border_color(p_config.mono_color); |
| 1430 | gn_titlebar_selected_style->set_border_width(SIDE_TOP, 2 * EDSCALE); |
| 1431 | gn_titlebar_selected_style->set_border_width(SIDE_LEFT, 2 * EDSCALE); |
| 1432 | gn_titlebar_selected_style->set_border_width(SIDE_RIGHT, 2 * EDSCALE); |
| 1433 | gn_titlebar_selected_style->set_expand_margin(SIDE_TOP, 2 * EDSCALE); |
| 1434 | |
| 1435 | Color gn_decoration_color = p_config.dark_color_1.inverted(); |
| 1436 | |
| 1437 | // GraphElement. |
| 1438 | |
| 1439 | p_theme->set_stylebox(SceneStringName(panel), "GraphElement", gn_panel_style); |
| 1440 | p_theme->set_stylebox("panel_selected", "GraphElement", gn_panel_selected_style); |
| 1441 | p_theme->set_stylebox("titlebar", "GraphElement", gn_titlebar_style); |
| 1442 | p_theme->set_stylebox("titlebar_selected", "GraphElement", gn_titlebar_selected_style); |
| 1443 | |
| 1444 | p_theme->set_color("resizer_color", "GraphElement", gn_decoration_color); |
| 1445 | p_theme->set_icon("resizer", "GraphElement", p_theme->get_icon(SNAME("GuiResizer"), EditorStringName(EditorIcons))); |
| 1446 | |
| 1447 | // GraphNode. |
| 1448 | |
| 1449 | Ref<StyleBoxEmpty> gn_slot_style = EditorThemeManager::make_empty_stylebox(12, 0, 12, 0); |
| 1450 | |
| 1451 | p_theme->set_stylebox(SceneStringName(panel), "GraphNode", gn_panel_style); |
| 1452 | p_theme->set_stylebox("panel_selected", "GraphNode", gn_panel_selected_style); |
| 1453 | p_theme->set_stylebox("panel_focus", "GraphNode", p_config.focus_style); |
| 1454 | p_theme->set_stylebox("titlebar", "GraphNode", gn_titlebar_style); |
| 1455 | p_theme->set_stylebox("titlebar_selected", "GraphNode", gn_titlebar_selected_style); |
| 1456 | p_theme->set_stylebox("slot", "GraphNode", gn_slot_style); |
| 1457 | p_theme->set_stylebox("slot_selected", "GraphNode", p_config.focus_style); |
| 1458 | |
| 1459 | const Color gn_separator_color = gn_frame_bg.lerp(p_config.mono_color, 0.1); |
| 1460 | p_theme->set_stylebox("separator", "GraphNode", EditorThemeManager::make_line_stylebox(gn_separator_color, Math::round(2 * EDSCALE))); |
| 1461 | |
| 1462 | p_theme->set_color("resizer_color", "GraphNode", gn_decoration_color); |
| 1463 | |
| 1464 | p_theme->set_constant("port_h_offset", "GraphNode", 1); |
| 1465 | p_theme->set_constant("separation", "GraphNode", 1 * EDSCALE); |
| 1466 | |
| 1467 | Ref<DPITexture> port_icon = p_theme->get_icon(SNAME("GuiGraphNodePort"), EditorStringName(EditorIcons)); |
| 1468 | // The true size is 24x24 This is necessary for sharp port icons at high zoom levels in GraphEdit (up to ~200%). |
| 1469 | port_icon->set_size_override(Size2(12, 12)); |
| 1470 | p_theme->set_icon("port", "GraphNode", port_icon); |
| 1471 | |
| 1472 | // GraphNode's title Label. |
| 1473 | p_theme->set_type_variation("GraphNodeTitleLabel", "Label"); |
| 1474 | p_theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); |
| 1475 | p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", p_config.shadow_color); |
| 1476 | p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4); |
| 1477 | p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0); |
| 1478 | p_theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", 1); |
| 1479 | p_theme->set_constant("line_spacing", "GraphNodeTitleLabel", 3 * EDSCALE); |
| 1480 | |
| 1481 | // GraphFrame. |
| 1482 | |
| 1483 | const int gf_corner_width = 7 * EDSCALE; |
| 1484 | const int gf_border_width = 2 * MAX(1, EDSCALE); |
| 1485 | |
| 1486 | Ref<StyleBoxFlat> graphframe_sb = EditorThemeManager::make_flat_stylebox(Color(0.0, 0.0, 0.0, 0.2), gn_margin_side, gn_margin_side, gn_margin_side, gn_margin_bottom, gf_corner_width); |
| 1487 | graphframe_sb->set_expand_margin(SIDE_TOP, 38 * EDSCALE); |
| 1488 | graphframe_sb->set_border_width_all(gf_border_width); |
| 1489 | graphframe_sb->set_border_color(high_contrast_borders ? gn_bg_color.lightened(0.2) : gn_bg_color.darkened(0.3)); |
| 1490 | graphframe_sb->set_shadow_size(8 * EDSCALE); |
| 1491 | graphframe_sb->set_shadow_color(Color(p_config.shadow_color, p_config.shadow_color.a * 0.25)); |
| 1492 | graphframe_sb->set_anti_aliased(true); |
| 1493 | |
| 1494 | Ref<StyleBoxFlat> graphframe_sb_selected = graphframe_sb->duplicate(); |
| 1495 | graphframe_sb_selected->set_border_color(p_config.mono_color); |
| 1496 | |
| 1497 | p_theme->set_stylebox(SceneStringName(panel), "GraphFrame", graphframe_sb); |
| 1498 | p_theme->set_stylebox("panel_selected", "GraphFrame", graphframe_sb_selected); |
| 1499 | p_theme->set_stylebox("titlebar", "GraphFrame", EditorThemeManager::make_empty_stylebox(4, 4, 4, 4)); |
| 1500 | p_theme->set_stylebox("titlebar_selected", "GraphFrame", EditorThemeManager::make_empty_stylebox(4, 4, 4, 4)); |
| 1501 | p_theme->set_color("resizer_color", "GraphFrame", gn_decoration_color); |
| 1502 | |
| 1503 | // GraphFrame's title Label. |
| 1504 | p_theme->set_type_variation("GraphFrameTitleLabel", "Label"); |
| 1505 | p_theme->set_stylebox(CoreStringName(normal), "GraphFrameTitleLabel", memnew(StyleBoxEmpty)); |
| 1506 | p_theme->set_font_size(SceneStringName(font_size), "GraphFrameTitleLabel", 22 * EDSCALE); |
| 1507 | p_theme->set_color(SceneStringName(font_color), "GraphFrameTitleLabel", Color(1, 1, 1)); |
| 1508 | p_theme->set_color("font_shadow_color", "GraphFrameTitleLabel", Color(1, 1, 1, 0)); |
| 1509 | p_theme->set_color("font_outline_color", "GraphFrameTitleLabel", Color(1, 1, 1)); |
| 1510 | p_theme->set_constant("shadow_offset_x", "GraphFrameTitleLabel", 1 * EDSCALE); |
| 1511 | p_theme->set_constant("shadow_offset_y", "GraphFrameTitleLabel", 1 * EDSCALE); |
| 1512 | p_theme->set_constant("outline_size", "GraphFrameTitleLabel", 0); |
| 1513 | p_theme->set_constant("shadow_outline_size", "GraphFrameTitleLabel", 1 * EDSCALE); |
| 1514 | p_theme->set_constant("line_spacing", "GraphFrameTitleLabel", 3 * EDSCALE); |
| 1515 | } |
| 1516 | |
| 1517 | // VisualShader reroute node. |
| 1518 | { |
| 1519 | Ref<StyleBox> vs_reroute_panel_style = EditorThemeManager::make_empty_stylebox(); |
| 1520 | Ref<StyleBox> vs_reroute_titlebar_style = vs_reroute_panel_style->duplicate(); |
| 1521 | vs_reroute_titlebar_style->set_content_margin_all(16 * EDSCALE); |
| 1522 | p_theme->set_stylebox(SceneStringName(panel), "VSRerouteNode", vs_reroute_panel_style); |
| 1523 | p_theme->set_stylebox("panel_selected", "VSRerouteNode", vs_reroute_panel_style); |
| 1524 | p_theme->set_stylebox("titlebar", "VSRerouteNode", vs_reroute_titlebar_style); |
| 1525 | p_theme->set_stylebox("titlebar_selected", "VSRerouteNode", vs_reroute_titlebar_style); |
| 1526 | p_theme->set_stylebox("slot", "VSRerouteNode", EditorThemeManager::make_empty_stylebox()); |
| 1527 | |
| 1528 | p_theme->set_color("drag_background", "VSRerouteNode", p_config.dark_theme ? Color(0.19, 0.21, 0.24) : Color(0.8, 0.8, 0.8)); |
| 1529 | p_theme->set_color("selected_rim_color", "VSRerouteNode", p_config.mono_color); |
| 1530 | } |
| 1531 | } |
| 1532 | |
| 1533 | // ColorPicker and related nodes. |
| 1534 | { |
| 1535 | // ColorPicker. |
| 1536 | Ref<StyleBoxFlat> circle_style_focus = p_config.base_style->duplicate(); |
| 1537 | circle_style_focus->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.3)); |
| 1538 | circle_style_focus->set_draw_center(false); |
| 1539 | circle_style_focus->set_corner_radius_all(256 * EDSCALE); |
| 1540 | circle_style_focus->set_corner_detail(32 * EDSCALE); |
| 1541 | |
| 1542 | p_theme->set_constant("margin", "ColorPicker", p_config.base_margin); |
| 1543 | p_theme->set_constant("sv_width", "ColorPicker", 256 * EDSCALE); |
| 1544 | p_theme->set_constant("sv_height", "ColorPicker", 256 * EDSCALE); |
| 1545 | p_theme->set_constant("h_width", "ColorPicker", 30 * EDSCALE); |
| 1546 | p_theme->set_constant("label_width", "ColorPicker", 10 * EDSCALE); |
| 1547 | p_theme->set_constant("center_slider_grabbers", "ColorPicker", 1); |
| 1548 | |
| 1549 | p_theme->set_stylebox("sample_focus", "ColorPicker", p_config.focus_style); |
| 1550 | p_theme->set_stylebox("picker_focus_rectangle", "ColorPicker", p_config.focus_style); |
| 1551 | p_theme->set_stylebox("picker_focus_circle", "ColorPicker", circle_style_focus); |
| 1552 | p_theme->set_color("focused_not_editing_cursor_color", "ColorPicker", p_config.highlight_color); |
| 1553 | |
| 1554 | p_theme->set_icon("menu_option", "ColorPicker", p_theme->get_icon(SNAME("GuiTabMenuHl"), EditorStringName(EditorIcons))); |
| 1555 | p_theme->set_icon("expanded_arrow", "ColorPicker", p_theme->get_icon(SNAME("GuiTreeArrowDown"), EditorStringName(EditorIcons))); |
| 1556 | p_theme->set_icon("folded_arrow", "ColorPicker", p_theme->get_icon(SNAME("GuiTreeArrowRight"), EditorStringName(EditorIcons))); |
| 1557 | p_theme->set_icon("screen_picker", "ColorPicker", p_theme->get_icon(SNAME("ColorPick"), EditorStringName(EditorIcons))); |
| 1558 | p_theme->set_icon("shape_circle", "ColorPicker", p_theme->get_icon(SNAME("PickerShapeCircle"), EditorStringName(EditorIcons))); |
| 1559 | p_theme->set_icon("shape_rect", "ColorPicker", p_theme->get_icon(SNAME("PickerShapeRectangle"), EditorStringName(EditorIcons))); |
| 1560 | p_theme->set_icon("shape_rect_wheel", "ColorPicker", p_theme->get_icon(SNAME("PickerShapeRectangleWheel"), EditorStringName(EditorIcons))); |
| 1561 | p_theme->set_icon("add_preset", "ColorPicker", p_theme->get_icon(SNAME("Add"), EditorStringName(EditorIcons))); |
| 1562 | p_theme->set_icon("sample_bg", "ColorPicker", p_theme->get_icon(SNAME("GuiMiniCheckerboard"), EditorStringName(EditorIcons))); |
| 1563 | p_theme->set_icon("sample_revert", "ColorPicker", p_theme->get_icon(SNAME("Reload"), EditorStringName(EditorIcons))); |
| 1564 | p_theme->set_icon("overbright_indicator", "ColorPicker", p_theme->get_icon(SNAME("OverbrightIndicator"), EditorStringName(EditorIcons))); |
| 1565 | p_theme->set_icon("bar_arrow", "ColorPicker", p_theme->get_icon(SNAME("ColorPickerBarArrow"), EditorStringName(EditorIcons))); |
| 1566 | p_theme->set_icon("picker_cursor", "ColorPicker", p_theme->get_icon(SNAME("PickerCursor"), EditorStringName(EditorIcons))); |
| 1567 | p_theme->set_icon("picker_cursor_bg", "ColorPicker", p_theme->get_icon(SNAME("PickerCursorBg"), EditorStringName(EditorIcons))); |
| 1568 | p_theme->set_icon("color_script", "ColorPicker", p_theme->get_icon(SNAME("Script"), EditorStringName(EditorIcons))); |
| 1569 | |
| 1570 | // ColorPickerButton. |
| 1571 | p_theme->set_icon("bg", "ColorPickerButton", p_theme->get_icon(SNAME("GuiMiniCheckerboard"), EditorStringName(EditorIcons))); |
| 1572 | |
| 1573 | // ColorPresetButton. |
| 1574 | p_theme->set_stylebox("preset_fg", "ColorPresetButton", EditorThemeManager::make_flat_stylebox(Color(1, 1, 1), 2, 2, 2, 2, 2)); |
| 1575 | p_theme->set_icon("preset_bg", "ColorPresetButton", p_theme->get_icon(SNAME("GuiMiniCheckerboard"), EditorStringName(EditorIcons))); |
| 1576 | p_theme->set_icon("overbright_indicator", "ColorPresetButton", p_theme->get_icon(SNAME("OverbrightIndicator"), EditorStringName(EditorIcons))); |
| 1577 | } |
| 1578 | } |
| 1579 | |
| 1580 | void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, EditorThemeManager::ThemeConfiguration &p_config) { |
| 1581 | // Project manager. |
| 1582 | { |
| 1583 | Ref<StyleBoxFlat> style_project_list = p_config.base_style->duplicate(); |
| 1584 | style_project_list->set_bg_color(p_config.surface_low_color); |
| 1585 | |
| 1586 | p_theme->set_stylebox("panel_container", "ProjectManager", p_config.foreground_panel); |
| 1587 | p_theme->set_stylebox("project_list", "ProjectManager", style_project_list); |
| 1588 | p_theme->set_stylebox("quick_settings_panel", "ProjectManager", style_project_list); |
| 1589 | p_theme->set_constant("sidebar_button_icon_separation", "ProjectManager", int(6 * EDSCALE)); |
| 1590 | p_theme->set_icon("browse_folder", "ProjectManager", p_theme->get_icon(SNAME("FolderBrowse"), EditorStringName(EditorIcons))); |
| 1591 | p_theme->set_icon("browse_file", "ProjectManager", p_theme->get_icon(SNAME("FileBrowse"), EditorStringName(EditorIcons))); |
| 1592 | |
| 1593 | // ProjectTag. |
| 1594 | { |
| 1595 | p_theme->set_type_variation("ProjectTagButton", "Button"); |
| 1596 | |
| 1597 | Ref<StyleBoxFlat> tag = p_config.button_style->duplicate(); |
| 1598 | tag->set_border_width_all(0); |
| 1599 | tag->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 1600 | tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 1601 | tag->set_corner_radius(CORNER_TOP_RIGHT, 4); |
| 1602 | tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4); |
| 1603 | p_theme->set_stylebox(CoreStringName(normal), "ProjectTagButton", tag); |
| 1604 | |
| 1605 | tag = p_config.button_style_hover->duplicate(); |
| 1606 | tag->set_border_width_all(0); |
| 1607 | tag->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 1608 | tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 1609 | tag->set_corner_radius(CORNER_TOP_RIGHT, 4); |
| 1610 | tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4); |
| 1611 | p_theme->set_stylebox(SceneStringName(hover), "ProjectTagButton", tag); |
| 1612 | |
| 1613 | tag = p_config.button_style_pressed->duplicate(); |
| 1614 | tag->set_border_width_all(0); |
| 1615 | tag->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 1616 | tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 1617 | tag->set_corner_radius(CORNER_TOP_RIGHT, 4); |
| 1618 | tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4); |
| 1619 | p_theme->set_stylebox(SceneStringName(pressed), "ProjectTagButton", tag); |
| 1620 | } |
| 1621 | } |
| 1622 | |
| 1623 | // Editor and main screen. |
| 1624 | { |
| 1625 | // Editor background. |
| 1626 | Color background_color = p_config.surface_lowest_color; |
| 1627 | p_theme->set_color("background", EditorStringName(Editor), background_color); |
| 1628 | Ref<StyleBoxFlat> style_bg = p_config.base_style->duplicate(); |
| 1629 | style_bg->set_bg_color(background_color); |
| 1630 | style_bg->set_content_margin_all(0); |
| 1631 | style_bg->set_corner_radius_all(0); |
| 1632 | p_theme->set_stylebox("Background", EditorStringName(EditorStyles), style_bg); |
| 1633 | |
| 1634 | Ref<StyleBoxFlat> editor_panel_foreground = p_config.base_style->duplicate(); |
| 1635 | editor_panel_foreground->set_corner_radius_all(0); |
| 1636 | p_theme->set_stylebox("PanelForeground", EditorStringName(EditorStyles), editor_panel_foreground); |
| 1637 | |
| 1638 | // Editor focus. |
| 1639 | p_theme->set_stylebox("Focus", EditorStringName(EditorStyles), p_config.focus_style); |
| 1640 | |
| 1641 | Ref<StyleBoxFlat> style_widget_focus_viewport = p_config.base_style->duplicate(); |
| 1642 | style_widget_focus_viewport->set_corner_radius_all(0); |
| 1643 | style_widget_focus_viewport->set_border_width_all(2); |
| 1644 | style_widget_focus_viewport->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.07)); |
| 1645 | style_widget_focus_viewport->set_draw_center(false); |
| 1646 | p_theme->set_stylebox("FocusViewport", EditorStringName(EditorStyles), style_widget_focus_viewport); |
| 1647 | |
| 1648 | p_theme->set_stylebox(SceneStringName(panel), "ScrollContainer", p_config.base_empty_style); |
| 1649 | p_theme->set_stylebox("focus", "ScrollContainer", p_config.focus_style); |
| 1650 | |
| 1651 | // Scroll hints. |
| 1652 | p_theme->set_color("scroll_hint_vertical_color", "ScrollContainer", Color(0, 0, 0, p_config.dark_theme ? 1.0 : 0.5)); |
| 1653 | p_theme->set_color("scroll_hint_horizontal_color", "ScrollContainer", Color(0, 0, 0, p_config.dark_theme ? 1.0 : 0.5)); |
| 1654 | |
| 1655 | // This stylebox is used in 3d and 2d viewports (no borders). |
| 1656 | Ref<StyleBoxFlat> style_content_panel_vp = p_config.content_panel_style->duplicate(); |
| 1657 | style_content_panel_vp->set_content_margin_individual(p_config.border_width * 2, p_config.base_margin * EDSCALE, p_config.border_width * 2, p_config.border_width * 2); |
| 1658 | p_theme->set_stylebox("Content", EditorStringName(EditorStyles), style_content_panel_vp); |
| 1659 | |
| 1660 | // 3D/Spatial editor. |
| 1661 | Ref<StyleBoxFlat> style_info_3d_viewport = p_config.base_style->duplicate(); |
| 1662 | Color bg_color = style_info_3d_viewport->get_bg_color() * Color(1, 1, 1, 0.5); |
| 1663 | if (!p_config.dark_theme) { |
| 1664 | // Always use a dark background for the 3D viewport, even in light themes. |
| 1665 | // This is displayed as an overlay of the 3D scene, whose appearance doesn't change with the editor theme. |
| 1666 | // On top of that, dark overlays are more readable than light overlays. |
| 1667 | bg_color.invert(); |
| 1668 | } |
| 1669 | style_info_3d_viewport->set_bg_color(bg_color); |
| 1670 | style_info_3d_viewport->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE); |
| 1671 | p_theme->set_stylebox("Information3dViewport", EditorStringName(EditorStyles), style_info_3d_viewport); |
| 1672 | |
| 1673 | // 2D, 3D, and Game toolbar. |
| 1674 | p_theme->set_type_variation("MainToolBarMargin", "MarginContainer"); |
| 1675 | p_theme->set_constant("margin_left", "MainToolBarMargin", 4 * EDSCALE); |
| 1676 | p_theme->set_constant("margin_right", "MainToolBarMargin", 4 * EDSCALE); |
| 1677 | p_theme->set_constant("margin_top", "MainToolBarMargin", p_config.base_margin * 0.5 * EDSCALE); |
| 1678 | p_theme->set_constant("margin_bottom", "MainToolBarMargin", p_config.base_margin * 0.5 * EDSCALE); |
| 1679 | |
| 1680 | // 2D and 3D contextual toolbar. |
| 1681 | // Use a custom stylebox to make contextual menu items stand out from the rest. |
| 1682 | // This helps with editor usability as contextual menu items change when selecting nodes, |
| 1683 | // even though it may not be immediately obvious at first. |
| 1684 | Ref<StyleBoxFlat> toolbar_stylebox = p_config.base_style->duplicate(); |
| 1685 | toolbar_stylebox->set_bg_color(p_config.surface_higher_color); |
| 1686 | toolbar_stylebox->set_content_margin_all(0); |
| 1687 | p_theme->set_stylebox("ContextualToolbar", EditorStringName(EditorStyles), toolbar_stylebox); |
| 1688 | |
| 1689 | // Script editor. |
| 1690 | p_theme->set_stylebox("ScriptEditorPanel", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(p_config.base_margin, 0, p_config.base_margin, p_config.base_margin)); |
| 1691 | p_theme->set_stylebox("ScriptEditorPanelFloating", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); |
| 1692 | p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); |
| 1693 | |
| 1694 | // Game view. |
| 1695 | p_theme->set_type_variation("GamePanel", "Panel"); |
| 1696 | Ref<StyleBoxFlat> game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate(); |
| 1697 | game_panel->set_corner_radius_all(0); |
| 1698 | p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel); |
| 1699 | |
| 1700 | // Main menu. |
| 1701 | p_theme->set_stylebox(CoreStringName(normal), "MainScreenButton", p_config.base_empty_wide_style); |
| 1702 | p_theme->set_stylebox("normal_mirrored", "MainScreenButton", p_config.base_empty_wide_style); |
| 1703 | p_theme->set_stylebox(SceneStringName(pressed), "MainScreenButton", p_config.base_empty_wide_style); |
| 1704 | p_theme->set_stylebox("pressed_mirrored", "MainScreenButton", p_config.base_empty_wide_style); |
| 1705 | p_theme->set_stylebox(SceneStringName(hover), "MainScreenButton", p_config.base_empty_wide_style); |
| 1706 | p_theme->set_stylebox("hover_mirrored", "MainScreenButton", p_config.base_empty_wide_style); |
| 1707 | p_theme->set_stylebox("hover_pressed", "MainScreenButton", p_config.base_empty_wide_style); |
| 1708 | p_theme->set_stylebox("hover_pressed_mirrored", "MainScreenButton", p_config.base_empty_wide_style); |
| 1709 | |
| 1710 | // Main screen buttons. |
| 1711 | const Color mb_font_color = p_config.font_color * Color(1, 1, 1, 0.95); |
| 1712 | const Color mb_font_hover_color = p_config.font_hover_color * Color(1, 1, 1, 0.95); |
| 1713 | const Color mb_font_hover_pressed_color = p_config.accent_color.lerp(p_config.mono_color, 0.2); |
| 1714 | |
| 1715 | p_theme->set_color(SceneStringName(font_color), "MainScreenButton", mb_font_color); |
| 1716 | p_theme->set_color("font_hover_color", "MainScreenButton", mb_font_hover_color); |
| 1717 | p_theme->set_color("font_pressed_color", "MainScreenButton", p_config.accent_color); |
| 1718 | p_theme->set_color("font_hover_pressed_color", "MainScreenButton", mb_font_hover_pressed_color); |
| 1719 | |
| 1720 | const Color mb_icon_normal_color = p_config.icon_normal_color * Color(1, 1, 1, 0.95); |
| 1721 | const Color mb_icon_hover_color = p_config.icon_hover_color * Color(1, 1, 1, 0.95); |
| 1722 | |
| 1723 | p_theme->set_color("icon_normal_color", "MainScreenButton", mb_icon_normal_color); |
| 1724 | p_theme->set_color("icon_hover_color", "MainScreenButton", mb_icon_hover_color); |
| 1725 | |
| 1726 | p_theme->set_type_variation("MainMenuBar", "FlatMenuButton"); |
| 1727 | p_theme->set_stylebox(CoreStringName(normal), "MainMenuBar", p_config.flat_button); |
| 1728 | p_theme->set_stylebox(SceneStringName(pressed), "MainMenuBar", p_config.flat_button_pressed); |
| 1729 | p_theme->set_stylebox(SceneStringName(hover), "MainMenuBar", p_config.flat_button_hover); |
| 1730 | p_theme->set_stylebox("hover_pressed", "MainMenuBar", p_config.flat_button_hover_pressed); |
| 1731 | |
| 1732 | // Run bar. |
| 1733 | Ref<StyleBoxFlat> run_bar_hover = p_config.base_style->duplicate(); |
| 1734 | run_bar_hover->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.1)); |
| 1735 | run_bar_hover->set_content_margin_all(0); |
| 1736 | |
| 1737 | p_theme->set_type_variation("RunBarButton", "FlatMenuButton"); |
| 1738 | p_theme->set_stylebox("disabled", "RunBarButton", p_config.base_empty_wide_style); |
| 1739 | p_theme->set_stylebox(SceneStringName(pressed), "RunBarButton", p_config.base_empty_wide_style); |
| 1740 | p_theme->set_stylebox(SceneStringName(hover), "RunBarButton", run_bar_hover); |
| 1741 | |
| 1742 | // Needs to present even if unused. |
| 1743 | p_theme->set_type_variation("RunBarButtonMovieMakerDisabled", "RunBarButton"); |
| 1744 | |
| 1745 | Ref<StyleBoxFlat> movie_maker_button_enabled_hover = run_bar_hover->duplicate(); |
| 1746 | movie_maker_button_enabled_hover->set_bg_color(p_config.accent_color.lightened(0.2)); |
| 1747 | |
| 1748 | p_theme->set_type_variation("RunBarButtonMovieMakerEnabled", "RunBarButton"); |
| 1749 | p_theme->set_stylebox("hover_pressed", "RunBarButtonMovieMakerEnabled", movie_maker_button_enabled_hover); |
| 1750 | p_theme->set_color("icon_normal_color", "RunBarButtonMovieMakerEnabled", Color(0, 0, 0, 0.7)); |
| 1751 | p_theme->set_color("icon_pressed_color", "RunBarButtonMovieMakerEnabled", Color(0, 0, 0, 0.84)); |
| 1752 | p_theme->set_color("icon_hover_color", "RunBarButtonMovieMakerEnabled", Color(0, 0, 0, 0.9)); |
| 1753 | p_theme->set_color("icon_hover_pressed_color", "RunBarButtonMovieMakerEnabled", Color(0, 0, 0, 0.84)); |
| 1754 | |
| 1755 | // Bottom panel. |
| 1756 | Ref<StyleBoxFlat> style_bottom_panel = p_config.content_panel_style->duplicate(); |
| 1757 | style_bottom_panel->set_border_width(SIDE_BOTTOM, 0); |
| 1758 | style_bottom_panel->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 1759 | style_bottom_panel->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 1760 | style_bottom_panel->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 1761 | |
| 1762 | Ref<StyleBoxFlat> style_bottom_panel_hidden = style_bottom_panel->duplicate(); |
| 1763 | style_bottom_panel_hidden->set_content_margin(SIDE_TOP, 0); |
| 1764 | Ref<StyleBoxFlat> style_bottom_panel_tabbar = p_config.content_panel_style->duplicate(); |
| 1765 | style_bottom_panel_tabbar->set_content_margin(SIDE_TOP, 0); |
| 1766 | |
| 1767 | Ref<StyleBoxEmpty> style_bottom_tab = p_config.base_empty_style->duplicate(); |
| 1768 | style_bottom_tab->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE); |
| 1769 | |
| 1770 | Ref<StyleBoxFlat> bottom_panel_button_pressed = p_config.flat_button_pressed->duplicate(); |
| 1771 | bottom_panel_button_pressed->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE); |
| 1772 | |
| 1773 | Ref<StyleBoxFlat> bottom_panel_button_hover = p_config.flat_button_hover->duplicate(); |
| 1774 | bottom_panel_button_hover->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE); |
| 1775 | |
| 1776 | p_theme->set_stylebox("BottomPanel", EditorStringName(EditorStyles), style_bottom_panel); |
| 1777 | p_theme->set_type_variation("BottomPanel", "TabContainer"); |
| 1778 | p_theme->set_stylebox(SceneStringName(panel), "BottomPanel", style_bottom_panel_hidden); |
| 1779 | p_theme->set_stylebox("tabbar_background", "BottomPanel", style_bottom_panel_tabbar); |
| 1780 | p_theme->set_stylebox("tab_selected", "BottomPanel", bottom_panel_button_pressed); |
| 1781 | p_theme->set_stylebox("tab_hovered", "BottomPanel", bottom_panel_button_hover); |
| 1782 | p_theme->set_stylebox("tab_focus", "BottomPanel", p_config.base_empty_style); |
| 1783 | p_theme->set_stylebox("tab_unselected", "BottomPanel", style_bottom_tab); |
| 1784 | p_theme->set_color("font_unselected_color", "BottomPanel", p_config.font_color); |
| 1785 | p_theme->set_color("font_hovered_color", "BottomPanel", p_config.font_hover_color); |
| 1786 | p_theme->set_color("font_selected_color", "BottomPanel", p_config.font_hover_color); |
| 1787 | p_theme->set_constant("tab_separation", "BottomPanel", p_config.separation_margin); |
| 1788 | |
| 1789 | p_theme->set_type_variation("BottomPanelButton", "FlatMenuButton"); |
| 1790 | |
| 1791 | // Use bigger margin for buttons in bottom panel to make them easier to press. |
| 1792 | Ref<StyleBoxEmpty> bottom_panel_button = p_config.base_empty_style->duplicate(); |
| 1793 | bottom_panel_button->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 1.2 * EDSCALE); |
| 1794 | p_theme->set_stylebox(CoreStringName(normal), "BottomPanelButton", bottom_panel_button); |
| 1795 | |
| 1796 | p_theme->set_stylebox(SceneStringName(hover), "BottomPanelButton", bottom_panel_button_hover); |
| 1797 | p_theme->set_stylebox(SceneStringName(pressed), "BottomPanelButton", bottom_panel_button_pressed); |
| 1798 | p_theme->set_stylebox("hover_pressed", "BottomPanelButton", bottom_panel_button_pressed); |
| 1799 | |
| 1800 | // Don't tint the icon even when in "pressed" state. |
| 1801 | p_theme->set_color("icon_pressed_color", "BottomPanelButton", Color(1, 1, 1, 1)); |
| 1802 | Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_icon_and_font ? 1.15 : 1.0); |
| 1803 | icon_hover_color.a = 1.0; |
| 1804 | p_theme->set_color("icon_hover_color", "BottomPanel", icon_hover_color); |
| 1805 | p_theme->set_color("icon_hover_pressed_color", "BottomPanel", icon_hover_color); |
| 1806 | p_theme->set_color("icon_hover_color", "BottomPanelButton", icon_hover_color); |
| 1807 | p_theme->set_color("icon_hover_pressed_color", "BottomPanelButton", p_config.accent_color); |
| 1808 | p_theme->set_color("icon_pressed_color", "BottomPanelButton", p_config.accent_color); |
| 1809 | |
| 1810 | // Audio bus. |
| 1811 | Ref<StyleBoxFlat> audio_bus = p_config.base_style->duplicate(); |
| 1812 | audio_bus->set_bg_color(p_config.surface_high_color); |
| 1813 | p_theme->set_stylebox(CoreStringName(normal), "EditorAudioBus", audio_bus); |
| 1814 | p_theme->set_stylebox("focus", "EditorAudioBus", p_config.focus_style); |
| 1815 | Ref<StyleBoxFlat> audio_bus_master = p_config.base_style->duplicate(); |
| 1816 | audio_bus_master->set_bg_color(p_config.surface_higher_color); |
| 1817 | p_theme->set_stylebox("master", "EditorAudioBus", audio_bus_master); |
| 1818 | } |
| 1819 | |
| 1820 | // Editor GUI widgets. |
| 1821 | { |
| 1822 | // EditorSpinSlider. |
| 1823 | p_theme->set_color("label_color", "EditorSpinSlider", p_config.font_color); |
| 1824 | p_theme->set_color("read_only_label_color", "EditorSpinSlider", p_config.font_readonly_color); |
| 1825 | |
| 1826 | Ref<StyleBoxFlat> editor_spin_label_bg = p_config.base_style->duplicate(); |
| 1827 | editor_spin_label_bg->set_bg_color(p_config.surface_lower_color); |
| 1828 | editor_spin_label_bg->set_content_margin_all(p_config.base_margin * EDSCALE); |
| 1829 | p_theme->set_stylebox("label_bg", "EditorSpinSlider", editor_spin_label_bg); |
| 1830 | |
| 1831 | // TODO: Use separate arrows instead like on SpinBox. Planned for a different PR. |
| 1832 | p_theme->set_icon("updown", "EditorSpinSlider", p_theme->get_icon(SNAME("GuiSpinboxUpdown"), EditorStringName(EditorIcons))); |
| 1833 | p_theme->set_icon("updown_disabled", "EditorSpinSlider", p_theme->get_icon(SNAME("GuiSpinboxUpdownDisabled"), EditorStringName(EditorIcons))); |
| 1834 | |
| 1835 | // EditorSpinSliders with a label have more space on the left, so add an |
| 1836 | // higher margin to match the location where the text begins. |
| 1837 | // The margin values below were determined by empirical testing. |
| 1838 | p_theme->set_constant("line_edit_margin", "EditorSpinSlider", 28 * EDSCALE); |
| 1839 | p_theme->set_constant("line_edit_margin_empty", "EditorSpinSlider", 20 * EDSCALE); |
| 1840 | |
| 1841 | // Launch Pad and Play buttons. |
| 1842 | Ref<StyleBoxFlat> style_launch_pad_movie = p_config.base_style->duplicate(); |
| 1843 | style_launch_pad_movie->set_content_margin_all(p_config.base_margin * EDSCALE); |
| 1844 | style_launch_pad_movie->set_bg_color(p_config.accent_color * Color(1, 1, 1, 0.2)); |
| 1845 | style_launch_pad_movie->set_border_color(p_config.accent_color * Color(1, 1, 1, 0.8)); |
| 1846 | style_launch_pad_movie->set_border_width_all(Math::round(2 * EDSCALE)); |
| 1847 | p_theme->set_stylebox("LaunchPadMovieMode", EditorStringName(EditorStyles), style_launch_pad_movie); |
| 1848 | |
| 1849 | int pad_normal_margin = style_launch_pad_movie->get_minimum_size().width / 2; |
| 1850 | Ref<StyleBoxEmpty> style_launch_pad = memnew(StyleBoxEmpty); |
| 1851 | style_launch_pad->set_content_margin_all(pad_normal_margin); |
| 1852 | p_theme->set_stylebox("LaunchPadNormal", EditorStringName(EditorStyles), style_launch_pad); |
| 1853 | |
| 1854 | Ref<StyleBoxFlat> style_launch_pad_recovery_mode = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1, 2 * EDSCALE, 0, 2 * EDSCALE, 0, p_config.corner_radius); |
| 1855 | style_launch_pad_recovery_mode->set_bg_color(p_config.accent_color * Color(1, 1, 1, 0.1)); |
| 1856 | style_launch_pad_recovery_mode->set_border_color(p_config.warning_color); |
| 1857 | style_launch_pad_recovery_mode->set_border_width_all(Math::round(2 * EDSCALE)); |
| 1858 | style_launch_pad_recovery_mode->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 1859 | p_theme->set_stylebox("LaunchPadRecoveryMode", EditorStringName(EditorStyles), style_launch_pad_recovery_mode); |
| 1860 | |
| 1861 | p_theme->set_stylebox("MovieWriterButtonNormal", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); |
| 1862 | Ref<StyleBoxFlat> style_write_movie_button = p_config.base_style->duplicate(); |
| 1863 | style_write_movie_button->set_bg_color(p_config.accent_color * Color(1, 1, 1, 0.8)); |
| 1864 | style_write_movie_button->set_content_margin_all(0); |
| 1865 | p_theme->set_stylebox("MovieWriterButtonPressed", EditorStringName(EditorStyles), style_write_movie_button); |
| 1866 | |
| 1867 | // Profiler autostart indicator panel. |
| 1868 | Ref<StyleBoxFlat> style_profiler_autostart = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1, 2 * EDSCALE, 0, 2 * EDSCALE, 0, p_config.corner_radius); |
| 1869 | style_profiler_autostart->set_bg_color(Color(1, 0.867, 0.396)); |
| 1870 | style_profiler_autostart->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 1871 | p_theme->set_type_variation("ProfilerAutostartIndicator", "Button"); |
| 1872 | p_theme->set_stylebox(CoreStringName(normal), "ProfilerAutostartIndicator", style_profiler_autostart); |
| 1873 | p_theme->set_stylebox(SceneStringName(pressed), "ProfilerAutostartIndicator", style_profiler_autostart); |
| 1874 | p_theme->set_stylebox(SceneStringName(hover), "ProfilerAutostartIndicator", style_profiler_autostart); |
| 1875 | |
| 1876 | // Recovery mode button style |
| 1877 | Ref<StyleBoxFlat> style_recovery_mode_button = p_config.button_style_pressed->duplicate(); |
| 1878 | style_recovery_mode_button->set_bg_color(p_config.warning_color); |
| 1879 | style_recovery_mode_button->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 1880 | style_recovery_mode_button->set_content_margin_all(0); |
| 1881 | // Recovery mode button is implicitly styled from the panel's background. |
| 1882 | // So, remove any existing borders. (e.g. from draw_extra_borders config) |
| 1883 | style_recovery_mode_button->set_border_width_all(0); |
| 1884 | style_recovery_mode_button->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE); |
| 1885 | p_theme->set_stylebox("RecoveryModeButton", EditorStringName(EditorStyles), style_recovery_mode_button); |
| 1886 | } |
| 1887 | |
| 1888 | // Standard GUI variations. |
| 1889 | { |
| 1890 | // Custom theme type for MarginContainer with 4px margins. |
| 1891 | p_theme->set_type_variation("MarginContainer4px", "MarginContainer"); |
| 1892 | p_theme->set_constant("margin_left", "MarginContainer4px", 4 * EDSCALE); |
| 1893 | p_theme->set_constant("margin_top", "MarginContainer4px", 4 * EDSCALE); |
| 1894 | p_theme->set_constant("margin_right", "MarginContainer4px", 4 * EDSCALE); |
| 1895 | p_theme->set_constant("margin_bottom", "MarginContainer4px", 4 * EDSCALE); |
| 1896 | |
| 1897 | // Header LinkButton variation. |
| 1898 | p_theme->set_type_variation("HeaderSmallLink", "LinkButton"); |
| 1899 | p_theme->set_font(SceneStringName(font), "HeaderSmallLink", p_theme->get_font(SceneStringName(font), SNAME("HeaderSmall"))); |
| 1900 | p_theme->set_font_size(SceneStringName(font_size), "HeaderSmallLink", p_theme->get_font_size(SceneStringName(font_size), SNAME("HeaderSmall"))); |
| 1901 | |
| 1902 | // Flat button variations. |
| 1903 | { |
| 1904 | p_theme->set_stylebox(CoreStringName(normal), SceneStringName(FlatButton), p_config.base_empty_wide_style); |
| 1905 | p_theme->set_stylebox(SceneStringName(hover), SceneStringName(FlatButton), p_config.flat_button_hover); |
| 1906 | p_theme->set_stylebox(SceneStringName(pressed), SceneStringName(FlatButton), p_config.flat_button_pressed); |
| 1907 | p_theme->set_stylebox("hover_pressed", SceneStringName(FlatButton), p_config.flat_button_hover_pressed); |
| 1908 | p_theme->set_stylebox("disabled", SceneStringName(FlatButton), p_config.base_empty_wide_style); |
| 1909 | |
| 1910 | p_theme->set_stylebox("normal_mirrored", SceneStringName(FlatButton), p_config.base_empty_wide_style); |
| 1911 | p_theme->set_stylebox("hover_mirrored", SceneStringName(FlatButton), p_config.flat_button_hover); |
| 1912 | p_theme->set_stylebox("pressed_mirrored", SceneStringName(FlatButton), p_config.flat_button_pressed); |
| 1913 | p_theme->set_stylebox("hover_pressed_mirrored", SceneStringName(FlatButton), p_config.flat_button_hover_pressed); |
| 1914 | p_theme->set_stylebox("disabled_mirrored", SceneStringName(FlatButton), p_config.base_empty_wide_style); |
| 1915 | |
| 1916 | p_theme->set_stylebox(CoreStringName(normal), "FlatMenuButton", p_config.base_empty_wide_style); |
| 1917 | p_theme->set_stylebox(SceneStringName(hover), "FlatMenuButton", p_config.flat_button_hover); |
| 1918 | p_theme->set_stylebox(SceneStringName(pressed), "FlatMenuButton", p_config.flat_button_pressed); |
| 1919 | p_theme->set_stylebox("hover_pressed", "FlatMenuButton", p_config.flat_button_hover_pressed); |
| 1920 | p_theme->set_stylebox("disabled", "FlatMenuButton", p_config.base_empty_wide_style); |
| 1921 | |
| 1922 | p_theme->set_stylebox("normal_mirrored", "FlatMenuButton", p_config.base_empty_wide_style); |
| 1923 | p_theme->set_stylebox("hover_mirrored", "FlatMenuButton", p_config.flat_button_hover); |
| 1924 | p_theme->set_stylebox("pressed_mirrored", "FlatMenuButton", p_config.flat_button_pressed); |
| 1925 | p_theme->set_stylebox("hover_pressed_mirrored", "FlatMenuButton", p_config.flat_button_hover_pressed); |
| 1926 | p_theme->set_stylebox("disabled_mirrored", "FlatMenuButton", p_config.base_empty_wide_style); |
| 1927 | |
| 1928 | p_theme->set_type_variation("FlatButtonNoIconTint", "FlatButton"); |
| 1929 | p_theme->set_color("icon_pressed_color", "FlatButtonNoIconTint", p_config.icon_normal_color); |
| 1930 | p_theme->set_color("icon_hover_color", "FlatButtonNoIconTint", p_config.mono_color); |
| 1931 | p_theme->set_color("icon_hover_pressed_color", "FlatButtonNoIconTint", p_config.mono_color); |
| 1932 | |
| 1933 | p_theme->set_type_variation("FlatMenuButtonNoIconTint", "FlatMenuButton"); |
| 1934 | p_theme->set_color("icon_pressed_color", "FlatMenuButtonNoIconTint", p_config.icon_normal_color); |
| 1935 | p_theme->set_color("icon_hover_color", "FlatMenuButtonNoIconTint", p_config.mono_color); |
| 1936 | p_theme->set_color("icon_hover_pressed_color", "FlatMenuButtonNoIconTint", p_config.mono_color); |
| 1937 | |
| 1938 | // Variation for Editor Log filter buttons. |
| 1939 | |
| 1940 | p_theme->set_type_variation("EditorLogFilterButton", "Button"); |
| 1941 | // When pressed, don't tint the icons with the accent color, just leave them normal. |
| 1942 | p_theme->set_color("icon_pressed_color", "EditorLogFilterButton", p_config.icon_normal_color); |
| 1943 | // When unpressed, dim the icons. |
| 1944 | Color icon_normal_color = Color(p_config.icon_normal_color, (p_config.dark_icon_and_font ? 0.4 : 0.8)); |
| 1945 | p_theme->set_color("icon_normal_color", "EditorLogFilterButton", icon_normal_color); |
| 1946 | Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_icon_and_font ? 1.15 : 1.0); |
| 1947 | icon_hover_color.a = 1.0; |
| 1948 | p_theme->set_color("icon_hover_color", "EditorLogFilterButton", icon_hover_color); |
| 1949 | p_theme->set_color("icon_hover_pressed_color", "EditorLogFilterButton", icon_hover_color); |
| 1950 | |
| 1951 | p_theme->set_stylebox(CoreStringName(normal), "EditorLogFilterButton", p_config.base_empty_style); |
| 1952 | p_theme->set_stylebox(SceneStringName(hover), "EditorLogFilterButton", p_config.flat_button_hover); |
| 1953 | p_theme->set_stylebox(SceneStringName(pressed), "EditorLogFilterButton", p_config.flat_button_pressed); |
| 1954 | p_theme->set_stylebox("hover_pressed", "EditorLogFilterButton", p_config.flat_button_hover_pressed); |
| 1955 | } |
| 1956 | |
| 1957 | // Checkbox. |
| 1958 | { |
| 1959 | p_theme->set_type_variation("CheckBoxNoIconTint", "CheckBox"); |
| 1960 | p_theme->set_color("icon_pressed_color", "CheckBoxNoIconTint", p_config.icon_normal_color); |
| 1961 | p_theme->set_color("icon_hover_color", "CheckBoxNoIconTint", p_config.mono_color); |
| 1962 | p_theme->set_color("icon_hover_pressed_color", "CheckBoxNoIconTint", p_config.mono_color); |
| 1963 | } |
| 1964 | |
| 1965 | // Buttons styles that stand out against the panel background (e.g. AssetLib). |
| 1966 | { |
| 1967 | p_theme->set_type_variation("PanelBackgroundButton", "Button"); |
| 1968 | |
| 1969 | Ref<StyleBoxFlat> panel_button_style = p_config.button_style->duplicate(); |
| 1970 | panel_button_style->set_bg_color(p_config.base_color.lerp(p_config.mono_color, 0.08)); |
| 1971 | |
| 1972 | Ref<StyleBoxFlat> panel_button_style_hover = p_config.button_style_hover->duplicate(); |
| 1973 | panel_button_style_hover->set_bg_color(p_config.base_color.lerp(p_config.mono_color, 0.16)); |
| 1974 | |
| 1975 | Ref<StyleBoxFlat> panel_button_style_pressed = p_config.button_style_pressed->duplicate(); |
| 1976 | panel_button_style_pressed->set_bg_color(p_config.base_color.lerp(p_config.mono_color, 0.20)); |
| 1977 | |
| 1978 | Ref<StyleBoxFlat> panel_button_style_disabled = p_config.button_style_disabled->duplicate(); |
| 1979 | panel_button_style_disabled->set_bg_color(p_config.disabled_bg_color); |
| 1980 | |
| 1981 | p_theme->set_stylebox(CoreStringName(normal), "PanelBackgroundButton", panel_button_style); |
| 1982 | p_theme->set_stylebox(SceneStringName(hover), "PanelBackgroundButton", panel_button_style_hover); |
| 1983 | p_theme->set_stylebox(SceneStringName(pressed), "PanelBackgroundButton", panel_button_style_pressed); |
| 1984 | p_theme->set_stylebox("disabled", "PanelBackgroundButton", panel_button_style_disabled); |
| 1985 | } |
| 1986 | |
| 1987 | // Top bar selectors. |
| 1988 | p_theme->set_type_variation("TopBarOptionButton", "OptionButton"); |
| 1989 | p_theme->set_font(SceneStringName(font), "TopBarOptionButton", p_theme->get_font(SNAME("bold"), EditorStringName(EditorFonts))); |
| 1990 | p_theme->set_font_size(SceneStringName(font_size), "TopBarOptionButton", p_theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts))); |
| 1991 | |
| 1992 | // Complex editor windows. |
| 1993 | p_theme->set_stylebox(SceneStringName(panel), "EditorSettingsDialog", p_config.window_complex_style); |
| 1994 | p_theme->set_stylebox(SceneStringName(panel), "ProjectSettingsEditor", p_config.window_complex_style); |
| 1995 | p_theme->set_stylebox(SceneStringName(panel), "ProjectExportDialog", p_config.window_complex_style); |
| 1996 | p_theme->set_stylebox(SceneStringName(panel), "SceneImportSettingsDialog", p_config.window_complex_style); |
| 1997 | p_theme->set_stylebox(SceneStringName(panel), "EditorAbout", p_config.window_complex_style); |
| 1998 | p_theme->set_stylebox(SceneStringName(panel), "ThemeItemEditorDialog", p_config.window_complex_style); |
| 1999 | |
| 2000 | // MarginContainers with negative margins, to negate borders. Used with scroll hints. |
| 2001 | { |
| 2002 | int panel_margin = p_theme->get_stylebox(SceneStringName(panel), SNAME("PanelContainer"))->get_content_margin(SIDE_LEFT); |
| 2003 | int margin = -panel_margin; |
| 2004 | |
| 2005 | p_theme->set_type_variation("NoBorderHorizontal", "MarginContainer"); |
| 2006 | p_theme->set_constant("margin_left", "NoBorderHorizontal", margin); |
| 2007 | p_theme->set_constant("margin_right", "NoBorderHorizontal", margin); |
| 2008 | |
| 2009 | p_theme->set_type_variation("NoBorderHorizontalBottom", "NoBorderHorizontal"); |
| 2010 | p_theme->set_constant("margin_bottom", "NoBorderHorizontalBottom", margin); |
| 2011 | |
| 2012 | margin *= 2; |
| 2013 | |
| 2014 | // Used in nested containers. |
| 2015 | p_theme->set_type_variation("NoBorderHorizontalWide", "MarginContainer"); |
| 2016 | p_theme->set_constant("margin_left", "NoBorderHorizontalWide", margin); |
| 2017 | p_theme->set_constant("margin_right", "NoBorderHorizontalWide", margin); |
| 2018 | |
| 2019 | // Same as above, including the bottom. |
| 2020 | p_theme->set_type_variation("NoBorderHorizontalBottomWide", "NoBorderHorizontalWide"); |
| 2021 | p_theme->set_constant("margin_bottom", "NoBorderHorizontalBottomWide", margin); |
| 2022 | |
| 2023 | // Used in the asset library. Specifically, the ("bg", "AssetLib") stylebox. |
| 2024 | p_theme->set_type_variation("NoBorderAssetLib", "NoBorderHorizontal"); |
| 2025 | p_theme->set_constant("margin_bottom", "NoBorderAssetLib", -p_config.base_margin); |
| 2026 | |
| 2027 | margin = -panel_margin - p_config.base_margin; |
| 2028 | |
| 2029 | // Same as above, but with the margins adapted for the project manager. |
| 2030 | p_theme->set_type_variation("NoBorderAssetLibProjectManager", "NoBorderHorizontal"); |
| 2031 | p_theme->set_constant("margin_left", "NoBorderAssetLibProjectManager", margin); |
| 2032 | p_theme->set_constant("margin_right", "NoBorderAssetLibProjectManager", margin); |
| 2033 | p_theme->set_constant("margin_bottom", "NoBorderAssetLibProjectManager", margin); |
| 2034 | |
| 2035 | int bottom_margin = p_theme->get_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles))->get_content_margin(SIDE_LEFT); |
| 2036 | margin = -bottom_margin; |
| 2037 | |
| 2038 | // Used in editors residing in the bottom panel. |
| 2039 | p_theme->set_type_variation("NoBorderBottomPanel", "MarginContainer"); |
| 2040 | p_theme->set_constant("margin_left", "NoBorderBottomPanel", margin); |
| 2041 | p_theme->set_constant("margin_right", "NoBorderBottomPanel", margin); |
| 2042 | |
| 2043 | margin = -panel_margin - bottom_margin; |
| 2044 | |
| 2045 | // Used in the animation track editor. |
| 2046 | p_theme->set_type_variation("NoBorderAnimation", "MarginContainer"); |
| 2047 | p_theme->set_constant("margin_left", "NoBorderAnimation", margin); |
| 2048 | p_theme->set_constant("margin_right", "NoBorderAnimation", margin); |
| 2049 | |
| 2050 | margin = -p_theme->get_stylebox(SceneStringName(panel), SNAME("AcceptDialog"))->get_content_margin(SIDE_LEFT); |
| 2051 | |
| 2052 | p_theme->set_type_variation("NoBorderHorizontalWindow", "MarginContainer"); |
| 2053 | p_theme->set_constant("margin_left", "NoBorderHorizontalWindow", margin); |
| 2054 | p_theme->set_constant("margin_right", "NoBorderHorizontalWindow", margin); |
| 2055 | } |
| 2056 | |
| 2057 | // Buttons in material previews. |
| 2058 | { |
| 2059 | const Color dim_light_color = p_config.icon_normal_color.darkened(0.24); |
| 2060 | const Color dim_light_highlighted_color = p_config.icon_normal_color.darkened(0.18); |
| 2061 | Ref<StyleBox> sb_empty_borderless = EditorThemeManager::make_empty_stylebox(); |
| 2062 | |
| 2063 | p_theme->set_type_variation("PreviewLightButton", "Button"); |
| 2064 | // When pressed, don't use the accent color tint. When unpressed, dim the icon. |
| 2065 | p_theme->set_color("icon_normal_color", "PreviewLightButton", dim_light_color); |
| 2066 | p_theme->set_color("icon_focus_color", "PreviewLightButton", dim_light_color); |
| 2067 | p_theme->set_color("icon_pressed_color", "PreviewLightButton", p_config.icon_normal_color); |
| 2068 | p_theme->set_color("icon_hover_pressed_color", "PreviewLightButton", p_config.icon_normal_color); |
| 2069 | // Unpressed icon is dim, so use a dim highlight. |
| 2070 | p_theme->set_color("icon_hover_color", "PreviewLightButton", dim_light_highlighted_color); |
| 2071 | |
| 2072 | p_theme->set_stylebox(CoreStringName(normal), "PreviewLightButton", sb_empty_borderless); |
| 2073 | p_theme->set_stylebox(SceneStringName(hover), "PreviewLightButton", sb_empty_borderless); |
| 2074 | p_theme->set_stylebox("focus", "PreviewLightButton", sb_empty_borderless); |
| 2075 | p_theme->set_stylebox(SceneStringName(pressed), "PreviewLightButton", sb_empty_borderless); |
| 2076 | } |
| 2077 | |
| 2078 | // TabContainerOdd variation. |
| 2079 | { |
| 2080 | // Used for tabs against the base color background in the classic theme. |
| 2081 | p_theme->set_type_variation("TabContainerOdd", "TabContainer"); |
| 2082 | |
| 2083 | Ref<StyleBoxFlat> style_tab_selected_odd = p_theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->duplicate(); |
| 2084 | style_tab_selected_odd->set_bg_color(p_config.surface_base_color); |
| 2085 | p_theme->set_stylebox("tab_selected", "TabContainerOdd", style_tab_selected_odd); |
| 2086 | |
| 2087 | Ref<StyleBoxFlat> style_panel_odd = p_theme->get_stylebox(SceneStringName(panel), SNAME("TabContainer"))->duplicate(); |
| 2088 | style_panel_odd->set_bg_color(p_config.surface_base_color); |
| 2089 | p_theme->set_stylebox(SceneStringName(panel), "TabContainerOdd", style_panel_odd); |
| 2090 | |
| 2091 | p_theme->set_stylebox("tabbar_background", "TabContainerOdd", p_theme->get_stylebox(SNAME("tabbar_background"), SNAME("TabContainer"))); |
| 2092 | } |
| 2093 | |
| 2094 | // TabContainerInner, TabBarInner, PanelContainerTabbarInner variations. |
| 2095 | { |
| 2096 | // Used for tabs against the base color background in the modern theme. |
| 2097 | p_theme->set_type_variation("TabContainerInner", "TabContainer"); |
| 2098 | p_theme->set_type_variation("TabBarInner", "TabBar"); |
| 2099 | p_theme->set_type_variation("PanelContainerTabbarInner", "PanelContainer"); |
| 2100 | |
| 2101 | Ref<StyleBoxFlat> style_tab_selected_inner = p_theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->duplicate(); |
| 2102 | style_tab_selected_inner->set_content_margin_individual(p_config.base_margin * 4 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 4 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE); |
| 2103 | style_tab_selected_inner->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 2104 | p_theme->set_stylebox("tab_selected", "TabContainerInner", style_tab_selected_inner); |
| 2105 | p_theme->set_stylebox("tab_selected", "TabBarInner", style_tab_selected_inner); |
| 2106 | |
| 2107 | Color background_color = p_config.surface_lower_color.lerp(p_config.mono_color_inv, 0.15); |
| 2108 | |
| 2109 | Ref<StyleBoxFlat> style_tab_unselected_inner = style_tab_selected_inner->duplicate(); |
| 2110 | style_tab_unselected_inner->set_bg_color(background_color); |
| 2111 | p_theme->set_stylebox("tab_unselected", "TabContainerInner", style_tab_unselected_inner); |
| 2112 | p_theme->set_stylebox("tab_unselected", "TabBarInner", style_tab_unselected_inner); |
| 2113 | |
| 2114 | Ref<StyleBoxFlat> style_tab_hovered_inner = style_tab_selected_inner->duplicate(); |
| 2115 | style_tab_hovered_inner->set_bg_color(background_color.lerp(p_config.mono_color, 0.05)); |
| 2116 | p_theme->set_stylebox("tab_hovered", "TabContainerInner", style_tab_hovered_inner); |
| 2117 | p_theme->set_stylebox("tab_hovered", "TabBarInner", style_tab_hovered_inner); |
| 2118 | |
| 2119 | Ref<StyleBoxFlat> style_tab_disabled_inner = style_tab_selected_inner->duplicate(); |
| 2120 | style_tab_disabled_inner->set_bg_color(background_color); |
| 2121 | p_theme->set_stylebox("tab_disabled", "TabContainerInner", style_tab_disabled_inner); |
| 2122 | p_theme->set_stylebox("tab_disabled", "TabBarInner", style_tab_disabled_inner); |
| 2123 | |
| 2124 | Ref<StyleBoxFlat> style_tabbar_background_inner = p_theme->get_stylebox(SNAME("tabbar_background"), SNAME("TabContainer"))->duplicate(); |
| 2125 | style_tabbar_background_inner->set_content_margin_all(p_config.base_margin * EDSCALE); |
| 2126 | style_tabbar_background_inner->set_corner_radius_all(p_config.corner_radius > 0 ? (p_config.corner_radius + p_config.base_margin) * EDSCALE : 0); |
| 2127 | style_tabbar_background_inner->set_bg_color(background_color); |
| 2128 | |
| 2129 | p_theme->set_stylebox("tabbar_background", "TabContainerInner", style_tabbar_background_inner); |
| 2130 | |
| 2131 | p_theme->set_constant("tab_separation", "TabContainerInner", p_config.separation_margin); |
| 2132 | p_theme->set_constant("tab_separation", "TabBarInner", p_config.separation_margin); |
| 2133 | |
| 2134 | p_theme->set_stylebox(SceneStringName(panel), "PanelContainerTabbarInner", style_tabbar_background_inner); |
| 2135 | } |
| 2136 | |
| 2137 | // TreeLineEdit. |
| 2138 | { |
| 2139 | Ref<StyleBoxFlat> tree_line_edit_style = p_theme->get_stylebox(CoreStringName(normal), SNAME("LineEdit"))->duplicate(); |
| 2140 | tree_line_edit_style->set_corner_radius_all(0); |
| 2141 | |
| 2142 | Ref<StyleBoxFlat> tree_line_edit_style_focus = p_theme->get_stylebox("focus", SNAME("LineEdit"))->duplicate(); |
| 2143 | tree_line_edit_style_focus->set_corner_radius_all(0); |
| 2144 | |
| 2145 | p_theme->set_type_variation("TreeLineEdit", "LineEdit"); |
| 2146 | p_theme->set_stylebox(CoreStringName(normal), "TreeLineEdit", tree_line_edit_style); |
| 2147 | p_theme->set_stylebox("focus", "TreeLineEdit", tree_line_edit_style_focus); |
| 2148 | } |
| 2149 | |
| 2150 | // EditorValidationPanel. |
| 2151 | Ref<StyleBoxFlat> editor_validation_panel = p_config.base_style->duplicate(); |
| 2152 | editor_validation_panel->set_bg_color(p_config.surface_low_color); |
| 2153 | editor_validation_panel->set_content_margin_individual(p_config.base_margin * EDSCALE, p_config.base_margin * 0.5 * EDSCALE, p_config.base_margin * EDSCALE, p_config.base_margin * 0.5 * EDSCALE); |
| 2154 | p_theme->set_stylebox(SceneStringName(panel), "EditorValidationPanel", editor_validation_panel); |
| 2155 | |
| 2156 | // Sidebars. |
| 2157 | { |
| 2158 | p_theme->set_type_variation("ScrollContainerSecondary", "ScrollContainer"); |
| 2159 | p_theme->set_type_variation("TreeSecondary", "Tree"); |
| 2160 | p_theme->set_type_variation("ItemListSecondary", "ItemList"); |
| 2161 | p_theme->set_type_variation("EditorAudioBusEffectsTree", "Tree"); |
| 2162 | |
| 2163 | Ref<StyleBoxFlat> style_sidebar = p_config.base_style->duplicate(); |
| 2164 | style_sidebar->set_bg_color(p_config.surface_low_color); |
| 2165 | if (p_config.draw_extra_borders) { |
| 2166 | style_sidebar->set_border_width_all(1 * EDSCALE); |
| 2167 | style_sidebar->set_border_color(p_config.extra_border_color_2); |
| 2168 | } |
| 2169 | |
| 2170 | p_theme->set_stylebox(SceneStringName(panel), "ScrollContainerSecondary", style_sidebar); |
| 2171 | p_theme->set_stylebox(SceneStringName(panel), "TreeSecondary", style_sidebar); |
| 2172 | p_theme->set_stylebox(SceneStringName(panel), "ItemListSecondary", style_sidebar); |
| 2173 | // Use it for EditorDebuggerInspector in StackTrace to keep the default 3-column layout, |
| 2174 | // as the debugger inspector is too small to be considered a main area. |
| 2175 | p_theme->set_stylebox(SceneStringName(panel), "EditorDebuggerInspector", style_sidebar); |
| 2176 | |
| 2177 | // TreeSecondary title headers |
| 2178 | Ref<StyleBoxFlat> style_tree_title_secondary = p_config.base_style->duplicate(); |
| 2179 | Color secondary_title_color = _get_base_color(p_config, 1.6, 0.9); |
| 2180 | style_tree_title_secondary->set_bg_color(secondary_title_color); |
| 2181 | style_tree_title_secondary->set_border_color(Color(secondary_title_color, 0)); |
| 2182 | style_tree_title_secondary->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2183 | style_tree_title_secondary->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2184 | |
| 2185 | p_theme->set_stylebox("title_button_normal", "TreeSecondary", style_tree_title_secondary); |
| 2186 | p_theme->set_stylebox("title_button_hover", "TreeSecondary", style_tree_title_secondary); |
| 2187 | p_theme->set_stylebox("title_button_pressed", "TreeSecondary", style_tree_title_secondary); |
| 2188 | |
| 2189 | // EditorAudioBusEffectsTree |
| 2190 | Ref<StyleBoxFlat> style_audio_bus_effect_tree = p_config.base_style->duplicate(); |
| 2191 | style_audio_bus_effect_tree->set_bg_color(_get_base_color(p_config, 0.3)); |
| 2192 | if (p_config.draw_extra_borders) { |
| 2193 | style_audio_bus_effect_tree->set_border_width_all(1 * EDSCALE); |
| 2194 | style_audio_bus_effect_tree->set_border_color(p_config.extra_border_color_2); |
| 2195 | } |
| 2196 | p_theme->set_stylebox(SceneStringName(panel), "EditorAudioBusEffectsTree", style_audio_bus_effect_tree); |
| 2197 | } |
| 2198 | |
| 2199 | // ForegroundPanel. |
| 2200 | { |
| 2201 | p_theme->set_type_variation("PanelForeground", "Panel"); |
| 2202 | p_theme->set_type_variation("EditorInspectorForeground", "EditorInspector"); |
| 2203 | |
| 2204 | p_theme->set_stylebox(SceneStringName(panel), "PanelForeground", p_config.foreground_panel); |
| 2205 | p_theme->set_stylebox(SceneStringName(panel), "EditorInspectorForeground", p_config.foreground_panel); |
| 2206 | } |
| 2207 | |
| 2208 | // TreeTable. |
| 2209 | { |
| 2210 | p_theme->set_type_variation("TreeTable", "Tree"); |
| 2211 | |
| 2212 | p_theme->set_constant("h_separation", "TreeTable", 0); |
| 2213 | p_theme->set_constant("inner_item_margin_top", "TreeTable", p_config.base_margin * EDSCALE); |
| 2214 | p_theme->set_constant("inner_item_margin_bottom", "TreeTable", p_config.base_margin * EDSCALE); |
| 2215 | p_theme->set_constant("inner_item_margin_left", "TreeTable", p_config.base_margin * 3 * EDSCALE); |
| 2216 | p_theme->set_constant("inner_item_margin_right", "TreeTable", p_config.base_margin * 3 * EDSCALE); |
| 2217 | p_theme->set_constant("item_margin", "TreeTable", 16 * EDSCALE); |
| 2218 | p_theme->set_constant("button_margin", "TreeTable", 0); |
| 2219 | |
| 2220 | Ref<StyleBoxEmpty> style_tree_panel = p_config.base_empty_style->duplicate(); |
| 2221 | style_tree_panel->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * 0.75 * EDSCALE); |
| 2222 | p_theme->set_stylebox(SceneStringName(panel), "TreeTable", style_tree_panel); |
| 2223 | |
| 2224 | const Ref<StyleBoxFlat> style_tree_title = p_theme->get_stylebox("title_button_normal", "Tree")->duplicate(); |
| 2225 | style_tree_title->set_content_margin_individual(p_config.base_margin * 3 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * 3 * EDSCALE, p_config.base_margin * 1.5 * EDSCALE); |
| 2226 | p_theme->set_stylebox("title_button_normal", "TreeTable", style_tree_title); |
| 2227 | p_theme->set_stylebox("title_button_hover", "TreeTable", style_tree_title); |
| 2228 | p_theme->set_stylebox("title_button_pressed", "TreeTable", style_tree_title); |
| 2229 | |
| 2230 | const Ref<StyleBoxFlat> style_tree_selected = p_theme->get_stylebox("selected", "Tree")->duplicate(); |
| 2231 | style_tree_selected->set_border_color(Color(style_tree_selected->get_bg_color(), 0)); |
| 2232 | style_tree_selected->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2233 | style_tree_selected->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2234 | p_theme->set_stylebox("selected", "TreeTable", style_tree_selected); |
| 2235 | |
| 2236 | const Ref<StyleBoxFlat> style_tree_hover = p_theme->get_stylebox("hovered", "Tree")->duplicate(); |
| 2237 | style_tree_hover->set_border_color(Color(style_tree_hover->get_bg_color(), 0)); |
| 2238 | style_tree_hover->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2239 | style_tree_hover->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2240 | p_theme->set_stylebox("hovered", "TreeTable", style_tree_hover); |
| 2241 | |
| 2242 | const Ref<StyleBoxFlat> style_tree_hovered_selected = p_theme->get_stylebox("hovered_selected", "Tree")->duplicate(); |
| 2243 | style_tree_hovered_selected->set_border_color(Color(style_tree_hovered_selected->get_bg_color(), 0)); |
| 2244 | style_tree_hovered_selected->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2245 | style_tree_hovered_selected->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2246 | p_theme->set_stylebox("hovered_selected", "TreeTable", style_tree_hovered_selected); |
| 2247 | |
| 2248 | const Ref<StyleBoxFlat> style_tree_dimmed = p_theme->get_stylebox("hovered_dimmed", "Tree")->duplicate(); |
| 2249 | style_tree_dimmed->set_border_color(Color(style_tree_dimmed->get_bg_color(), 0)); |
| 2250 | style_tree_dimmed->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2251 | style_tree_dimmed->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2252 | p_theme->set_stylebox("hovered_dimmed", "TreeTable", p_theme->get_stylebox("hovered_dimmed", "Tree")); |
| 2253 | |
| 2254 | const Ref<StyleBoxFlat> style_button_pressed = p_theme->get_stylebox("button_pressed", "Tree")->duplicate(); |
| 2255 | style_button_pressed->set_content_margin_individual(p_config.base_margin * EDSCALE, 0, p_config.base_margin * EDSCALE, 0); |
| 2256 | style_button_pressed->set_border_color(Color(style_button_pressed->get_bg_color(), 0)); |
| 2257 | style_button_pressed->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2258 | style_button_pressed->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2259 | p_theme->set_stylebox("button_pressed", "TreeTable", style_button_pressed); |
| 2260 | p_theme->set_stylebox("custom_button_pressed", "TreeTable", style_button_pressed); |
| 2261 | |
| 2262 | const Ref<StyleBoxFlat> style_button_hover = p_theme->get_stylebox("button_hover", "Tree")->duplicate(); |
| 2263 | style_button_hover->set_content_margin_individual(p_config.base_margin * EDSCALE, 0, p_config.base_margin * EDSCALE, 0); |
| 2264 | style_button_hover->set_border_color(Color(style_button_hover->get_bg_color(), 0)); |
| 2265 | style_button_hover->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2266 | style_button_hover->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2267 | p_theme->set_stylebox("button_hover", "TreeTable", style_button_hover); |
| 2268 | p_theme->set_stylebox("custom_button_hover", "TreeTable", style_button_hover); |
| 2269 | |
| 2270 | const Ref<StyleBoxFlat> style_cursor = p_theme->get_stylebox("cursor", "Tree")->duplicate(); |
| 2271 | style_cursor->set_border_color(Color(style_cursor->get_bg_color(), 0)); |
| 2272 | style_cursor->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2273 | style_cursor->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2274 | p_theme->set_stylebox("cursor", "TreeTable", style_cursor); |
| 2275 | |
| 2276 | const Ref<StyleBoxFlat> style_cursor_unfocused = p_theme->get_stylebox("cursor_unfocused", "Tree")->duplicate(); |
| 2277 | style_cursor_unfocused->set_border_color(Color(style_cursor_unfocused->get_bg_color(), 0)); |
| 2278 | style_cursor_unfocused->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2279 | style_cursor_unfocused->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2280 | p_theme->set_stylebox("cursor_unfocused", "TreeTable", style_cursor_unfocused); |
| 2281 | } |
| 2282 | } |
| 2283 | |
| 2284 | // Editor inspector. |
| 2285 | { |
| 2286 | // Panel. |
| 2287 | p_theme->set_stylebox(SceneStringName(panel), "EditorInspector", p_config.base_empty_style); |
| 2288 | |
| 2289 | // Vertical separation between inspector areas. |
| 2290 | p_theme->set_type_variation("EditorInspectorContainer", "VBoxContainer"); |
| 2291 | p_theme->set_constant("separation", "EditorInspectorContainer", Math::ceil(p_config.base_margin * EDSCALE)); |
| 2292 | |
| 2293 | // Vertical separation between inspector sections. |
| 2294 | p_theme->set_type_variation("EditorSectionContainer", "VBoxContainer"); |
| 2295 | p_theme->set_constant("separation", "EditorSectionContainer", p_config.base_margin * 0.5 * EDSCALE); |
| 2296 | |
| 2297 | // Vertical separation between inspector properties. |
| 2298 | p_theme->set_type_variation("EditorPropertyContainer", "VBoxContainer"); |
| 2299 | p_theme->set_constant("separation", "EditorPropertyContainer", p_config.base_margin * 0.5 * EDSCALE); |
| 2300 | |
| 2301 | // EditorProperty. |
| 2302 | |
| 2303 | Ref<StyleBoxFlat> style_property_bg = p_config.base_style->duplicate(); |
| 2304 | style_property_bg->set_bg_color(p_config.highlight_color); |
| 2305 | style_property_bg->set_border_width_all(0); |
| 2306 | |
| 2307 | Ref<StyleBoxFlat> style_property_bg_selected = p_config.base_style->duplicate(); |
| 2308 | style_property_bg_selected->set_bg_color(p_config.mono_color * Color(1, 1, 1, 0.05)); |
| 2309 | |
| 2310 | Ref<StyleBoxFlat> style_property_child_bg = p_config.base_style->duplicate(); |
| 2311 | style_property_child_bg->set_bg_color(p_config.surface_lower_color); |
| 2312 | style_property_child_bg->set_content_margin_all(p_config.base_margin * EDSCALE); |
| 2313 | |
| 2314 | p_theme->set_stylebox("bg", "EditorProperty", p_config.base_empty_style); |
| 2315 | p_theme->set_stylebox("bg_selected", "EditorProperty", style_property_bg_selected); |
| 2316 | p_theme->set_stylebox("child_bg", "EditorProperty", style_property_child_bg); |
| 2317 | p_theme->set_constant("font_offset", "EditorProperty", 8 * EDSCALE); |
| 2318 | |
| 2319 | const Color property_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.5); |
| 2320 | const Color readonly_color = property_color.lerp(p_config.dark_icon_and_font ? Color(0, 0, 0) : Color(1, 1, 1), 0.25); |
| 2321 | const Color readonly_warning_color = p_config.error_color.lerp(p_config.dark_icon_and_font ? Color(0, 0, 0) : Color(1, 1, 1), 0.25); |
| 2322 | |
| 2323 | p_theme->set_color("property_color", "EditorProperty", p_config.font_color); |
| 2324 | p_theme->set_color("readonly_color", "EditorProperty", readonly_color); |
| 2325 | p_theme->set_color("warning_color", "EditorProperty", p_config.warning_color); |
| 2326 | p_theme->set_color("readonly_warning_color", "EditorProperty", readonly_warning_color); |
| 2327 | |
| 2328 | Ref<StyleBoxFlat> style_property_group_note = p_config.base_style->duplicate(); |
| 2329 | Color property_group_note_color = p_config.accent_color; |
| 2330 | property_group_note_color.a = 0.1; |
| 2331 | style_property_group_note->set_bg_color(property_group_note_color); |
| 2332 | p_theme->set_stylebox("bg_group_note", "EditorProperty", style_property_group_note); |
| 2333 | |
| 2334 | // EditorInspectorSection. |
| 2335 | |
| 2336 | Color inspector_section_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.35); |
| 2337 | p_theme->set_color(SceneStringName(font_color), "EditorInspectorSection", inspector_section_color); |
| 2338 | |
| 2339 | Color inspector_indent_color = p_config.accent_color; |
| 2340 | inspector_indent_color.a = 0.2; |
| 2341 | Ref<StyleBoxFlat> inspector_indent_style = EditorThemeManager::make_flat_stylebox(inspector_indent_color, 2.0 * EDSCALE, 0, 2.0 * EDSCALE, 0); |
| 2342 | p_theme->set_stylebox("indent_box", "EditorInspectorSection", inspector_indent_style); |
| 2343 | p_theme->set_constant("indent_size", "EditorInspectorSection", 6.0 * EDSCALE); |
| 2344 | p_theme->set_constant("h_separation", "EditorInspectorSection", p_config.base_margin * EDSCALE); |
| 2345 | |
| 2346 | Color prop_subsection_stylebox_color = p_config.button_disabled_color.lerp(p_config.base_color, 0.48); |
| 2347 | p_theme->set_color("prop_subsection_stylebox_color", EditorStringName(Editor), prop_subsection_stylebox_color); |
| 2348 | |
| 2349 | Ref<StyleBoxFlat> prop_subsection_stylebox = p_config.base_style->duplicate(); |
| 2350 | prop_subsection_stylebox->set_bg_color(p_theme->get_color("prop_subsection_stylebox_color", EditorStringName(Editor))); |
| 2351 | prop_subsection_stylebox->set_border_color(Color(prop_subsection_stylebox_color, 0)); |
| 2352 | prop_subsection_stylebox->set_corner_radius_all(p_config.corner_radius * EDSCALE); |
| 2353 | p_theme->set_stylebox("prop_subsection_stylebox", EditorStringName(Editor), prop_subsection_stylebox); |
| 2354 | |
| 2355 | Ref<StyleBoxFlat> prop_subsection_stylebox_left = prop_subsection_stylebox->duplicate(); |
| 2356 | prop_subsection_stylebox_left->set_corner_radius(CORNER_TOP_RIGHT, 0); |
| 2357 | prop_subsection_stylebox_left->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 2358 | prop_subsection_stylebox_left->set_border_width(SIDE_LEFT, Math::ceil(EDSCALE)); |
| 2359 | p_theme->set_stylebox("prop_subsection_stylebox_left", EditorStringName(Editor), prop_subsection_stylebox_left); |
| 2360 | |
| 2361 | Ref<StyleBoxFlat> prop_subsection_stylebox_right = prop_subsection_stylebox->duplicate(); |
| 2362 | prop_subsection_stylebox_right->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 2363 | prop_subsection_stylebox_right->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 2364 | prop_subsection_stylebox_right->set_border_width(SIDE_RIGHT, Math::ceil(EDSCALE)); |
| 2365 | p_theme->set_stylebox("prop_subsection_stylebox_right", EditorStringName(Editor), prop_subsection_stylebox_right); |
| 2366 | |
| 2367 | p_theme->set_color("prop_subsection", EditorStringName(Editor), Color(1, 1, 1, 0)); |
| 2368 | #ifndef DISABLE_DEPRECATED // Used before 4.3. |
| 2369 | p_theme->set_color("property_color", EditorStringName(Editor), p_config.dark_color_1.lerp(p_config.mono_color_font, 0.12)); |
| 2370 | #endif |
| 2371 | |
| 2372 | // EditorInspectorCategory. |
| 2373 | |
| 2374 | Ref<StyleBoxFlat> category_bg = p_config.base_style->duplicate(); |
| 2375 | category_bg->set_bg_color(p_config.surface_high_color); |
| 2376 | category_bg->set_content_margin_individual(0, p_config.base_margin * EDSCALE, 0, p_config.base_margin * EDSCALE); |
| 2377 | if (p_config.draw_extra_borders) { |
| 2378 | category_bg->set_border_width_all(1); |
| 2379 | category_bg->set_border_color(p_config.extra_border_color_2); |
| 2380 | } |
| 2381 | p_theme->set_stylebox("bg", "EditorInspectorCategory", category_bg); |
| 2382 | |
| 2383 | // EditorInspectorArray. |
| 2384 | p_theme->set_color("bg", "EditorInspectorArray", p_config.surface_base_color); |
| 2385 | |
| 2386 | p_theme->set_constant("inspector_margin", EditorStringName(Editor), 12 * EDSCALE); |
| 2387 | |
| 2388 | // Colored EditorProperty. |
| 2389 | for (int i = 0; i < 16; i++) { |
| 2390 | Color si_base_color = p_config.accent_color; |
| 2391 | |
| 2392 | float hue_rotate = (i * 2 % 16) / 16.0; |
| 2393 | si_base_color.set_hsv(Math::fmod(float(si_base_color.get_h() + hue_rotate), float(1.0)), si_base_color.get_s(), si_base_color.get_v()); |
| 2394 | si_base_color = p_config.accent_color.lerp(si_base_color, p_config.subresource_hue_tint); |
| 2395 | |
| 2396 | // Sub-inspector background. |
| 2397 | Ref<StyleBoxFlat> sub_inspector_bg = p_config.base_style->duplicate(); |
| 2398 | sub_inspector_bg->set_bg_color(p_config.dark_color_1.lerp(si_base_color, 0.08)); |
| 2399 | sub_inspector_bg->set_border_width_all(2 * EDSCALE); |
| 2400 | sub_inspector_bg->set_border_color(si_base_color * Color(0.7, 0.7, 0.7, 0.8)); |
| 2401 | sub_inspector_bg->set_content_margin_all(4 * EDSCALE); |
| 2402 | sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 2403 | sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0); |
| 2404 | |
| 2405 | p_theme->set_stylebox("sub_inspector_bg" + itos(i + 1), EditorStringName(EditorStyles), sub_inspector_bg); |
| 2406 | |
| 2407 | // EditorProperty background while it has a sub-inspector open. |
| 2408 | Ref<StyleBoxFlat> bg_color = EditorThemeManager::make_flat_stylebox(si_base_color * Color(0.7, 0.7, 0.7, 0.8), 0, 0, 0, 0, p_config.corner_radius); |
| 2409 | bg_color->set_anti_aliased(false); |
| 2410 | bg_color->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 2411 | bg_color->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 2412 | |
| 2413 | p_theme->set_stylebox("sub_inspector_property_bg" + itos(i + 1), EditorStringName(EditorStyles), bg_color); |
| 2414 | |
| 2415 | // Dictionary editor add item. |
| 2416 | // Expand to the left and right by 4px to compensate for the dictionary editor margins. |
| 2417 | |
| 2418 | Color style_dictionary_bg_color = p_config.dark_color_3.lerp(si_base_color, 0.08); |
| 2419 | Ref<StyleBoxFlat> style_dictionary_add_item = EditorThemeManager::make_flat_stylebox(style_dictionary_bg_color, 0, 4, 0, 4, p_config.corner_radius); |
| 2420 | style_dictionary_add_item->set_expand_margin(SIDE_LEFT, 2 * EDSCALE); |
| 2421 | style_dictionary_add_item->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE); |
| 2422 | p_theme->set_stylebox("DictionaryAddItem" + itos(i + 1), EditorStringName(EditorStyles), style_dictionary_add_item); |
| 2423 | } |
| 2424 | Color si_base_color = p_config.accent_color; |
| 2425 | |
| 2426 | // Sub-inspector background. |
| 2427 | Ref<StyleBoxFlat> sub_inspector_bg = p_config.base_style->duplicate(); |
| 2428 | sub_inspector_bg->set_bg_color(Color(1, 1, 1, 0)); |
| 2429 | sub_inspector_bg->set_border_width_all(2 * EDSCALE); |
| 2430 | sub_inspector_bg->set_border_color(p_config.dark_color_1.lerp(si_base_color, 0.15)); |
| 2431 | sub_inspector_bg->set_content_margin_all(4 * EDSCALE); |
| 2432 | sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0); |
| 2433 | sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0); |
| 2434 | |
| 2435 | p_theme->set_stylebox("sub_inspector_bg0", EditorStringName(EditorStyles), sub_inspector_bg); |
| 2436 | |
| 2437 | // Sub-inspector background no border. |
| 2438 | |
| 2439 | Ref<StyleBoxFlat> sub_inspector_bg_no_border = p_config.base_style->duplicate(); |
| 2440 | sub_inspector_bg_no_border->set_content_margin_all(2 * EDSCALE); |
| 2441 | sub_inspector_bg_no_border->set_bg_color(p_config.dark_color_2.lerp(p_config.dark_color_3, 0.15)); |
| 2442 | p_theme->set_stylebox("sub_inspector_bg_no_border", EditorStringName(EditorStyles), sub_inspector_bg_no_border); |
| 2443 | |
| 2444 | // EditorProperty background while it has a sub-inspector open. |
| 2445 | Ref<StyleBoxFlat> bg_color = EditorThemeManager::make_flat_stylebox(p_config.dark_color_1.lerp(si_base_color, 0.15), 0, 0, 0, 0, p_config.corner_radius); |
| 2446 | bg_color->set_anti_aliased(false); |
| 2447 | bg_color->set_corner_radius(CORNER_BOTTOM_LEFT, 0); |
| 2448 | bg_color->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); |
| 2449 | |
| 2450 | p_theme->set_stylebox("sub_inspector_property_bg0", EditorStringName(EditorStyles), bg_color); |
| 2451 | |
| 2452 | p_theme->set_color("sub_inspector_property_color", EditorStringName(EditorStyles), p_config.dark_icon_and_font ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)); |
| 2453 | |
| 2454 | // Dictionary editor. |
| 2455 | // Expand to the left and right by 4px to compensate for the dictionary editor margins. |
| 2456 | Ref<StyleBoxEmpty> style_dictionary_add_item = EditorThemeManager::make_empty_stylebox(0, 4, 0, 4); |
| 2457 | p_theme->set_stylebox("DictionaryAddItem0", EditorStringName(EditorStyles), style_dictionary_add_item); |
| 2458 | |
| 2459 | // Object selector. |
| 2460 | p_theme->set_type_variation("ObjectSelectorMargin", "MarginContainer"); |
| 2461 | p_theme->set_constant("margin_left", "ObjectSelectorMargin", p_config.base_margin * 2 * EDSCALE); |
| 2462 | p_theme->set_constant("margin_right", "ObjectSelectorMargin", p_config.base_margin * 2.5 * EDSCALE); |
| 2463 | |
| 2464 | // EditorInspectorButton. |
| 2465 | |
| 2466 | p_theme->set_type_variation("EditorInspectorButton", "Button"); |
| 2467 | Ref<StyleBoxFlat> style_line = p_theme->get_stylebox(CoreStringName(normal), SNAME("LineEdit")); |
| 2468 | float vertical_margin = style_line->get_content_margin(SIDE_TOP); |
| 2469 | |
| 2470 | Ref<StyleBoxFlat> style_inspector_button = p_config.button_style->duplicate(); |
| 2471 | style_inspector_button->set_content_margin(SIDE_TOP, vertical_margin); |
| 2472 | style_inspector_button->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2473 | |
| 2474 | Ref<StyleBoxFlat> style_inspector_button_hover = p_config.button_style_hover->duplicate(); |
| 2475 | style_inspector_button_hover->set_content_margin(SIDE_TOP, vertical_margin); |
| 2476 | style_inspector_button_hover->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2477 | |
| 2478 | Ref<StyleBoxFlat> style_inspector_button_pressed = p_config.button_style_pressed->duplicate(); |
| 2479 | style_inspector_button_pressed->set_content_margin(SIDE_TOP, vertical_margin); |
| 2480 | style_inspector_button_pressed->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2481 | |
| 2482 | Ref<StyleBoxFlat> style_inspector_button_disabled = p_config.button_style_disabled->duplicate(); |
| 2483 | style_inspector_button_disabled->set_content_margin(SIDE_TOP, vertical_margin); |
| 2484 | style_inspector_button_disabled->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2485 | |
| 2486 | p_theme->set_stylebox(CoreStringName(normal), "EditorInspectorButton", style_inspector_button); |
| 2487 | p_theme->set_stylebox(SceneStringName(hover), "EditorInspectorButton", style_inspector_button_hover); |
| 2488 | p_theme->set_stylebox(SceneStringName(pressed), "EditorInspectorButton", style_inspector_button_pressed); |
| 2489 | p_theme->set_stylebox("hover_pressed", "EditorInspectorButton", style_inspector_button_pressed); |
| 2490 | p_theme->set_stylebox("disabled", "EditorInspectorButton", style_inspector_button_disabled); |
| 2491 | |
| 2492 | p_theme->set_stylebox("normal_mirrored", "EditorInspectorButton", style_inspector_button); |
| 2493 | p_theme->set_stylebox("hover_mirrored", "EditorInspectorButton", style_inspector_button_hover); |
| 2494 | p_theme->set_stylebox("pressed_mirrored", "EditorInspectorButton", style_inspector_button_pressed); |
| 2495 | p_theme->set_stylebox("hover_pressed_mirrored", "EditorInspectorButton", style_inspector_button_pressed); |
| 2496 | p_theme->set_stylebox("disabled_mirrored", "EditorInspectorButton", style_inspector_button_disabled); |
| 2497 | |
| 2498 | // Make the height for properties uniform. |
| 2499 | Ref<StyleBoxFlat> inspector_button_style = p_theme->get_stylebox(CoreStringName(normal), SNAME("EditorInspectorButton")); |
| 2500 | Ref<Font> font = p_theme->get_font(SceneStringName(font), SNAME("LineEdit")); |
| 2501 | int font_size = p_theme->get_font_size(SceneStringName(font_size), SNAME("LineEdit")); |
| 2502 | p_config.inspector_property_height = inspector_button_style->get_minimum_size().height + font->get_height(font_size); |
| 2503 | p_theme->set_constant("inspector_property_height", EditorStringName(Editor), p_config.inspector_property_height); |
| 2504 | |
| 2505 | // EditorInspectorFlatButton. |
| 2506 | |
| 2507 | p_theme->set_type_variation("EditorInspectorFlatButton", "FlatButton"); |
| 2508 | |
| 2509 | Ref<StyleBoxFlat> inspector_flat_button_hover = p_config.flat_button_hover->duplicate(); |
| 2510 | inspector_flat_button_hover->set_content_margin(SIDE_TOP, vertical_margin); |
| 2511 | inspector_flat_button_hover->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2512 | |
| 2513 | Ref<StyleBoxFlat> inspector_flat_button_pressed = p_config.flat_button_pressed->duplicate(); |
| 2514 | inspector_flat_button_pressed->set_content_margin(SIDE_TOP, vertical_margin); |
| 2515 | inspector_flat_button_pressed->set_content_margin(SIDE_BOTTOM, vertical_margin); |
| 2516 | |
| 2517 | p_theme->set_stylebox(CoreStringName(normal), "EditorInspectorFlatButton", p_config.base_empty_wide_style); |
| 2518 | p_theme->set_stylebox(SceneStringName(hover), "EditorInspectorFlatButton", p_config.flat_button_hover); |
| 2519 | p_theme->set_stylebox(SceneStringName(pressed), "EditorInspectorFlatButton", p_config.flat_button_pressed); |
| 2520 | p_theme->set_stylebox("hover_pressed", "EditorInspectorFlatButton", p_config.flat_button_hover_pressed); |
| 2521 | p_theme->set_stylebox("disabled", "EditorInspectorFlatButton", p_config.base_empty_wide_style); |
| 2522 | |
| 2523 | // InspectorActionButton. |
| 2524 | p_theme->set_type_variation("InspectorActionButton", "Button"); |
| 2525 | p_theme->set_constant("h_separation", "InspectorActionButton", p_config.base_margin * 2 * EDSCALE); |
| 2526 | } |
| 2527 | |
| 2528 | // Animation Editor. |
| 2529 | { |
| 2530 | // Timeline general. |
| 2531 | |
| 2532 | p_theme->set_constant("timeline_v_separation", "AnimationTrackEditor", p_config.base_margin * EDSCALE); |
| 2533 | p_theme->set_constant("track_v_separation", "AnimationTrackEditor", 0); |
| 2534 | |
| 2535 | int margin = p_theme->get_stylebox(SceneStringName(panel), SNAME("PanelContainer"))->get_content_margin(SIDE_LEFT); |
| 2536 | |
| 2537 | p_theme->set_type_variation("AnimationTrackMargins", "MarginContainer"); |
| 2538 | p_theme->set_constant("margin_left", "AnimationTrackMargins", margin); |
| 2539 | p_theme->set_constant("margin_right", "AnimationTrackMargins", margin); |
| 2540 | |
| 2541 | // AnimationTimelineEdit. |
| 2542 | // "primary" is used for integer timeline values, "secondary" for decimals. |
| 2543 | |
| 2544 | Ref<StyleBoxFlat> style_time_available = p_config.base_style->duplicate(); |
| 2545 | style_time_available->set_bg_color(p_config.dark_theme ? p_config.surface_highest_color : p_config.surface_high_color); |
| 2546 | if (p_config.draw_extra_borders) { |
| 2547 | style_time_available->set_border_width_all(Math::round(EDSCALE)); |
| 2548 | style_time_available->set_border_color(p_config.extra_border_color_2); |
| 2549 | } |
| 2550 | |
| 2551 | Ref<StyleBoxFlat> style_time_unavailable = p_config.base_style->duplicate(); |
| 2552 | style_time_unavailable->set_bg_color(p_config.dark_theme ? p_config.surface_high_color : p_config.surface_highest_color); |
| 2553 | |
| 2554 | p_theme->set_stylebox("time_available", "AnimationTimelineEdit", style_time_available); |
| 2555 | p_theme->set_stylebox("time_unavailable", "AnimationTimelineEdit", style_time_unavailable); |
| 2556 | |
| 2557 | p_theme->set_color("v_line_primary_color", "AnimationTimelineEdit", p_config.mono_color * Color(1, 1, 1, 0.4)); |
| 2558 | p_theme->set_color("v_line_secondary_color", "AnimationTimelineEdit", p_config.mono_color * Color(1, 1, 1, 0.08)); |
| 2559 | p_theme->set_color("h_line_color", "AnimationTimelineEdit", Color(1, 1, 1, 0)); |
| 2560 | p_theme->set_color("font_primary_color", "AnimationTimelineEdit", p_config.font_color); |
| 2561 | p_theme->set_color("font_secondary_color", "AnimationTimelineEdit", p_config.font_disabled_color); |
| 2562 | |
| 2563 | p_theme->set_constant("v_line_primary_margin", "AnimationTimelineEdit", p_config.base_margin * EDSCALE); |
| 2564 | p_theme->set_constant("v_line_secondary_margin", "AnimationTimelineEdit", p_config.base_margin * 1.5 * EDSCALE); |
| 2565 | p_theme->set_constant("v_line_primary_width", "AnimationTimelineEdit", Math::ceil(2 * EDSCALE)); |
| 2566 | p_theme->set_constant("v_line_secondary_width", "AnimationTimelineEdit", Math::ceil(EDSCALE)); |
| 2567 | p_theme->set_constant("text_primary_margin", "AnimationTimelineEdit", p_config.base_margin * 0.75 * EDSCALE); |
| 2568 | p_theme->set_constant("text_secondary_margin", "AnimationTimelineEdit", p_config.base_margin * 0.5 * EDSCALE); |
| 2569 | |
| 2570 | // AnimationTrackEdit. |
| 2571 | |
| 2572 | Ref<StyleBoxFlat> style_animation_track_odd = p_config.base_style->duplicate(); |
| 2573 | style_animation_track_odd->set_bg_color(p_config.surface_base_color); |
| 2574 | |
| 2575 | Ref<StyleBoxFlat> style_animation_track_hover = p_config.base_style->duplicate(); |
| 2576 | style_animation_track_hover->set_bg_color(p_config.surface_high_color); |
| 2577 | |
| 2578 | Ref<StyleBoxFlat> style_animation_track_focus = p_config.base_style->duplicate(); |
| 2579 | style_animation_track_focus->set_content_margin_individual(p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * EDSCALE, p_config.base_margin * 1.5 * EDSCALE, p_config.base_margin * EDSCALE); |
| 2580 | style_animation_track_focus->set_border_width_all(2); |
| 2581 | style_animation_track_focus->set_border_color(p_config.surface_high_color); |
| 2582 | style_animation_track_focus->set_draw_center(false); |
| 2583 | |
| 2584 | p_theme->set_stylebox("odd", "AnimationTrackEdit", style_animation_track_odd); |
| 2585 | p_theme->set_stylebox(SceneStringName(hover), "AnimationTrackEdit", style_animation_track_hover); |
| 2586 | p_theme->set_stylebox("focus", "AnimationTrackEdit", style_animation_track_focus); |
| 2587 | |
| 2588 | p_theme->set_color("h_line_color", "AnimationTrackEdit", Color(1, 1, 1, 0)); |
| 2589 | |
| 2590 | p_theme->set_constant("h_separation", "AnimationTrackEdit", p_config.base_margin * 1.5 * EDSCALE); |
| 2591 | p_theme->set_constant("outer_margin", "AnimationTrackEdit", p_config.increased_margin * 6 * EDSCALE); |
| 2592 | |
| 2593 | // AnimationTrackEditGroup. |
| 2594 | |
| 2595 | Ref<StyleBoxFlat> style_animation_track_header = p_config.base_style->duplicate(); |
| 2596 | style_animation_track_header->set_bg_color(p_config.surface_low_color); |
| 2597 | style_animation_track_header->set_content_margin_individual(p_config.base_margin * 4 * EDSCALE, p_config.base_margin * EDSCALE, 0, p_config.base_margin * EDSCALE); |
| 2598 | |
| 2599 | p_theme->set_stylebox("header", "AnimationTrackEditGroup", style_animation_track_header); |
| 2600 | |
| 2601 | Ref<StyleBoxFlat> style_animation_track_group_hover = p_config.base_style->duplicate(); |
| 2602 | style_animation_track_group_hover->set_bg_color(p_config.surface_high_color); |
| 2603 | p_theme->set_stylebox(SceneStringName(hover), "AnimationTrackEditGroup", style_animation_track_group_hover); |
| 2604 | |
| 2605 | p_theme->set_color("bg_color", "AnimationTrackEditGroup", p_config.surface_base_color); |
| 2606 | p_theme->set_color("h_line_color", "AnimationTrackEditGroup", Color(1, 1, 1, 0)); |
| 2607 | p_theme->set_color("v_line_color", "AnimationTrackEditGroup", Color(1, 1, 1, 0)); |
| 2608 | |
| 2609 | p_theme->set_constant("h_separation", "AnimationTrackEditGroup", p_config.base_margin * 2 * EDSCALE); |
| 2610 | p_theme->set_constant("v_separation", "AnimationTrackEditGroup", 0); |
| 2611 | |
| 2612 | // AnimationBezierTrackEdit. |
| 2613 | |
| 2614 | p_theme->set_color("focus_color", "AnimationBezierTrackEdit", p_config.accent_color * Color(1, 1, 1, 0.8)); |
| 2615 | p_theme->set_color("track_focus_color", "AnimationBezierTrackEdit", p_config.mono_color * Color(1, 1, 1, 0.1)); |
| 2616 | p_theme->set_color("h_line_color", "AnimationBezierTrackEdit", p_config.mono_color * Color(1, 1, 1, 0.12)); |
| 2617 | p_theme->set_color("v_line_color", "AnimationBezierTrackEdit", Color(1, 1, 1, 0)); |
| 2618 | |
| 2619 | p_theme->set_constant("h_separation", "AnimationBezierTrackEdit", (p_config.increased_margin + 2) * EDSCALE); |
| 2620 | p_theme->set_constant("v_separation", "AnimationBezierTrackEdit", p_config.forced_even_separation * EDSCALE); |
| 2621 | } |
| 2622 | |
| 2623 | // Editor help. |
| 2624 | { |
| 2625 | Ref<StyleBoxFlat> style_editor_help = p_config.base_style->duplicate(); |
| 2626 | style_editor_help->set_bg_color(p_config.dark_color_2); |
| 2627 | style_editor_help->set_border_color(p_config.dark_color_3); |
| 2628 | p_theme->set_stylebox("background", "EditorHelp", style_editor_help); |
| 2629 | |
| 2630 | const Color kbd_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.5); |
| 2631 | |
| 2632 | p_theme->set_color("title_color", "EditorHelp", p_config.accent_color); |
| 2633 | p_theme->set_color("headline_color", "EditorHelp", p_config.mono_color_font); |
| 2634 | p_theme->set_color("text_color", "EditorHelp", p_config.font_color); |
| 2635 | p_theme->set_color("comment_color", "EditorHelp", p_config.font_color * Color(1, 1, 1, 0.6)); |
| 2636 | p_theme->set_color("symbol_color", "EditorHelp", p_config.font_color * Color(1, 1, 1, 0.6)); |
| 2637 | p_theme->set_color("value_color", "EditorHelp", p_config.font_color * Color(1, 1, 1, 0.6)); |
| 2638 | p_theme->set_color("qualifier_color", "EditorHelp", p_config.font_color * Color(1, 1, 1, 0.8)); |
| 2639 | p_theme->set_color("type_color", "EditorHelp", p_config.accent_color.lerp(p_config.font_color, 0.5)); |
| 2640 | p_theme->set_color("override_color", "EditorHelp", p_config.warning_color); |
| 2641 | p_theme->set_color("selection_color", "EditorHelp", p_config.selection_color); |
| 2642 | p_theme->set_color("link_color", "EditorHelp", p_config.accent_color.lerp(p_config.mono_color_font, 0.8)); |
| 2643 | p_theme->set_color("code_color", "EditorHelp", p_config.accent_color.lerp(p_config.mono_color_font, 0.6)); |
| 2644 | p_theme->set_color("kbd_color", "EditorHelp", p_config.accent_color.lerp(kbd_color, 0.6)); |
| 2645 | p_theme->set_color("code_bg_color", "EditorHelp", _get_base_color(p_config, 1.6, 0.8)); |
| 2646 | p_theme->set_color("kbd_bg_color", "EditorHelp", p_config.dark_color_1); |
| 2647 | p_theme->set_color("param_bg_color", "EditorHelp", p_config.dark_color_1); |
| 2648 | p_theme->set_constant(SceneStringName(line_separation), "EditorHelp", Math::round(6 * EDSCALE)); |
| 2649 | p_theme->set_constant("table_h_separation", "EditorHelp", 16 * EDSCALE); |
| 2650 | p_theme->set_constant("table_v_separation", "EditorHelp", 6 * EDSCALE); |
| 2651 | p_theme->set_constant("text_highlight_h_padding", "EditorHelp", 1 * EDSCALE); |
| 2652 | p_theme->set_constant("text_highlight_v_padding", "EditorHelp", 2 * EDSCALE); |
| 2653 | } |
| 2654 | |
| 2655 | // EditorHelpBitTitle. |
| 2656 | { |
| 2657 | Ref<StyleBoxFlat> editor_help_title_style = p_config.base_style->duplicate(); |
| 2658 | editor_help_title_style->set_bg_color(_get_base_color(p_config, 1.25, 0.75)); |
| 2659 | editor_help_title_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE); |
| 2660 | editor_help_title_style->set_corner_radius_individual(p_config.corner_radius * EDSCALE, p_config.corner_radius * EDSCALE, 0, 0); |
| 2661 | if (p_config.draw_extra_borders) { |
| 2662 | editor_help_title_style->set_border_width_all(Math::round(EDSCALE)); |
| 2663 | editor_help_title_style->set_border_color(p_config.extra_border_color_2); |
| 2664 | } |
| 2665 | |
| 2666 | p_theme->set_type_variation("EditorHelpBitTitle", "RichTextLabel"); |
| 2667 | p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTitle", editor_help_title_style); |
| 2668 | } |
| 2669 | |
| 2670 | // EditorHelpBitContent. |
| 2671 | { |
| 2672 | Ref<StyleBoxFlat> editor_help_content_style = p_config.base_style->duplicate(); |
| 2673 | editor_help_content_style->set_bg_color(p_config.surface_low_color); |
| 2674 | editor_help_content_style->set_content_margin_individual(p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE, p_config.base_margin * 2 * EDSCALE, p_config.base_margin * EDSCALE); |
| 2675 | editor_help_content_style->set_corner_radius_individual(0, 0, p_config.corner_radius * EDSCALE, p_config.corner_radius * EDSCALE); |
| 2676 | if (p_config.draw_extra_borders) { |
| 2677 | editor_help_content_style->set_border_width_all(Math::round(EDSCALE)); |
| 2678 | editor_help_content_style->set_border_color(p_config.extra_border_color_2); |
| 2679 | } |
| 2680 | |
| 2681 | p_theme->set_type_variation("EditorHelpBitContent", "RichTextLabel"); |
| 2682 | p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitContent", editor_help_content_style); |
| 2683 | } |
| 2684 | |
| 2685 | // EditorHelpBitTooltipTitle. |
| 2686 | { |
| 2687 | Ref<StyleBoxFlat> style = p_theme->get_stylebox(CoreStringName(normal), "EditorHelpBitTitle")->duplicate(); |
| 2688 | style->set_bg_color(style->get_bg_color().lerp(p_config.mono_color_inv, 0.25)); |
| 2689 | if (!p_config.dark_theme) { |
| 2690 | style->set_border_width_all(Math::round(2 * EDSCALE)); |
| 2691 | style->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.15)); |
| 2692 | } |
| 2693 | style->set_corner_radius_all(0); |
| 2694 | |
| 2695 | p_theme->set_type_variation("EditorHelpBitTooltipTitle", "EditorHelpBitTitle"); |
| 2696 | p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTooltipTitle", style); |
| 2697 | } |
| 2698 | |
| 2699 | // EditorHelpBitTooltipContent. |
| 2700 | { |
| 2701 | Ref<StyleBoxFlat> style = p_theme->get_stylebox(CoreStringName(normal), "EditorHelpBitContent")->duplicate(); |
| 2702 | style->set_bg_color(style->get_bg_color().lerp(p_config.mono_color_inv, 0.25)); |
| 2703 | if (!p_config.dark_theme) { |
| 2704 | style->set_border_width_all(Math::round(2 * EDSCALE)); |
| 2705 | style->set_border_width(SIDE_TOP, 0); |
| 2706 | style->set_border_color(p_config.mono_color * Color(1, 1, 1, 0.15)); |
| 2707 | } |
| 2708 | style->set_corner_radius_all(0); |
| 2709 | |
| 2710 | p_theme->set_type_variation("EditorHelpBitTooltipContent", "EditorHelpBitContent"); |
| 2711 | p_theme->set_stylebox(CoreStringName(normal), "EditorHelpBitTooltipContent", style); |
| 2712 | } |
| 2713 | |
| 2714 | // Asset Library. |
| 2715 | p_theme->set_stylebox("bg", "AssetLib", EditorThemeManager::make_empty_stylebox(p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin)); |
| 2716 | p_theme->set_stylebox(SceneStringName(panel), "AssetLib", p_config.foreground_panel); |
| 2717 | p_theme->set_stylebox("downloads", "AssetLib", p_theme->get_stylebox(SceneStringName(panel), SNAME("ScrollContainerSecondary"))); |
| 2718 | p_theme->set_color("status_color", "AssetLib", Color(0.5, 0.5, 0.5)); // FIXME: Use a defined color instead. |
| 2719 | p_theme->set_icon("dismiss", "AssetLib", p_theme->get_icon(SNAME("Close"), EditorStringName(EditorIcons))); |
| 2720 | |
| 2721 | // Debugger. |
| 2722 | Ref<StyleBoxFlat> debugger_panel_style = p_config.content_panel_style->duplicate(); |
| 2723 | debugger_panel_style->set_border_width(SIDE_BOTTOM, 0); |
| 2724 | p_theme->set_stylebox("DebuggerPanel", EditorStringName(EditorStyles), debugger_panel_style); |
| 2725 | |
| 2726 | // ObjectDB. |
| 2727 | { |
| 2728 | Ref<StyleBoxFlat> style_content_wrapper = p_config.panel_container_style->duplicate(); |
| 2729 | style_content_wrapper->set_draw_center(true); |
| 2730 | style_content_wrapper->set_bg_color(p_config.dark_color_2); |
| 2731 | p_theme->set_stylebox("ObjectDBContentWrapper", EditorStringName(EditorStyles), style_content_wrapper); |
| 2732 | |
| 2733 | Ref<StyleBoxFlat> style_title = style_content_wrapper->duplicate(); |
| 2734 | style_title->set_bg_color(p_config.dark_color_3); |
| 2735 | p_theme->set_stylebox("ObjectDBTitle", EditorStringName(EditorStyles), style_title); |
| 2736 | } |
| 2737 | |
| 2738 | // Resource and node editors. |
| 2739 | { |
| 2740 | // TextureRegion editor. |
| 2741 | Ref<StyleBoxFlat> style_texture_region_bg = p_config.tree_panel_style->duplicate(); |
| 2742 | style_texture_region_bg->set_content_margin_all(0); |
| 2743 | p_theme->set_stylebox("TextureRegionPreviewBG", EditorStringName(EditorStyles), style_texture_region_bg); |
| 2744 | p_theme->set_stylebox("TextureRegionPreviewFG", EditorStringName(EditorStyles), EditorThemeManager::make_empty_stylebox(0, 0, 0, 0)); |
| 2745 | |
| 2746 | // Theme editor. |
| 2747 | { |
| 2748 | p_theme->set_color("preview_picker_overlay_color", "ThemeEditor", Color(0.1, 0.1, 0.1, 0.25)); |
| 2749 | |
| 2750 | Color theme_preview_picker_bg_color = p_config.accent_color; |
| 2751 | theme_preview_picker_bg_color.a = 0.2; |
| 2752 | Ref<StyleBoxFlat> theme_preview_picker_sb = EditorThemeManager::make_flat_stylebox(theme_preview_picker_bg_color, 0, 0, 0, 0); |
| 2753 | theme_preview_picker_sb->set_border_color(p_config.accent_color); |
| 2754 | theme_preview_picker_sb->set_border_width_all(1.0 * EDSCALE); |
| 2755 | p_theme->set_stylebox("preview_picker_overlay", "ThemeEditor", theme_preview_picker_sb); |
| 2756 | |
| 2757 | Color theme_preview_picker_label_bg_color = p_config.accent_color; |
| 2758 | theme_preview_picker_label_bg_color.set_v(0.5); |
| 2759 | Ref<StyleBoxFlat> theme_preview_picker_label_sb = EditorThemeManager::make_flat_stylebox(theme_preview_picker_label_bg_color, 4.0, 1.0, 4.0, 3.0); |
| 2760 | p_theme->set_stylebox("preview_picker_label", "ThemeEditor", theme_preview_picker_label_sb); |
| 2761 | |
| 2762 | Ref<StyleBoxFlat> style_theme_preview_tab = p_theme->get_stylebox(SNAME("tab_selected"), SNAME("TabContainer"))->duplicate(); |
| 2763 | style_theme_preview_tab->set_expand_margin(SIDE_BOTTOM, 5 * EDSCALE); |
| 2764 | p_theme->set_stylebox("ThemeEditorPreviewFG", EditorStringName(EditorStyles), style_theme_preview_tab); |
| 2765 | |
| 2766 | Ref<StyleBoxFlat> style_theme_preview_bg_tab = p_theme->get_stylebox(SNAME("tab_unselected"), SNAME("TabContainer"))->duplicate(); |
| 2767 | style_theme_preview_bg_tab->set_expand_margin(SIDE_BOTTOM, 2 * EDSCALE); |
| 2768 | p_theme->set_stylebox("ThemeEditorPreviewBG", EditorStringName(EditorStyles), style_theme_preview_bg_tab); |
| 2769 | } |
| 2770 | |
| 2771 | // VisualShader editor. |
| 2772 | p_theme->set_stylebox("label_style", "VShaderEditor", EditorThemeManager::make_empty_stylebox(4, 6, 4, 6)); |
| 2773 | |
| 2774 | // StateMachine graph. |
| 2775 | { |
| 2776 | p_theme->set_stylebox(SceneStringName(panel), "GraphStateMachine", p_config.tree_panel_style); |
| 2777 | p_theme->set_stylebox("error_panel", "GraphStateMachine", p_config.tree_panel_style); |
| 2778 | p_theme->set_color("error_color", "GraphStateMachine", p_config.error_color); |
| 2779 | |
| 2780 | const int sm_margin_side = 10 * EDSCALE; |
| 2781 | const int sm_margin_bottom = 2; |
| 2782 | const Color sm_bg_color = p_config.dark_theme ? p_config.dark_color_3 : p_config.dark_color_1.lerp(p_config.mono_color, 0.09); |
| 2783 | |
| 2784 | Ref<StyleBoxFlat> sm_node_style = EditorThemeManager::make_flat_stylebox(p_config.dark_color_3 * Color(1, 1, 1, 0.7), sm_margin_side, 24 * EDSCALE, sm_margin_side, sm_margin_bottom, p_config.corner_radius); |
| 2785 | sm_node_style->set_border_width_all(p_config.border_width); |
| 2786 | sm_node_style->set_border_color(sm_bg_color); |
| 2787 | |
| 2788 | Ref<StyleBoxFlat> sm_node_selected_style = EditorThemeManager::make_flat_stylebox(sm_bg_color * Color(1, 1, 1, 0.9), sm_margin_side, 24 * EDSCALE, sm_margin_side, sm_margin_bottom, p_config.corner_radius); |
| 2789 | sm_node_selected_style->set_border_width_all(2 * EDSCALE + p_config.border_width); |
| 2790 | sm_node_selected_style->set_border_color(p_config.accent_color * Color(1, 1, 1, 0.9)); |
| 2791 | sm_node_selected_style->set_shadow_size(8 * EDSCALE); |
| 2792 | sm_node_selected_style->set_shadow_color(p_config.shadow_color); |
| 2793 | |
| 2794 | Ref<StyleBoxFlat> sm_node_playing_style = sm_node_selected_style->duplicate(); |
| 2795 | sm_node_playing_style->set_border_color(p_config.warning_color); |
| 2796 | sm_node_playing_style->set_shadow_color(p_config.warning_color * Color(1, 1, 1, 0.2)); |
| 2797 | sm_node_playing_style->set_draw_center(false); |
| 2798 | |
| 2799 | p_theme->set_stylebox("node_frame", "GraphStateMachine", sm_node_style); |
| 2800 | p_theme->set_stylebox("node_frame_selected", "GraphStateMachine", sm_node_selected_style); |
| 2801 | p_theme->set_stylebox("node_frame_playing", "GraphStateMachine", sm_node_playing_style); |
| 2802 | |
| 2803 | Ref<StyleBoxFlat> sm_node_start_style = sm_node_style->duplicate(); |
| 2804 | sm_node_start_style->set_border_width_all(1 * EDSCALE); |
| 2805 | sm_node_start_style->set_border_color(p_config.success_color.lightened(0.24)); |
| 2806 | p_theme->set_stylebox("node_frame_start", "GraphStateMachine", sm_node_start_style); |
| 2807 | |
| 2808 | Ref<StyleBoxFlat> sm_node_end_style = sm_node_style->duplicate(); |
| 2809 | sm_node_end_style->set_border_width_all(1 * EDSCALE); |
| 2810 | sm_node_end_style->set_border_color(p_config.error_color); |
| 2811 | p_theme->set_stylebox("node_frame_end", "GraphStateMachine", sm_node_end_style); |
| 2812 | |
| 2813 | p_theme->set_font("node_title_font", "GraphStateMachine", p_theme->get_font(SceneStringName(font), SNAME("Label"))); |
| 2814 | p_theme->set_font_size("node_title_font_size", "GraphStateMachine", p_theme->get_font_size(SceneStringName(font_size), SNAME("Label"))); |
| 2815 | p_theme->set_color("node_title_font_color", "GraphStateMachine", p_config.font_color); |
| 2816 | |
| 2817 | p_theme->set_color("transition_color", "GraphStateMachine", p_config.font_color); |
| 2818 | p_theme->set_color("transition_disabled_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.2)); |
| 2819 | p_theme->set_color("transition_icon_color", "GraphStateMachine", Color(1, 1, 1)); |
| 2820 | p_theme->set_color("transition_icon_disabled_color", "GraphStateMachine", Color(1, 1, 1, 0.2)); |
| 2821 | p_theme->set_color("highlight_color", "GraphStateMachine", p_config.accent_color); |
| 2822 | p_theme->set_color("highlight_disabled_color", "GraphStateMachine", p_config.accent_color * Color(1, 1, 1, 0.6)); |
| 2823 | p_theme->set_color("focus_color", "GraphStateMachine", p_config.accent_color * Color(1, 1, 1, 0.8)); |
| 2824 | p_theme->set_color("guideline_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.3)); |
| 2825 | |
| 2826 | p_theme->set_color("playback_color", "GraphStateMachine", p_config.font_color); |
| 2827 | p_theme->set_color("playback_background_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.3)); |
| 2828 | } |
| 2829 | } |
| 2830 | |
| 2831 | // TileSet editor. |
| 2832 | // This editor is using Tree panel for the panel container of expanded view, while the theme |
| 2833 | // needs trees to be transparent, so it needs to have its own style. |
| 2834 | Ref<StyleBoxFlat> tile_expand_style = p_config.base_style->duplicate(); |
| 2835 | tile_expand_style->set_corner_radius_all(0); |
| 2836 | p_theme->set_stylebox("expand_panel", "TileSetEditor", tile_expand_style); |
| 2837 | } |