Sort TEXTURES into their own category again, take subfolders into account for texture count

This commit is contained in:
spherallic 2024-06-18 14:30:38 +02:00
parent a832e73a4a
commit d42f335948
2 changed files with 13 additions and 9 deletions

View file

@ -70,8 +70,8 @@ namespace CodeImp.DoomBuilder.Data
//mxd
SetName(name);
this.virtualname = (!string.IsNullOrEmpty(virtualpath) ? virtualpath : "[TEXTURES]") + Path.AltDirectorySeparatorChar + this.name;
this.virtualname = "[TEXTURES]" + Path.AltDirectorySeparatorChar + (!string.IsNullOrEmpty(virtualpath) ? virtualpath + Path.AltDirectorySeparatorChar : "") + this.name;
// We have no destructor
GC.SuppressFinalize(this);
}

View file

@ -341,23 +341,27 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
private void SetItemsCount(TreeNode node)
private int SetItemsCount(TreeNode node)
{
ResourceTextureSet ts = ((TreeNodeData)node.Tag).Set as ResourceTextureSet;
if(ts == null) throw new Exception("Expected ResourceTextureSet, but got null...");
if(node.Parent != null && General.Map.Config.MixTexturesFlats)
int texcount = 0;
foreach (TreeNode child in node.Nodes) texcount += SetItemsCount(child);
if (node.Parent != null && General.Map.Config.MixTexturesFlats)
{
ts.MixTexturesAndFlats();
if(ts.Textures.Count > 0) node.Text += " [" + ts.Textures.Count + "]";
texcount += ts.Textures.Count;
if (texcount > 0) node.Text += " [" + texcount + "]";
return texcount;
}
else
{
int texcount = (browseflats ? ts.Flats.Count : ts.Textures.Count);
texcount = (browseflats ? ts.Flats.Count : ts.Textures.Count);
if(texcount > 0) node.Text += " [" + texcount + "]";
return texcount;
}
foreach(TreeNode child in node.Nodes) SetItemsCount(child);
}
// Selection changed