Set File Type text
This commit is contained in:
parent
d434e2c13f
commit
0a71be4731
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
@ -25,6 +26,7 @@ public partial class TextureBrowser : Node
|
||||||
private TextureRect _previewTexture;
|
private TextureRect _previewTexture;
|
||||||
private LineEdit _texturePath;
|
private LineEdit _texturePath;
|
||||||
private OptionButton _filterOptions;
|
private OptionButton _filterOptions;
|
||||||
|
private LineEdit _fileType;
|
||||||
|
|
||||||
private string _searchFilterPrefix = "";
|
private string _searchFilterPrefix = "";
|
||||||
|
|
||||||
|
@ -43,6 +45,7 @@ public partial class TextureBrowser : Node
|
||||||
_previewTexture = GetNode<TextureRect>("%PreviewTexture");
|
_previewTexture = GetNode<TextureRect>("%PreviewTexture");
|
||||||
_texturePath = GetNode<LineEdit>("%PathBox");
|
_texturePath = GetNode<LineEdit>("%PathBox");
|
||||||
_filterOptions = GetNode<OptionButton>("%FilterOptions");
|
_filterOptions = GetNode<OptionButton>("%FilterOptions");
|
||||||
|
_fileType = GetNode<LineEdit>("%FileTypeBox");
|
||||||
|
|
||||||
_searchBar.TextChanged += ApplySearchFilter;
|
_searchBar.TextChanged += ApplySearchFilter;
|
||||||
_sortMenu.GetPopup().IdPressed += ApplySortMode;
|
_sortMenu.GetPopup().IdPressed += ApplySortMode;
|
||||||
|
@ -114,7 +117,7 @@ public partial class TextureBrowser : Node
|
||||||
mouseEvent.Pressed &&
|
mouseEvent.Pressed &&
|
||||||
mouseEvent.ButtonIndex == MouseButton.Left)
|
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;
|
_previewTexture.Texture = texture;
|
||||||
_texturePath.Text = name;
|
_texturePath.Text = name;
|
||||||
|
_fileType.Text = Path.GetExtension(path).ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplySearchFilter(string filter)
|
private void ApplySearchFilter(string filter)
|
||||||
|
|
|
@ -277,6 +277,7 @@ layout_mode = 2
|
||||||
text = "File Type"
|
text = "File Type"
|
||||||
|
|
||||||
[node name="FileTypeBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
|
[node name="FileTypeBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
editable = false
|
editable = false
|
||||||
|
|
Loading…
Reference in New Issue