feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View file

@ -173,6 +173,8 @@ void EditorColorMap::create() {
add_conversion_exception("OverbrightIndicator");
add_conversion_exception("MaterialPreviewCube");
add_conversion_exception("MaterialPreviewSphere");
add_conversion_exception("MaterialPreviewQuad");
add_conversion_exception("MaterialPreviewLight1");
add_conversion_exception("MaterialPreviewLight2");

View file

@ -50,8 +50,8 @@ public:
static void add_conversion_color_pair(const String &p_from_color, const String &p_to_color);
static void add_conversion_exception(const StringName &p_icon_name);
static HashMap<Color, Color> &get_color_conversion_map() { return color_conversion_map; };
static HashSet<StringName> &get_color_conversion_exceptions() { return color_conversion_exceptions; };
static HashMap<Color, Color> &get_color_conversion_map() { return color_conversion_map; }
static HashSet<StringName> &get_color_conversion_exceptions() { return color_conversion_exceptions; }
static void create();
static void finish();

View file

@ -117,6 +117,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
int font_hinting_setting = (int)EDITOR_GET("interface/editor/font_hinting");
TextServer::SubpixelPositioning font_subpixel_positioning = (TextServer::SubpixelPositioning)(int)EDITOR_GET("interface/editor/font_subpixel_positioning");
bool font_disable_embedded_bitmaps = (bool)EDITOR_GET("interface/editor/font_disable_embedded_bitmaps");
bool font_allow_msdf = (bool)EDITOR_GET("interface/editor/font_allow_msdf");
TextServer::Hinting font_hinting;
TextServer::Hinting font_mono_hinting;
@ -153,10 +154,22 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
const float embolden_strength = 0.6;
Ref<Font> default_font = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
Ref<Font> default_font_msdf = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, true);
Ref<Font> default_font_msdf = load_internal_font(_font_NotoSans_Regular, _font_NotoSans_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
String noto_cjk_path;
String noto_cjk_bold_path;
String var_suffix[] = { "HK", "KR", "SC", "TC", "JP" }; // Note: All Noto Sans CJK versions support all glyph variations, it should not match current locale.
for (size_t i = 0; i < sizeof(var_suffix) / sizeof(String); i++) {
if (noto_cjk_path.is_empty()) {
noto_cjk_path = OS::get_singleton()->get_system_font_path("Noto Sans CJK " + var_suffix[i], 400, 100);
}
if (noto_cjk_bold_path.is_empty()) {
noto_cjk_bold_path = OS::get_singleton()->get_system_font_path("Noto Sans CJK " + var_suffix[i], 800, 100);
}
}
TypedArray<Font> fallbacks;
Ref<FontFile> arabic_font = load_internal_font(_font_NotoNaskhArabicUI_Regular, _font_NotoNaskhArabicUI_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> arabic_font = load_internal_font(_font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> bengali_font = load_internal_font(_font_NotoSansBengaliUI_Regular, _font_NotoSansBengaliUI_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> devanagari_font = load_internal_font(_font_NotoSansDevanagariUI_Regular, _font_NotoSansDevanagariUI_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> georgian_font = load_internal_font(_font_NotoSansGeorgian_Regular, _font_NotoSansGeorgian_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
@ -167,16 +180,19 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
Ref<FontFile> tamil_font = load_internal_font(_font_NotoSansTamilUI_Regular, _font_NotoSansTamilUI_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> telugu_font = load_internal_font(_font_NotoSansTeluguUI_Regular, _font_NotoSansTeluguUI_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> thai_font = load_internal_font(_font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
if (!noto_cjk_path.is_empty()) {
load_external_font(noto_cjk_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
}
Ref<FontFile> fallback_font = load_internal_font(_font_DroidSansFallback, _font_DroidSansFallback_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
Ref<FontFile> japanese_font = load_internal_font(_font_DroidSansJapanese, _font_DroidSansJapanese_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks);
default_font->set_fallbacks(fallbacks);
default_font_msdf->set_fallbacks(fallbacks);
Ref<FontFile> default_font_bold = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false);
Ref<FontFile> default_font_bold_msdf = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, true);
Ref<FontFile> default_font_bold_msdf = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
TypedArray<Font> fallbacks_bold;
Ref<FontFile> arabic_font_bold = load_internal_font(_font_NotoNaskhArabicUI_Bold, _font_NotoNaskhArabicUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> arabic_font_bold = load_internal_font(_font_Vazirmatn_Bold, _font_Vazirmatn_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> bengali_font_bold = load_internal_font(_font_NotoSansBengaliUI_Bold, _font_NotoSansBengaliUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> devanagari_font_bold = load_internal_font(_font_NotoSansDevanagariUI_Bold, _font_NotoSansDevanagariUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> georgian_font_bold = load_internal_font(_font_NotoSansGeorgian_Bold, _font_NotoSansGeorgian_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
@ -187,6 +203,9 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
Ref<FontFile> tamil_font_bold = load_internal_font(_font_NotoSansTamilUI_Bold, _font_NotoSansTamilUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> telugu_font_bold = load_internal_font(_font_NotoSansTeluguUI_Bold, _font_NotoSansTeluguUI_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
Ref<FontFile> thai_font_bold = load_internal_font(_font_NotoSansThai_Bold, _font_NotoSansThai_Bold_size, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
if (!noto_cjk_bold_path.is_empty()) {
load_external_font(noto_cjk_bold_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, false, &fallbacks_bold);
}
Ref<FontVariation> fallback_font_bold = make_bold_font(fallback_font, embolden_strength, &fallbacks_bold);
Ref<FontVariation> japanese_font_bold = make_bold_font(japanese_font, embolden_strength, &fallbacks_bold);
@ -234,7 +253,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
Ref<FontVariation> default_fc_msdf;
default_fc_msdf.instantiate();
if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps);
Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
{
TypedArray<Font> fallback_custom;
fallback_custom.push_back(default_font_msdf);
@ -277,7 +296,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
Ref<FontVariation> bold_fc_msdf;
bold_fc_msdf.instantiate();
if (custom_font_path_bold.length() > 0 && dir->file_exists(custom_font_path_bold)) {
Ref<FontFile> custom_font = load_external_font(custom_font_path_bold, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps);
Ref<FontFile> custom_font = load_external_font(custom_font_path_bold, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
{
TypedArray<Font> fallback_custom;
fallback_custom.push_back(default_font_bold_msdf);
@ -285,7 +304,7 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
}
bold_fc_msdf->set_base_font(custom_font);
} else if (custom_font_path.length() > 0 && dir->file_exists(custom_font_path)) {
Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps);
Ref<FontFile> custom_font = load_external_font(custom_font_path, font_hinting, font_antialiasing, true, font_subpixel_positioning, font_disable_embedded_bitmaps, font_allow_msdf);
{
TypedArray<Font> fallback_custom;
fallback_custom.push_back(default_font_bold_msdf);

View file

@ -30,36 +30,26 @@
#include "editor_icons.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/themes/editor_color_map.h"
#include "editor/themes/editor_icons.gen.h"
#include "editor/themes/editor_scale.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/texture.h"
#include "modules/modules_enabled.gen.h" // For svg.
#ifdef MODULE_SVG_ENABLED
#include "modules/svg/image_loader_svg.h"
#endif
void editor_configure_icons(bool p_dark_theme) {
#ifdef MODULE_SVG_ENABLED
if (p_dark_theme) {
ImageLoaderSVG::set_forced_color_map(HashMap<Color, Color>());
} else {
ImageLoaderSVG::set_forced_color_map(EditorColorMap::get_color_conversion_map());
}
#else
WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
#endif
}
// See also `generate_icon()` in `scene/theme/default_theme.cpp`.
Ref<ImageTexture> editor_generate_icon(int p_index, float p_scale, float p_saturation, const HashMap<Color, Color> &p_convert_colors = HashMap<Color, Color>()) {
Ref<Image> img = memnew(Image);
#ifdef MODULE_SVG_ENABLED
// Upsample icon generation only if the editor scale isn't an integer multiplier.
// Generating upsampled icons is slower, and the benefit is hardly visible
// with integer editor scales.
@ -69,11 +59,6 @@ Ref<ImageTexture> editor_generate_icon(int p_index, float p_scale, float p_satur
if (p_saturation != 1.0) {
img->adjust_bcs(1.0, 1.0, p_saturation);
}
#else
// If the SVG module is disabled, we can't really display the UI well, but at least we won't crash.
// 16 pixels is used as it's the most common base size for Godot icons.
img = Image::create_empty(16 * p_scale, 16 * p_scale, false, Image::FORMAT_RGBA8);
#endif
return ImageTexture::create_from_image(img);
}

View file

@ -183,7 +183,7 @@ Ref<EditorTheme> EditorThemeManager::_create_base_theme(const Ref<EditorTheme> &
// If settings are comparable to the old theme, then just copy existing icons over.
// Otherwise, regenerate them.
bool keep_old_icons = (p_old_theme != nullptr && theme->get_generated_icons_hash() == p_old_theme->get_generated_icons_hash());
bool keep_old_icons = (p_old_theme.is_valid() && theme->get_generated_icons_hash() == p_old_theme->get_generated_icons_hash());
if (keep_old_icons) {
print_verbose("EditorTheme: Can keep old icons, copying.");
editor_copy_icons(theme, p_old_theme);
@ -633,6 +633,16 @@ void EditorThemeManager::_create_shared_styles(const Ref<EditorTheme> &p_theme,
// in 4.0, and even if it was, it may not always work in practice (e.g. running with compositing disabled).
p_config.popup_style->set_corner_radius_all(0);
p_config.popup_border_style = p_config.popup_style->duplicate();
p_config.popup_border_style->set_content_margin_all(MAX(Math::round(EDSCALE), p_config.border_width) + 2 + (p_config.base_margin * 1.5) * EDSCALE);
// Always display a border for popups like PopupMenus so they can be distinguished from their background.
p_config.popup_border_style->set_border_width_all(MAX(Math::round(EDSCALE), p_config.border_width));
if (p_config.draw_extra_borders) {
p_config.popup_border_style->set_border_color(p_config.extra_border_color_2);
} else {
p_config.popup_border_style->set_border_color(p_config.dark_color_2);
}
p_config.window_style = p_config.popup_style->duplicate();
p_config.window_style->set_border_color(p_config.base_color);
p_config.window_style->set_border_width(SIDE_TOP, 24 * EDSCALE);
@ -707,7 +717,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
}
// PopupPanel
p_theme->set_stylebox(SceneStringName(panel), "PopupPanel", p_config.popup_style);
p_theme->set_stylebox(SceneStringName(panel), "PopupPanel", p_config.popup_border_style);
}
// Buttons.
@ -715,7 +725,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// Button.
p_theme->set_stylebox(CoreStringName(normal), "Button", p_config.button_style);
p_theme->set_stylebox("hover", "Button", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(hover), "Button", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "Button", p_config.button_style_pressed);
p_theme->set_stylebox("focus", "Button", p_config.button_style_focus);
p_theme->set_stylebox("disabled", "Button", p_config.button_style_disabled);
@ -743,7 +753,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// MenuButton.
p_theme->set_stylebox(CoreStringName(normal), "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("hover", "MenuButton", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(hover), "MenuButton", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("focus", "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("disabled", "MenuButton", p_config.panel_container_style);
@ -759,7 +769,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// MenuBar.
p_theme->set_stylebox(CoreStringName(normal), "MenuBar", p_config.button_style);
p_theme->set_stylebox("hover", "MenuBar", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(hover), "MenuBar", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "MenuBar", p_config.button_style_pressed);
p_theme->set_stylebox("disabled", "MenuBar", p_config.button_style_disabled);
@ -796,7 +806,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("focus", "OptionButton", option_button_focus_style);
p_theme->set_stylebox(CoreStringName(normal), "OptionButton", p_config.button_style);
p_theme->set_stylebox("hover", "OptionButton", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(hover), "OptionButton", p_config.button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "OptionButton", p_config.button_style_pressed);
p_theme->set_stylebox("disabled", "OptionButton", p_config.button_style_disabled);
@ -831,7 +841,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox(CoreStringName(normal), "CheckButton", p_config.panel_container_style);
p_theme->set_stylebox(SceneStringName(pressed), "CheckButton", p_config.panel_container_style);
p_theme->set_stylebox("disabled", "CheckButton", p_config.panel_container_style);
p_theme->set_stylebox("hover", "CheckButton", p_config.panel_container_style);
p_theme->set_stylebox(SceneStringName(hover), "CheckButton", p_config.panel_container_style);
p_theme->set_stylebox("hover_pressed", "CheckButton", p_config.panel_container_style);
p_theme->set_icon("checked", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOn"), EditorStringName(EditorIcons)));
@ -865,12 +875,11 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// CheckBox.
{
Ref<StyleBoxFlat> checkbox_style = p_config.panel_container_style->duplicate();
checkbox_style->set_content_margin_all(p_config.base_margin * EDSCALE);
p_theme->set_stylebox(CoreStringName(normal), "CheckBox", checkbox_style);
p_theme->set_stylebox(SceneStringName(pressed), "CheckBox", checkbox_style);
p_theme->set_stylebox("disabled", "CheckBox", checkbox_style);
p_theme->set_stylebox("hover", "CheckBox", checkbox_style);
p_theme->set_stylebox(SceneStringName(hover), "CheckBox", checkbox_style);
p_theme->set_stylebox("hover_pressed", "CheckBox", checkbox_style);
p_theme->set_icon("checked", "CheckBox", p_theme->get_icon(SNAME("GuiChecked"), EditorStringName(EditorIcons)));
p_theme->set_icon("unchecked", "CheckBox", p_theme->get_icon(SNAME("GuiUnchecked"), EditorStringName(EditorIcons)));
@ -946,6 +955,8 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_color("custom_button_font_highlight", "Tree", p_config.font_hover_color);
p_theme->set_color(SceneStringName(font_color), "Tree", p_config.font_color);
p_theme->set_color("font_hovered_color", "Tree", p_config.mono_color);
p_theme->set_color("font_hovered_dimmed_color", "Tree", p_config.font_color);
p_theme->set_color("font_selected_color", "Tree", p_config.mono_color);
p_theme->set_color("font_disabled_color", "Tree", p_config.font_disabled_color);
p_theme->set_color("font_outline_color", "Tree", p_config.font_outline_color);
@ -955,7 +966,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_constant("v_separation", "Tree", p_config.separation_margin);
p_theme->set_constant("h_separation", "Tree", (p_config.increased_margin + 2) * EDSCALE);
p_theme->set_constant("guide_width", "Tree", p_config.border_width);
p_theme->set_constant("item_margin", "Tree", 3 * p_config.increased_margin * EDSCALE);
p_theme->set_constant("item_margin", "Tree", MAX(3 * p_config.increased_margin * EDSCALE, 12 * EDSCALE));
p_theme->set_constant("inner_item_margin_top", "Tree", p_config.separation_margin);
p_theme->set_constant("inner_item_margin_bottom", "Tree", p_config.separation_margin);
p_theme->set_constant("inner_item_margin_left", "Tree", p_config.increased_margin * EDSCALE);
@ -998,7 +1009,13 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
Ref<StyleBoxFlat> style_tree_hover = p_config.base_style->duplicate();
style_tree_hover->set_bg_color(p_config.highlight_color * Color(1, 1, 1, 0.4));
style_tree_hover->set_border_width_all(0);
p_theme->set_stylebox("hover", "Tree", style_tree_hover);
p_theme->set_stylebox("hovered", "Tree", style_tree_hover);
p_theme->set_stylebox("button_hover", "Tree", style_tree_hover);
Ref<StyleBoxFlat> style_tree_hover_dimmed = p_config.base_style->duplicate();
style_tree_hover_dimmed->set_bg_color(p_config.highlight_color * Color(1, 1, 1, 0.2));
style_tree_hover_dimmed->set_border_width_all(0);
p_theme->set_stylebox("hovered_dimmed", "Tree", style_tree_hover_dimmed);
p_theme->set_stylebox("selected_focus", "Tree", style_tree_focus);
p_theme->set_stylebox("selected", "Tree", style_tree_selected);
@ -1041,6 +1058,10 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
style_itemlist_hover->set_bg_color(p_config.highlight_color * Color(1, 1, 1, 0.3));
style_itemlist_hover->set_border_width_all(0);
Ref<StyleBoxFlat> style_itemlist_hover_selected = style_tree_selected->duplicate();
style_itemlist_hover_selected->set_bg_color(p_config.highlight_color * Color(1, 1, 1, 1.2));
style_itemlist_hover_selected->set_border_width_all(0);
p_theme->set_stylebox(SceneStringName(panel), "ItemList", style_itemlist_bg);
p_theme->set_stylebox("focus", "ItemList", p_config.button_style_focus);
p_theme->set_stylebox("cursor", "ItemList", style_itemlist_cursor);
@ -1048,8 +1069,11 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("selected_focus", "ItemList", style_tree_focus);
p_theme->set_stylebox("selected", "ItemList", style_tree_selected);
p_theme->set_stylebox("hovered", "ItemList", style_itemlist_hover);
p_theme->set_stylebox("hovered_selected", "ItemList", style_itemlist_hover_selected);
p_theme->set_stylebox("hovered_selected_focus", "ItemList", style_itemlist_hover_selected);
p_theme->set_color(SceneStringName(font_color), "ItemList", p_config.font_color);
p_theme->set_color("font_hovered_color", "ItemList", p_config.mono_color);
p_theme->set_color("font_hovered_selected_color", "ItemList", p_config.mono_color);
p_theme->set_color("font_selected_color", "ItemList", p_config.mono_color);
p_theme->set_color("font_outline_color", "ItemList", p_config.font_outline_color);
p_theme->set_color("guide_color", "ItemList", Color(1, 1, 1, 0));
@ -1165,9 +1189,6 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// LineEdit & TextEdit.
{
Ref<StyleBoxFlat> text_editor_style = p_config.button_style->duplicate();
// The original button_style style has an extra 1 pixel offset that makes LineEdits not align with Buttons,
// so this compensates for that.
text_editor_style->set_content_margin(SIDE_TOP, text_editor_style->get_content_margin(SIDE_TOP) - 1 * EDSCALE);
// Don't round the bottom corners to make the line look sharper.
text_editor_style->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
@ -1310,38 +1331,31 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// PopupMenu.
{
Ref<StyleBoxFlat> style_popup_menu = p_config.popup_style->duplicate();
Ref<StyleBoxFlat> style_popup_menu = p_config.popup_border_style->duplicate();
// Use 1 pixel for the sides, since if 0 is used, the highlight of hovered items is drawn
// on top of the popup border. This causes a 'gap' in the panel border when an item is highlighted,
// and it looks weird. 1px solves this.
style_popup_menu->set_content_margin_individual(EDSCALE, 2 * EDSCALE, EDSCALE, 2 * EDSCALE);
// Always display a border for PopupMenus so they can be distinguished from their background.
style_popup_menu->set_border_width_all(EDSCALE);
if (p_config.draw_extra_borders) {
style_popup_menu->set_border_color(p_config.extra_border_color_2);
} else {
style_popup_menu->set_border_color(p_config.dark_color_2);
}
style_popup_menu->set_content_margin_individual(Math::round(EDSCALE), 2 * EDSCALE, Math::round(EDSCALE), 2 * EDSCALE);
p_theme->set_stylebox(SceneStringName(panel), "PopupMenu", style_popup_menu);
Ref<StyleBoxFlat> style_menu_hover = p_config.button_style_hover->duplicate();
// Don't use rounded corners for hover highlights since the StyleBox touches the PopupMenu's edges.
style_menu_hover->set_corner_radius_all(0);
p_theme->set_stylebox("hover", "PopupMenu", style_menu_hover);
p_theme->set_stylebox(SceneStringName(hover), "PopupMenu", style_menu_hover);
Ref<StyleBoxLine> style_popup_separator(memnew(StyleBoxLine));
style_popup_separator->set_color(p_config.separator_color);
style_popup_separator->set_grow_begin(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_grow_end(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_grow_begin(Math::round(EDSCALE) - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_grow_end(Math::round(EDSCALE) - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_thickness(MAX(Math::round(EDSCALE), p_config.border_width));
Ref<StyleBoxLine> style_popup_labeled_separator_left(memnew(StyleBoxLine));
style_popup_labeled_separator_left->set_grow_begin(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_labeled_separator_left->set_grow_begin(Math::round(EDSCALE) - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_labeled_separator_left->set_color(p_config.separator_color);
style_popup_labeled_separator_left->set_thickness(MAX(Math::round(EDSCALE), p_config.border_width));
Ref<StyleBoxLine> style_popup_labeled_separator_right(memnew(StyleBoxLine));
style_popup_labeled_separator_right->set_grow_end(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_labeled_separator_right->set_grow_end(Math::round(EDSCALE) - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_labeled_separator_right->set_color(p_config.separator_color);
style_popup_labeled_separator_right->set_thickness(MAX(Math::round(EDSCALE), p_config.border_width));
@ -1419,21 +1433,24 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("decrement_highlight", "VScrollBar", empty_icon);
p_theme->set_icon("decrement_pressed", "VScrollBar", empty_icon);
// Slider
const int background_margin = MAX(2, p_config.base_margin / 2);
// HSlider.
p_theme->set_icon("grabber_highlight", "HSlider", p_theme->get_icon(SNAME("GuiSliderGrabberHl"), EditorStringName(EditorIcons)));
p_theme->set_icon("grabber", "HSlider", p_theme->get_icon(SNAME("GuiSliderGrabber"), EditorStringName(EditorIcons)));
p_theme->set_stylebox("slider", "HSlider", make_flat_stylebox(p_config.dark_color_3, 0, p_config.base_margin / 2, 0, p_config.base_margin / 2, p_config.corner_radius));
p_theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(p_config.contrast_color_1, 0, p_config.base_margin / 2, 0, p_config.base_margin / 2, p_config.corner_radius));
p_theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(p_config.contrast_color_1, 0, p_config.base_margin / 2, 0, p_config.base_margin / 2));
p_theme->set_stylebox("slider", "HSlider", make_flat_stylebox(p_config.dark_color_3, 0, background_margin, 0, background_margin, p_config.corner_radius));
p_theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(p_config.contrast_color_1, 0, background_margin, 0, background_margin, p_config.corner_radius));
p_theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(p_config.contrast_color_1, 0, background_margin, 0, background_margin));
p_theme->set_constant("center_grabber", "HSlider", 0);
p_theme->set_constant("grabber_offset", "HSlider", 0);
// VSlider.
p_theme->set_icon("grabber", "VSlider", p_theme->get_icon(SNAME("GuiSliderGrabber"), EditorStringName(EditorIcons)));
p_theme->set_icon("grabber_highlight", "VSlider", p_theme->get_icon(SNAME("GuiSliderGrabberHl"), EditorStringName(EditorIcons)));
p_theme->set_stylebox("slider", "VSlider", make_flat_stylebox(p_config.dark_color_3, p_config.base_margin / 2, 0, p_config.base_margin / 2, 0, p_config.corner_radius));
p_theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(p_config.contrast_color_1, p_config.base_margin / 2, 0, p_config.base_margin / 2, 0, p_config.corner_radius));
p_theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(p_config.contrast_color_1, p_config.base_margin / 2, 0, p_config.base_margin / 2, 0));
p_theme->set_stylebox("slider", "VSlider", make_flat_stylebox(p_config.dark_color_3, background_margin, 0, background_margin, 0, p_config.corner_radius));
p_theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(p_config.contrast_color_1, background_margin, 0, background_margin, 0, p_config.corner_radius));
p_theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(p_config.contrast_color_1, background_margin, 0, background_margin, 0));
p_theme->set_constant("center_grabber", "VSlider", 0);
p_theme->set_constant("grabber_offset", "VSlider", 0);
}
@ -1471,8 +1488,46 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
}
// SpinBox.
p_theme->set_icon("updown", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUpdown"), EditorStringName(EditorIcons)));
p_theme->set_icon("updown_disabled", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUpdownDisabled"), EditorStringName(EditorIcons)));
{
Ref<Texture2D> empty_icon = memnew(ImageTexture);
p_theme->set_icon("updown", "SpinBox", empty_icon);
p_theme->set_icon("up", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons)));
p_theme->set_icon("up_hover", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons)));
p_theme->set_icon("up_pressed", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons)));
p_theme->set_icon("up_disabled", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxUp"), EditorStringName(EditorIcons)));
p_theme->set_icon("down", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons)));
p_theme->set_icon("down_hover", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons)));
p_theme->set_icon("down_pressed", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons)));
p_theme->set_icon("down_disabled", "SpinBox", p_theme->get_icon(SNAME("GuiSpinboxDown"), EditorStringName(EditorIcons)));
p_theme->set_stylebox("up_background", "SpinBox", make_empty_stylebox());
p_theme->set_stylebox("up_background_hovered", "SpinBox", p_config.button_style_hover);
p_theme->set_stylebox("up_background_pressed", "SpinBox", p_config.button_style_pressed);
p_theme->set_stylebox("up_background_disabled", "SpinBox", make_empty_stylebox());
p_theme->set_stylebox("down_background", "SpinBox", make_empty_stylebox());
p_theme->set_stylebox("down_background_hovered", "SpinBox", p_config.button_style_hover);
p_theme->set_stylebox("down_background_pressed", "SpinBox", p_config.button_style_pressed);
p_theme->set_stylebox("down_background_disabled", "SpinBox", make_empty_stylebox());
p_theme->set_color("up_icon_modulate", "SpinBox", p_config.font_color);
p_theme->set_color("up_hover_icon_modulate", "SpinBox", p_config.font_hover_color);
p_theme->set_color("up_pressed_icon_modulate", "SpinBox", p_config.font_pressed_color);
p_theme->set_color("up_disabled_icon_modulate", "SpinBox", p_config.font_disabled_color);
p_theme->set_color("down_icon_modulate", "SpinBox", p_config.font_color);
p_theme->set_color("down_hover_icon_modulate", "SpinBox", p_config.font_hover_color);
p_theme->set_color("down_pressed_icon_modulate", "SpinBox", p_config.font_pressed_color);
p_theme->set_color("down_disabled_icon_modulate", "SpinBox", p_config.font_disabled_color);
p_theme->set_stylebox("field_and_buttons_separator", "SpinBox", make_empty_stylebox());
p_theme->set_stylebox("up_down_buttons_separator", "SpinBox", make_empty_stylebox());
p_theme->set_constant("buttons_vertical_separation", "SpinBox", 0);
p_theme->set_constant("field_and_buttons_separation", "SpinBox", 2);
p_theme->set_constant("buttons_width", "SpinBox", 16);
#ifndef DISABLE_DEPRECATED
p_theme->set_constant("set_min_buttons_width_from_icons", "SpinBox", 1);
#endif
}
// ProgressBar.
p_theme->set_stylebox("background", "ProgressBar", make_stylebox(p_theme->get_icon(SNAME("GuiProgressBar"), EditorStringName(EditorIcons)), 4, 4, 4, 4, 0, 0, 0, 0));
@ -1509,6 +1564,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_color("activity", "GraphEdit", p_config.dark_theme ? Color(1, 1, 1) : Color(0, 0, 0));
p_theme->set_color("connection_hover_tint_color", "GraphEdit", p_config.dark_theme ? Color(0, 0, 0, 0.3) : Color(1, 1, 1, 0.3));
p_theme->set_constant("connection_hover_thickness", "GraphEdit", 0);
p_theme->set_color("connection_valid_target_tint_color", "GraphEdit", p_config.dark_theme ? Color(1, 1, 1, 0.4) : Color(0, 0, 0, 0.4));
p_theme->set_color("connection_rim_color", "GraphEdit", p_config.tree_panel_style->get_bg_color());
@ -1633,8 +1689,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// GraphNode's title Label.
p_theme->set_type_variation("GraphNodeTitleLabel", "Label");
p_theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0));
p_theme->set_color(SceneStringName(font_color), "GraphNodeTitleLabel", p_config.dark_theme ? p_config.font_color : Color(1, 1, 1)); // Also use a bright font color for light themes.
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0.35));
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", p_config.shadow_color);
p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4);
p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0);
p_theme->set_constant("shadow_offset_y", "GraphNodeTitleLabel", 1);
@ -1713,6 +1768,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("overbright_indicator", "ColorPicker", p_theme->get_icon(SNAME("OverbrightIndicator"), EditorStringName(EditorIcons)));
p_theme->set_icon("bar_arrow", "ColorPicker", p_theme->get_icon(SNAME("ColorPickerBarArrow"), EditorStringName(EditorIcons)));
p_theme->set_icon("picker_cursor", "ColorPicker", p_theme->get_icon(SNAME("PickerCursor"), EditorStringName(EditorIcons)));
p_theme->set_icon("picker_cursor_bg", "ColorPicker", p_theme->get_icon(SNAME("PickerCursorBg"), EditorStringName(EditorIcons)));
// ColorPickerButton.
p_theme->set_icon("bg", "ColorPickerButton", p_theme->get_icon(SNAME("GuiMiniCheckerboard"), EditorStringName(EditorIcons)));
@ -1734,7 +1790,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// ProjectTag.
{
p_theme->set_type_variation("ProjectTag", "Button");
p_theme->set_type_variation("ProjectTagButton", "Button");
Ref<StyleBoxFlat> tag = p_config.button_style->duplicate();
tag->set_bg_color(p_config.dark_theme ? tag->get_bg_color().lightened(0.2) : tag->get_bg_color().darkened(0.2));
@ -1742,21 +1798,21 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
tag->set_corner_radius(CORNER_TOP_RIGHT, 4);
tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4);
p_theme->set_stylebox(CoreStringName(normal), "ProjectTag", tag);
p_theme->set_stylebox(CoreStringName(normal), "ProjectTagButton", tag);
tag = p_config.button_style_hover->duplicate();
tag->set_corner_radius(CORNER_TOP_LEFT, 0);
tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
tag->set_corner_radius(CORNER_TOP_RIGHT, 4);
tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4);
p_theme->set_stylebox("hover", "ProjectTag", tag);
p_theme->set_stylebox(SceneStringName(hover), "ProjectTagButton", tag);
tag = p_config.button_style_pressed->duplicate();
tag->set_corner_radius(CORNER_TOP_LEFT, 0);
tag->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
tag->set_corner_radius(CORNER_TOP_RIGHT, 4);
tag->set_corner_radius(CORNER_BOTTOM_RIGHT, 4);
p_theme->set_stylebox(SceneStringName(pressed), "ProjectTag", tag);
p_theme->set_stylebox(SceneStringName(pressed), "ProjectTagButton", tag);
}
}
@ -1768,15 +1824,23 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_color("background", EditorStringName(Editor), background_color_opaque);
p_theme->set_stylebox("Background", EditorStringName(EditorStyles), make_flat_stylebox(background_color_opaque, p_config.base_margin, p_config.base_margin, p_config.base_margin, p_config.base_margin));
p_theme->set_stylebox("PanelForeground", EditorStringName(EditorStyles), p_config.base_style);
Ref<StyleBoxFlat> editor_panel_foreground = p_config.base_style->duplicate();
editor_panel_foreground->set_corner_radius_all(0);
p_theme->set_stylebox("PanelForeground", EditorStringName(EditorStyles), editor_panel_foreground);
// Editor focus.
p_theme->set_stylebox("Focus", EditorStringName(EditorStyles), p_config.button_style_focus);
// Use a less opaque color to be less distracting for the 2D and 3D editor viewports.
Ref<StyleBoxFlat> style_widget_focus_viewport = p_config.button_style_focus->duplicate();
// Use a less opaque color to be less distracting for the 2D and 3D editor viewports.
style_widget_focus_viewport->set_border_color(p_config.accent_color * Color(1, 1, 1, 0.5));
p_theme->set_stylebox("FocusViewport", EditorStringName(EditorStyles), style_widget_focus_viewport);
Ref<StyleBoxFlat> style_widget_scroll_container = p_config.button_style_focus->duplicate();
// Make the focus outline appear to be flush with the buttons it's focusing, so not draw on top of the content.
style_widget_scroll_container->set_expand_margin_all(4);
p_theme->set_stylebox("focus", "ScrollContainer", style_widget_scroll_container);
// This stylebox is used in 3d and 2d viewports (no borders).
Ref<StyleBoxFlat> style_content_panel_vp = p_config.content_panel_style->duplicate();
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);
@ -1807,6 +1871,12 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_stylebox("ScriptEditorPanelFloating", EditorStringName(EditorStyles), make_empty_stylebox(0, 0, 0, 0));
p_theme->set_stylebox("ScriptEditor", EditorStringName(EditorStyles), make_empty_stylebox(0, 0, 0, 0));
// Game view.
p_theme->set_type_variation("GamePanel", "Panel");
Ref<StyleBoxFlat> game_panel = p_theme->get_stylebox(SceneStringName(panel), SNAME("Panel"))->duplicate();
game_panel->set_corner_radius_all(0);
p_theme->set_stylebox(SceneStringName(panel), "GamePanel", game_panel);
// Main menu.
Ref<StyleBoxFlat> menu_transparent_style = p_config.button_style->duplicate();
menu_transparent_style->set_bg_color(Color(1, 1, 1, 0));
@ -1820,7 +1890,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_stylebox("normal_mirrored", "MainScreenButton", menu_transparent_style);
p_theme->set_stylebox(SceneStringName(pressed), "MainScreenButton", menu_transparent_style);
p_theme->set_stylebox("pressed_mirrored", "MainScreenButton", menu_transparent_style);
p_theme->set_stylebox("hover", "MainScreenButton", main_screen_button_hover);
p_theme->set_stylebox(SceneStringName(hover), "MainScreenButton", main_screen_button_hover);
p_theme->set_stylebox("hover_mirrored", "MainScreenButton", main_screen_button_hover);
p_theme->set_stylebox("hover_pressed", "MainScreenButton", main_screen_button_hover);
p_theme->set_stylebox("hover_pressed_mirrored", "MainScreenButton", main_screen_button_hover);
@ -1828,7 +1898,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_type_variation("MainMenuBar", "FlatMenuButton");
p_theme->set_stylebox(CoreStringName(normal), "MainMenuBar", menu_transparent_style);
p_theme->set_stylebox(SceneStringName(pressed), "MainMenuBar", main_screen_button_hover);
p_theme->set_stylebox("hover", "MainMenuBar", main_screen_button_hover);
p_theme->set_stylebox(SceneStringName(hover), "MainMenuBar", main_screen_button_hover);
p_theme->set_stylebox("hover_pressed", "MainMenuBar", main_screen_button_hover);
// Run bar.
@ -1844,7 +1914,13 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_stylebox(CoreStringName(normal), "BottomPanelButton", menu_transparent_style);
p_theme->set_stylebox(SceneStringName(pressed), "BottomPanelButton", menu_transparent_style);
p_theme->set_stylebox("hover_pressed", "BottomPanelButton", main_screen_button_hover);
p_theme->set_stylebox("hover", "BottomPanelButton", main_screen_button_hover);
p_theme->set_stylebox(SceneStringName(hover), "BottomPanelButton", main_screen_button_hover);
// Don't tint the icon even when in "pressed" state.
p_theme->set_color("icon_pressed_color", "BottomPanelButton", Color(1, 1, 1, 1));
Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_theme ? 1.15 : 1.0);
icon_hover_color.a = 1.0;
p_theme->set_color("icon_hover_color", "BottomPanelButton", icon_hover_color);
p_theme->set_color("icon_hover_pressed_color", "BottomPanelButton", icon_hover_color);
}
// Editor GUI widgets.
@ -1858,6 +1934,10 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
editor_spin_label_bg->set_border_width_all(0);
p_theme->set_stylebox("label_bg", "EditorSpinSlider", editor_spin_label_bg);
// TODO Use separate arrows instead like on SpinBox. Planned for a different PR.
p_theme->set_icon("updown", "EditorSpinSlider", p_theme->get_icon(SNAME("GuiSpinboxUpdown"), EditorStringName(EditorIcons)));
p_theme->set_icon("updown_disabled", "EditorSpinSlider", p_theme->get_icon(SNAME("GuiSpinboxUpdownDisabled"), EditorStringName(EditorIcons)));
// Launch Pad and Play buttons.
Ref<StyleBoxFlat> style_launch_pad = make_flat_stylebox(p_config.dark_color_1, 2 * EDSCALE, 0, 2 * EDSCALE, 0, p_config.corner_radius);
style_launch_pad->set_corner_radius_all(p_config.corner_radius * EDSCALE);
@ -1867,6 +1947,11 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
style_launch_pad_movie->set_border_color(p_config.accent_color);
style_launch_pad_movie->set_border_width_all(Math::round(2 * EDSCALE));
p_theme->set_stylebox("LaunchPadMovieMode", EditorStringName(EditorStyles), style_launch_pad_movie);
Ref<StyleBoxFlat> style_launch_pad_recovery_mode = style_launch_pad->duplicate();
style_launch_pad_recovery_mode->set_bg_color(p_config.accent_color * Color(1, 1, 1, 0.1));
style_launch_pad_recovery_mode->set_border_color(p_config.warning_color);
style_launch_pad_recovery_mode->set_border_width_all(Math::round(2 * EDSCALE));
p_theme->set_stylebox("LaunchPadRecoveryMode", EditorStringName(EditorStyles), style_launch_pad_recovery_mode);
p_theme->set_stylebox("MovieWriterButtonNormal", EditorStringName(EditorStyles), make_empty_stylebox(0, 0, 0, 0));
Ref<StyleBoxFlat> style_write_movie_button = p_config.button_style_pressed->duplicate();
@ -1884,6 +1969,25 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_color("movie_writer_icon_pressed", EditorStringName(EditorStyles), Color(0, 0, 0, 0.84));
p_theme->set_color("movie_writer_icon_hover", EditorStringName(EditorStyles), Color(1, 1, 1, 0.9));
p_theme->set_color("movie_writer_icon_hover_pressed", EditorStringName(EditorStyles), Color(0, 0, 0, 0.84));
// Profiler autostart indicator panel.
Ref<StyleBoxFlat> style_profiler_autostart = style_launch_pad->duplicate();
style_profiler_autostart->set_bg_color(Color(1, 0.867, 0.396));
p_theme->set_type_variation("ProfilerAutostartIndicator", "Button");
p_theme->set_stylebox(CoreStringName(normal), "ProfilerAutostartIndicator", style_profiler_autostart);
p_theme->set_stylebox(SceneStringName(pressed), "ProfilerAutostartIndicator", style_profiler_autostart);
p_theme->set_stylebox("hover", "ProfilerAutostartIndicator", style_profiler_autostart);
// Recovery mode button style
Ref<StyleBoxFlat> style_recovery_mode_button = p_config.button_style_pressed->duplicate();
style_recovery_mode_button->set_bg_color(p_config.warning_color);
style_recovery_mode_button->set_corner_radius_all(p_config.corner_radius * EDSCALE);
style_recovery_mode_button->set_content_margin_all(0);
// Recovery mode button is implicitly styled from the panel's background.
// So, remove any existing borders. (e.g. from draw_extra_borders config)
style_recovery_mode_button->set_border_width_all(0);
style_recovery_mode_button->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE);
p_theme->set_stylebox("RecoveryModeButton", EditorStringName(EditorStyles), style_recovery_mode_button);
}
// Standard GUI variations.
@ -1917,13 +2021,13 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
}
style_flat_button_pressed->set_bg_color(flat_pressed_color);
p_theme->set_stylebox(CoreStringName(normal), "FlatButton", style_flat_button);
p_theme->set_stylebox("hover", "FlatButton", style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(pressed), "FlatButton", style_flat_button_pressed);
p_theme->set_stylebox("disabled", "FlatButton", style_flat_button);
p_theme->set_stylebox(CoreStringName(normal), SceneStringName(FlatButton), style_flat_button);
p_theme->set_stylebox(SceneStringName(hover), SceneStringName(FlatButton), style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(pressed), SceneStringName(FlatButton), style_flat_button_pressed);
p_theme->set_stylebox("disabled", SceneStringName(FlatButton), style_flat_button);
p_theme->set_stylebox(CoreStringName(normal), "FlatMenuButton", style_flat_button);
p_theme->set_stylebox("hover", "FlatMenuButton", style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(hover), "FlatMenuButton", style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(pressed), "FlatMenuButton", style_flat_button_pressed);
p_theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button);
@ -1938,6 +2042,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_theme ? 1.15 : 1.0);
icon_hover_color.a = 1.0;
p_theme->set_color("icon_hover_color", "EditorLogFilterButton", icon_hover_color);
p_theme->set_color("icon_hover_pressed_color", "EditorLogFilterButton", icon_hover_color);
// When pressed, add a small bottom border to the buttons to better show their active state,
// similar to active tabs.
@ -1948,7 +2053,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
editor_log_button_pressed->set_bg_color(flat_pressed_color.lightened(0.5));
}
p_theme->set_stylebox(CoreStringName(normal), "EditorLogFilterButton", style_flat_button);
p_theme->set_stylebox("hover", "EditorLogFilterButton", style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(hover), "EditorLogFilterButton", style_flat_button_hover);
p_theme->set_stylebox(SceneStringName(pressed), "EditorLogFilterButton", editor_log_button_pressed);
}
@ -1969,7 +2074,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
panel_button_style_disabled->set_bg_color(p_config.disabled_bg_color);
p_theme->set_stylebox(CoreStringName(normal), "PanelBackgroundButton", panel_button_style);
p_theme->set_stylebox("hover", "PanelBackgroundButton", panel_button_style_hover);
p_theme->set_stylebox(SceneStringName(hover), "PanelBackgroundButton", panel_button_style_hover);
p_theme->set_stylebox(SceneStringName(pressed), "PanelBackgroundButton", panel_button_style_pressed);
p_theme->set_stylebox("disabled", "PanelBackgroundButton", panel_button_style_disabled);
}
@ -2012,7 +2117,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
style_inspector_action = p_config.button_style_hover->duplicate();
style_inspector_action->set_content_margin(SIDE_RIGHT, action_extra_margin);
p_theme->set_stylebox("hover", "InspectorActionButton", style_inspector_action);
p_theme->set_stylebox(SceneStringName(hover), "InspectorActionButton", style_inspector_action);
style_inspector_action = p_config.button_style_hover->duplicate();
style_inspector_action->set_content_margin(SIDE_LEFT, action_extra_margin);
@ -2051,7 +2156,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_color("icon_hover_color", "PreviewLightButton", dim_light_highlighted_color);
p_theme->set_stylebox(CoreStringName(normal), "PreviewLightButton", sb_empty_borderless);
p_theme->set_stylebox("hover", "PreviewLightButton", sb_empty_borderless);
p_theme->set_stylebox(SceneStringName(hover), "PreviewLightButton", sb_empty_borderless);
p_theme->set_stylebox("focus", "PreviewLightButton", sb_empty_borderless);
p_theme->set_stylebox(SceneStringName(pressed), "PreviewLightButton", sb_empty_borderless);
}
@ -2073,20 +2178,9 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// EditorValidationPanel.
p_theme->set_stylebox(SceneStringName(panel), "EditorValidationPanel", p_config.tree_panel_style);
// ControlEditor.
{
p_theme->set_type_variation("ControlEditorPopupPanel", "PopupPanel");
Ref<StyleBoxFlat> control_editor_popup_style = p_config.popup_style->duplicate();
control_editor_popup_style->set_shadow_size(0);
control_editor_popup_style->set_content_margin(SIDE_LEFT, p_config.base_margin * EDSCALE);
control_editor_popup_style->set_content_margin(SIDE_TOP, p_config.base_margin * EDSCALE);
control_editor_popup_style->set_content_margin(SIDE_RIGHT, p_config.base_margin * EDSCALE);
control_editor_popup_style->set_content_margin(SIDE_BOTTOM, p_config.base_margin * EDSCALE);
control_editor_popup_style->set_border_width_all(0);
p_theme->set_stylebox(SceneStringName(panel), "ControlEditorPopupPanel", control_editor_popup_style);
}
// Secondary trees and item lists.
p_theme->set_type_variation("TreeSecondary", "Tree");
p_theme->set_type_variation("ItemListSecondary", "ItemList");
}
// Editor inspector.
@ -2233,6 +2327,71 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_stylebox("DictionaryAddItem0", EditorStringName(EditorStyles), style_dictionary_add_item);
}
// Animation Editor.
{
// Timeline general.
p_theme->set_constant("timeline_v_separation", "AnimationTrackEditor", 0);
p_theme->set_constant("track_v_separation", "AnimationTrackEditor", 0);
// AnimationTimelineEdit.
// "primary" is used for integer timeline values, "secondary" for decimals.
Ref<StyleBoxFlat> style_time_unavailable = make_flat_stylebox(p_config.dark_color_2, 0, 0, 0, 0, 0);
Ref<StyleBoxFlat> style_time_available = make_flat_stylebox(p_config.font_color * Color(1, 1, 1, 0.2), 0, 0, 0, 0, 0);
p_theme->set_stylebox("time_unavailable", "AnimationTimelineEdit", style_time_unavailable);
p_theme->set_stylebox("time_available", "AnimationTimelineEdit", style_time_available);
p_theme->set_color("v_line_primary_color", "AnimationTimelineEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_color("v_line_secondary_color", "AnimationTimelineEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_color("h_line_color", "AnimationTimelineEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_color("font_primary_color", "AnimationTimelineEdit", p_config.font_color);
p_theme->set_color("font_secondary_color", "AnimationTimelineEdit", p_config.font_color * Color(1, 1, 1, 0.5));
p_theme->set_constant("v_line_primary_margin", "AnimationTimelineEdit", 0);
p_theme->set_constant("v_line_secondary_margin", "AnimationTimelineEdit", 0);
p_theme->set_constant("v_line_primary_width", "AnimationTimelineEdit", 1 * EDSCALE);
p_theme->set_constant("v_line_secondary_width", "AnimationTimelineEdit", 1 * EDSCALE);
p_theme->set_constant("text_primary_margin", "AnimationTimelineEdit", 3 * EDSCALE);
p_theme->set_constant("text_secondary_margin", "AnimationTimelineEdit", 3 * EDSCALE);
// AnimationTrackEdit.
Ref<StyleBoxFlat> style_animation_track_odd = make_flat_stylebox(Color(0.5, 0.5, 0.5, 0.05), 0, 0, 0, 0, p_config.corner_radius);
Ref<StyleBoxFlat> style_animation_track_hover = make_flat_stylebox(Color(0.5, 0.5, 0.5, 0.1), 0, 0, 0, 0, p_config.corner_radius);
p_theme->set_stylebox("odd", "AnimationTrackEdit", style_animation_track_odd);
p_theme->set_stylebox(SceneStringName(hover), "AnimationTrackEdit", style_animation_track_hover);
p_theme->set_stylebox("focus", "AnimationTrackEdit", p_config.button_style_focus);
p_theme->set_color("h_line_color", "AnimationTrackEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_constant("h_separation", "AnimationTrackEdit", (p_config.increased_margin + 2) * EDSCALE);
p_theme->set_constant("outer_margin", "AnimationTrackEdit", p_config.increased_margin * 6 * EDSCALE);
// AnimationTrackEditGroup.
Ref<StyleBoxFlat> style_animation_track_header = make_flat_stylebox(p_config.dark_color_2 * Color(1, 1, 1, 0.6), p_config.increased_margin * 3, 0, 0, 0, p_config.corner_radius);
p_theme->set_stylebox("header", "AnimationTrackEditGroup", style_animation_track_header);
p_theme->set_color("h_line_color", "AnimationTrackEditGroup", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_color("v_line_color", "AnimationTrackEditGroup", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_constant("h_separation", "AnimationTrackEditGroup", (p_config.increased_margin + 2) * EDSCALE);
p_theme->set_constant("v_separation", "AnimationTrackEditGroup", 0);
// AnimationBezierTrackEdit.
p_theme->set_color("focus_color", "AnimationBezierTrackEdit", p_config.accent_color * Color(1, 1, 1, 0.7));
p_theme->set_color("track_focus_color", "AnimationBezierTrackEdit", p_config.accent_color * Color(1, 1, 1, 0.5));
p_theme->set_color("h_line_color", "AnimationBezierTrackEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_color("v_line_color", "AnimationBezierTrackEdit", p_config.font_color * Color(1, 1, 1, 0.2));
p_theme->set_constant("h_separation", "AnimationBezierTrackEdit", (p_config.increased_margin + 2) * EDSCALE);
p_theme->set_constant("v_separation", "AnimationBezierTrackEdit", p_config.forced_even_separation * EDSCALE);
}
// Editor help.
{
Ref<StyleBoxFlat> style_editor_help = p_config.base_style->duplicate();
@ -2371,6 +2530,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
Ref<StyleBoxFlat> sm_node_playing_style = sm_node_selected_style->duplicate();
sm_node_playing_style->set_border_color(p_config.warning_color);
sm_node_playing_style->set_shadow_color(p_config.warning_color * Color(1, 1, 1, 0.2));
sm_node_playing_style->set_draw_center(false);
p_theme->set_stylebox("node_frame", "GraphStateMachine", sm_node_style);
p_theme->set_stylebox("node_frame_selected", "GraphStateMachine", sm_node_selected_style);
@ -2396,6 +2556,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
p_theme->set_color("transition_icon_disabled_color", "GraphStateMachine", Color(1, 1, 1, 0.2));
p_theme->set_color("highlight_color", "GraphStateMachine", p_config.accent_color);
p_theme->set_color("highlight_disabled_color", "GraphStateMachine", p_config.accent_color * Color(1, 1, 1, 0.6));
p_theme->set_color("focus_color", "GraphStateMachine", p_config.accent_color);
p_theme->set_color("guideline_color", "GraphStateMachine", p_config.font_color * Color(1, 1, 1, 0.3));
p_theme->set_color("playback_color", "GraphStateMachine", p_config.font_color);

View file

@ -135,6 +135,7 @@ class EditorThemeManager {
Ref<StyleBoxFlat> button_style_hover;
Ref<StyleBoxFlat> popup_style;
Ref<StyleBoxFlat> popup_border_style;
Ref<StyleBoxFlat> window_style;
Ref<StyleBoxFlat> dialog_style;
Ref<StyleBoxFlat> panel_container_style;