From c1cdcad96a97e6ba989da2802fd7cdef7f789371 Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 1 Jan 2025 15:07:16 +0100 Subject: [PATCH] Fix ProjectTag button variation --- editor/project_manager/project_tag.cpp | 2 +- editor/themes/editor_theme_manager.cpp | 8 ++++---- scene/resources/theme.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/editor/project_manager/project_tag.cpp b/editor/project_manager/project_tag.cpp index e66969333c2d..fe4e5999ffb2 100644 --- a/editor/project_manager/project_tag.cpp +++ b/editor/project_manager/project_tag.cpp @@ -70,5 +70,5 @@ ProjectTag::ProjectTag(const String &p_text, bool p_display_close) { button->set_text(p_text.capitalize()); button->set_focus_mode(FOCUS_NONE); button->set_icon_alignment(HORIZONTAL_ALIGNMENT_RIGHT); - button->set_theme_type_variation(SNAME("ProjectTag")); + button->set_theme_type_variation(SNAME("ProjectTagButton")); } diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index cfe9f2724f29..900810c4b78f 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -1788,7 +1788,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref &p_theme // ProjectTag. { - p_theme->set_type_variation("ProjectTag", "Button"); + p_theme->set_type_variation("ProjectTagButton", "Button"); Ref 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)); @@ -1796,21 +1796,21 @@ void EditorThemeManager::_populate_editor_styles(const Ref &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(SceneStringName(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); } } diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index b4f0f1834d6f..9efb12fa11ea 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -1112,8 +1112,8 @@ void Theme::get_theme_item_type_list(DataType p_data_type, List *p_l void Theme::set_type_variation(const StringName &p_theme_type, const StringName &p_base_type) { ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type)); ERR_FAIL_COND_MSG(!is_valid_type_name(p_base_type), vformat("Invalid type name: '%s'", p_base_type)); - ERR_FAIL_COND_MSG(p_theme_type == StringName(), "An empty theme type cannot be marked as a variation of another type."); - ERR_FAIL_COND_MSG(ClassDB::class_exists(p_theme_type), "A type associated with a built-in class cannot be marked as a variation of another type."); + ERR_FAIL_COND_MSG(p_theme_type == StringName(), vformat("An empty theme type cannot be marked as a variation of another type (\"%s\").", p_base_type)); + ERR_FAIL_COND_MSG(ClassDB::class_exists(p_theme_type), vformat("A type associated with a built-in class cannot be marked as a variation of another type (variation: \"%s\", base: \"%s\").", p_theme_type, p_base_type)); ERR_FAIL_COND_MSG(p_base_type == StringName(), "An empty theme type cannot be the base type of a variation. Use clear_type_variation() instead if you want to unmark '" + String(p_theme_type) + "' as a variation."); if (variation_map.has(p_theme_type)) {