Skip to content

armgit / godot

Public Imported from GitHub
0

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

Improve version label visual in the asset dialog

Michael Alexsandera458840a1c94
diff --git a/editor/asset_library/asset_library_editor_plugin.cpp b/editor/asset_library/asset_library_editor_plugin.cpp
index 4addbfb06c0..a1520488096 100644
--- a/editor/asset_library/asset_library_editor_plugin.cpp
+++ b/editor/asset_library/asset_library_editor_plugin.cpp
@@ -349,6 +349,14 @@ void EditorAssetLibraryItemDescription::_notification(int p_what) {
next_preview->set_button_icon(get_editor_theme_icon(SNAME("Forward")));
previews_bg->add_theme_style_override(SceneStringName(panel), previews->get_theme_stylebox(CoreStringName(normal), SNAME("TextEdit")));
zoom_button->set_button_icon(get_editor_theme_icon(SNAME("DistractionFree")));
+
+ Ref<StyleBox> sb = get_theme_stylebox(CoreStringName(normal), SNAME("OptionButton"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("OptionButton"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("OptionButton"));
+
+ int height = sb->get_minimum_size().height;
+ height += font->get_height(font_size);
+ version->set_custom_minimum_size(Size2(0, height));
} break;
case NOTIFICATION_READY: {
@@ -615,9 +623,11 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
contents->add_child(version_label);
version = memnew(Label);
+ version->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
version->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
version->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
version->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ version->set_theme_type_variation("LabelNoMargin");
contents->add_child(version);
version_list = memnew(OptionButton);