Add basic fam tree construction
This commit is contained in:
parent
66a57d415a
commit
7593828ca7
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Godot;
|
||||
|
@ -27,7 +28,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 = "TheBlackParade_1_0";
|
||||
Context.Instance.CampaignName = "Endless Rain";
|
||||
|
||||
_folderTree = GetNode<Tree>("%FolderTree");
|
||||
_searchBar = GetNode<LineEdit>("%SearchBar");
|
||||
|
@ -48,13 +49,28 @@ public partial class TextureBrowser : Node
|
|||
private void BuildFolderTree()
|
||||
{
|
||||
_folderTree.Clear();
|
||||
_folderTree.SetColumnTitle(0, "Name");
|
||||
_folderTree.SetColumnTitle(1, "Count");
|
||||
|
||||
// TODO: We need some way to get family names
|
||||
// Maybe PathManager and CampaignResource should be expanded so that we
|
||||
// can get the resource itself and query things
|
||||
var pathManager = Context.Instance.PathManager;
|
||||
var context = Context.Instance;
|
||||
var textureNames = context.PathManager.GetResourceNames(LGS.ResourceType.Texture, context.CampaignName);
|
||||
|
||||
var treeItems = new Dictionary<string, TreeItem>();
|
||||
treeItems.Add("", _folderTree.CreateItem());
|
||||
foreach (var name in textureNames)
|
||||
{
|
||||
var tokens = name.Split('/');
|
||||
var fams = new string[tokens.Length + 1];
|
||||
fams[0] = "";
|
||||
for (var i = 1; i < tokens.Length; i++)
|
||||
{
|
||||
fams[i] = tokens[..i].Join("/");
|
||||
if (!treeItems.ContainsKey(fams[i]))
|
||||
{
|
||||
var item = _folderTree.CreateItem(treeItems[fams[i - 1]]);
|
||||
item.SetText(0, tokens[i - 1]);
|
||||
treeItems.Add(fams[i], item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildTextureList()
|
||||
|
|
|
@ -47,8 +47,7 @@ size_flags_vertical = 3
|
|||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(256, 0)
|
||||
layout_mode = 2
|
||||
columns = 2
|
||||
column_titles_visible = true
|
||||
hide_root = true
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="TabContainer/Textures/VBoxContainer/HSplitContainer"]
|
||||
layout_mode = 2
|
||||
|
@ -76,14 +75,15 @@ tooltip_text = "Sort Mode"
|
|||
icon = ExtResource("3_0k1fm")
|
||||
icon_alignment = 1
|
||||
item_count = 4
|
||||
popup/item_0/text = "Family"
|
||||
popup/item_0/text = "Name"
|
||||
popup/item_0/checkable = 2
|
||||
popup/item_0/id = 1
|
||||
popup/item_1/text = "Name"
|
||||
popup/item_0/checked = true
|
||||
popup/item_1/text = "Family"
|
||||
popup/item_1/checkable = 2
|
||||
popup/item_1/id = 2
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Index"
|
||||
popup/item_2/checkable = 2
|
||||
popup/item_2/id = 2
|
||||
popup/item_2/disabled = true
|
||||
popup/item_3/text = "Count"
|
||||
popup/item_3/checkable = 2
|
||||
|
@ -110,6 +110,7 @@ popup/item_0/id = 1
|
|||
popup/item_1/text = "Show Custom"
|
||||
popup/item_1/checkable = 1
|
||||
popup/item_1/checked = true
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Show Family Name"
|
||||
popup/item_2/checkable = 1
|
||||
popup/item_2/id = 2
|
||||
|
|
Loading…
Reference in New Issue