Set File Type text

This commit is contained in:
Jarrod Doyle 2024-09-08 19:24:21 +01:00
parent d434e2c13f
commit 0a71be4731
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Godot;
@ -25,6 +26,7 @@ public partial class TextureBrowser : Node
private TextureRect _previewTexture;
private LineEdit _texturePath;
private OptionButton _filterOptions;
private LineEdit _fileType;
private string _searchFilterPrefix = "";
@ -43,6 +45,7 @@ public partial class TextureBrowser : Node
_previewTexture = GetNode<TextureRect>("%PreviewTexture");
_texturePath = GetNode<LineEdit>("%PathBox");
_filterOptions = GetNode<OptionButton>("%FilterOptions");
_fileType = GetNode<LineEdit>("%FileTypeBox");
_searchBar.TextChanged += ApplySearchFilter;
_sortMenu.GetPopup().IdPressed += ApplySortMode;
@ -114,7 +117,7 @@ public partial class TextureBrowser : Node
mouseEvent.Pressed &&
mouseEvent.ButtonIndex == MouseButton.Left)
{
SetPreviewTexture(name, texture);
SetPreviewTexture(name, texture, path);
}
};
@ -122,10 +125,11 @@ public partial class TextureBrowser : Node
}
}
private void SetPreviewTexture(string name, Texture2D texture)
private void SetPreviewTexture(string name, Texture2D texture, string path)
{
_previewTexture.Texture = texture;
_texturePath.Text = name;
_fileType.Text = Path.GetExtension(path).ToUpper();
}
private void ApplySearchFilter(string filter)

View File

@ -277,6 +277,7 @@ layout_mode = 2
text = "File Type"
[node name="FileTypeBox" 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