Add texture filter toggle
This commit is contained in:
parent
80f121bfde
commit
d434e2c13f
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
@ -23,6 +24,7 @@ public partial class TextureBrowser : Node
|
|||
private HFlowContainer _textureList;
|
||||
private TextureRect _previewTexture;
|
||||
private LineEdit _texturePath;
|
||||
private OptionButton _filterOptions;
|
||||
|
||||
private string _searchFilterPrefix = "";
|
||||
|
||||
|
@ -30,7 +32,7 @@ public partial class TextureBrowser : Node
|
|||
{
|
||||
// !HACK TEMP
|
||||
Context.Instance.PathManager.Init("/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/");
|
||||
Context.Instance.CampaignName = "Endless Rain";
|
||||
Context.Instance.CampaignName = "TheBlackParade_1_0";
|
||||
|
||||
_folderTree = GetNode<Tree>("%FolderTree");
|
||||
_searchBar = GetNode<LineEdit>("%SearchBar");
|
||||
|
@ -40,10 +42,12 @@ public partial class TextureBrowser : Node
|
|||
_textureList = GetNode<HFlowContainer>("%TextureList");
|
||||
_previewTexture = GetNode<TextureRect>("%PreviewTexture");
|
||||
_texturePath = GetNode<LineEdit>("%PathBox");
|
||||
_filterOptions = GetNode<OptionButton>("%FilterOptions");
|
||||
|
||||
_searchBar.TextChanged += ApplySearchFilter;
|
||||
_sortMenu.GetPopup().IdPressed += ApplySortMode;
|
||||
_folderTree.ItemSelected += SetActiveFolder;
|
||||
_filterOptions.ItemSelected += SetPreviewTextureFilter;
|
||||
|
||||
BuildFolderTree();
|
||||
BuildTextureList(); // TODO: This should be triggered on folder change
|
||||
|
@ -166,4 +170,15 @@ public partial class TextureBrowser : Node
|
|||
_searchFilterPrefix = Regex.Escape(selectedFolder).Replace("/", "\\/");
|
||||
ApplySearchFilter(_searchBar.Text);
|
||||
}
|
||||
|
||||
private void SetPreviewTextureFilter(long idx)
|
||||
{
|
||||
var filterMode = idx switch
|
||||
{
|
||||
0 => CanvasItem.TextureFilterEnum.LinearWithMipmaps,
|
||||
1 => CanvasItem.TextureFilterEnum.NearestWithMipmaps,
|
||||
_ => throw new InvalidOperationException(),
|
||||
};
|
||||
_previewTexture.TextureFilter = filterMode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ layout_mode = 2
|
|||
text = "Texture Filter"
|
||||
|
||||
[node name="FilterOptions" type="OptionButton" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
|
|
Loading…
Reference in New Issue