Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Improve the look of the asset rating indicator

Michael Alexsanderf8a88578f540
diff --git a/editor/asset_library/asset_library_editor_plugin.cpp b/editor/asset_library/asset_library_editor_plugin.cpp
index 3d4b334926b..0933e95847a 100644
--- a/editor/asset_library/asset_library_editor_plugin.cpp
+++ b/editor/asset_library/asset_library_editor_plugin.cpp
@@ -224,6 +224,8 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
author_license_hbox->add_child(license);
license->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItem::_license_clicked));
+ vb->add_spacer();
+
HBoxContainer *rating_hbox = memnew(HBoxContainer);
rating_hbox->set_mouse_filter(MOUSE_FILTER_IGNORE);
vb->add_child(rating_hbox);
@@ -235,11 +237,12 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
rating_count = memnew(Label);
rating_count->set_mouse_filter(MOUSE_FILTER_STOP);
+ rating_count->set_theme_type_variation("LabelNoMargin");
rating_count->set_tooltip_text(TTRC("Review Score"));
- rating_count->set_accessibility_name(TTRC("Review score"));
+ rating_count->set_accessibility_name(TTRC("Review Score"));
rating_hbox->add_child(rating_count);
- set_accessibility_name(TTRC("Open asset details"));
+ set_accessibility_name(TTRC("Open Asset Details"));
set_custom_minimum_size(Size2(250, 80) * EDSCALE);
set_h_size_flags(SIZE_EXPAND_FILL);
}
@@ -944,7 +947,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
vb->add_child(title_hb);
title = memnew(Label);
title->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
- title->set_theme_type_variation("LabelVMarginless");
+ title->set_theme_type_variation("LabelNoMarginVertical");
title->set_focus_mode(FOCUS_ACCESSIBILITY);
title->set_h_size_flags(Control::SIZE_EXPAND_FILL);
title_hb->add_child(title);
@@ -956,7 +959,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
version = memnew(Label);
version->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
- version->set_theme_type_variation("LabelVMarginless");
+ version->set_theme_type_variation("LabelNoMarginVertical");
vb->add_child(version);
spacer = memnew(Control);
diff --git a/editor/icons/ThumbsUp.svg b/editor/icons/ThumbsUp.svg
index dceb82a5457..5001227098b 100644
--- a/editor/icons/ThumbsUp.svg
+++ b/editor/icons/ThumbsUp.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e9afaf" d="M1 7v8M4 15V7" paint-order="fill markers stroke"/><path fill="#e0e0e0" d="M2 7v7H4V7ZM6 7v7h5c2 0 3-4 3-6C14 7 13 6 11.724183 6H10C10 5 12 1 9 1 8.462842 2.9756415 7 6 6 7Z" paint-order="fill markers stroke"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e9afaf" d="M1 7v8M4 15V7" paint-order="fill markers stroke"/><path fill="#e0e0e0" d="m 14,7 v 7 H 12 V 7 Z m -4,0 v 7 H 5 C 3,14 2,10 2,8 2,7 3,6 4.275817,6 H 6 C 6,5 4,1 7,1 7.537158,2.9756415 9,6 10,7 Z" paint-order="fill markers stroke"/></svg>
diff --git a/editor/themes/theme_classic.cpp b/editor/themes/theme_classic.cpp
index f8b7632b7bb..bbdb5ebb288 100644
--- a/editor/themes/theme_classic.cpp
+++ b/editor/themes/theme_classic.cpp
@@ -1237,11 +1237,16 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
p_theme->set_constant("line_spacing", "Label", 3 * EDSCALE);
p_theme->set_constant("outline_size", "Label", 0);
- // Label with no vertical margins.
+ // Label with different margins.
- p_theme->set_type_variation("LabelVMarginless", "Label");
- Ref<StyleBoxEmpty> v_marginless_style = EditorThemeManager::make_empty_stylebox(p_config.base_empty_style->get_margin(SIDE_LEFT), 0, p_config.base_empty_style->get_margin(SIDE_RIGHT), 0);
- p_theme->set_stylebox(CoreStringName(normal), "LabelVMarginless", v_marginless_style);
+ p_theme->set_type_variation("LabelNoMargin", "Label");
+ p_theme->set_stylebox(CoreStringName(normal), "LabelNoMargin", EditorThemeManager::make_empty_stylebox());
+
+ p_theme->set_type_variation("LabelNoMarginVertical", "Label");
+ Ref<StyleBoxEmpty> no_v_margin_style = p_config.base_empty_style->duplicate();
+ no_v_margin_style->set_content_margin(SIDE_TOP, 0);
+ no_v_margin_style->set_content_margin(SIDE_BOTTOM, 0);
+ p_theme->set_stylebox(CoreStringName(normal), "LabelNoMarginVertical", no_v_margin_style);
}
// SpinBox.
diff --git a/editor/themes/theme_modern.cpp b/editor/themes/theme_modern.cpp
index cc030f77249..4e2569d5fb0 100644
--- a/editor/themes/theme_modern.cpp
+++ b/editor/themes/theme_modern.cpp
@@ -1238,11 +1238,16 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
p_theme->set_constant("line_spacing", "Label", 3 * EDSCALE);
p_theme->set_constant("outline_size", "Label", 0);
- // Label with no vertical margins.
+ // Label with different margins.
- p_theme->set_type_variation("LabelVMarginless", "Label");
- Ref<StyleBoxEmpty> v_marginless_style = EditorThemeManager::make_empty_stylebox(label_style->get_margin(SIDE_LEFT), 0, label_style->get_margin(SIDE_RIGHT), 0);
- p_theme->set_stylebox(CoreStringName(normal), "LabelVMarginless", v_marginless_style);
+ p_theme->set_type_variation("LabelNoMargin", "Label");
+ p_theme->set_stylebox(CoreStringName(normal), "LabelNoMargin", p_config.base_empty_style);
+
+ p_theme->set_type_variation("LabelNoMarginVertical", "Label");
+ Ref<StyleBoxEmpty> no_v_margin_style = label_style->duplicate();
+ no_v_margin_style->set_content_margin(SIDE_TOP, 0);
+ no_v_margin_style->set_content_margin(SIDE_BOTTOM, 0);
+ p_theme->set_stylebox(CoreStringName(normal), "LabelNoMarginVertical", no_v_margin_style);
}
// SpinBox.