Add texture path copy button functionality

This commit is contained in:
Jarrod Doyle 2024-09-08 19:52:31 +01:00
parent fbacfccd13
commit 4b2dfaa5bd
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@ public partial class TextureBrowser : Node
private HFlowContainer _textureList;
private TextureRect _previewTexture;
private LineEdit _texturePath;
private Button _texturePathCopyButton;
private OptionButton _filterOptions;
private LineEdit _fileType;
private LineEdit _resolutionBox;
@ -46,6 +47,7 @@ public partial class TextureBrowser : Node
_textureList = GetNode<HFlowContainer>("%TextureList");
_previewTexture = GetNode<TextureRect>("%PreviewTexture");
_texturePath = GetNode<LineEdit>("%PathBox");
_texturePathCopyButton = GetNode<Button>("%PathCopyButton");
_filterOptions = GetNode<OptionButton>("%FilterOptions");
_fileType = GetNode<LineEdit>("%FileTypeBox");
_resolutionBox = GetNode<LineEdit>("%ResolutionBox");
@ -55,11 +57,17 @@ public partial class TextureBrowser : Node
_sortMenu.GetPopup().IdPressed += ApplySortMode;
_folderTree.ItemSelected += SetActiveFolder;
_filterOptions.ItemSelected += SetPreviewTextureFilter;
_texturePathCopyButton.Pressed += CopyTexturePath;
BuildFolderTree();
BuildTextureList(); // TODO: This should be triggered on folder change
}
private void CopyTexturePath()
{
DisplayServer.ClipboardSet(_texturePath.Text);
}
private void BuildFolderTree()
{
_folderTree.Clear();

View File

@ -268,6 +268,7 @@ size_flags_horizontal = 3
editable = false
[node name="PathCopyButton" type="Button" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
icon = ExtResource("7_2pq2g")
flat = true