From 56614d3b1d0ddbdd9c248a7656b6b5d9d962b36f Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 8 Sep 2024 19:27:51 +0100 Subject: [PATCH] Set resolution text --- project/code/TMV/UI/TextureBrowser.cs | 4 ++++ project/scenes/asset_browser/asset_browser.tscn | 1 + 2 files changed, 5 insertions(+) diff --git a/project/code/TMV/UI/TextureBrowser.cs b/project/code/TMV/UI/TextureBrowser.cs index f94a4a2..f7437f8 100644 --- a/project/code/TMV/UI/TextureBrowser.cs +++ b/project/code/TMV/UI/TextureBrowser.cs @@ -27,6 +27,7 @@ public partial class TextureBrowser : Node private LineEdit _texturePath; private OptionButton _filterOptions; private LineEdit _fileType; + private LineEdit _resolutionBox; private string _searchFilterPrefix = ""; @@ -46,6 +47,7 @@ public partial class TextureBrowser : Node _texturePath = GetNode("%PathBox"); _filterOptions = GetNode("%FilterOptions"); _fileType = GetNode("%FileTypeBox"); + _resolutionBox = GetNode("%ResolutionBox"); _searchBar.TextChanged += ApplySearchFilter; _sortMenu.GetPopup().IdPressed += ApplySortMode; @@ -130,6 +132,8 @@ public partial class TextureBrowser : Node _previewTexture.Texture = texture; _texturePath.Text = name; _fileType.Text = Path.GetExtension(path).ToUpper(); + var resolution = texture.GetSize(); + _resolutionBox.Text = $"{resolution.X}x{resolution.Y}"; } private void ApplySearchFilter(string filter) diff --git a/project/scenes/asset_browser/asset_browser.tscn b/project/scenes/asset_browser/asset_browser.tscn index a94d201..09021eb 100644 --- a/project/scenes/asset_browser/asset_browser.tscn +++ b/project/scenes/asset_browser/asset_browser.tscn @@ -287,6 +287,7 @@ layout_mode = 2 text = "Resolution" [node name="ResolutionBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"] +unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 editable = false