Allow filtering by action/type number for linedef actions and things

Also remove number prefixes from linedef actions to reduce clutter
This commit is contained in:
spherallic 2024-04-17 13:03:27 +02:00
parent 768ea8fbad
commit 18b984c455
2 changed files with 37 additions and 3 deletions

View file

@ -471,8 +471,22 @@ namespace CodeImp.DoomBuilder.Controls
// Then add nodes, which titles contain given text
foreach(TreeNode node in nodes)
{
if(!added.Contains(node.Text) && node.Text.ToUpperInvariant().Contains(match))
if (!added.Contains(node.Text) && node.Text.ToUpperInvariant().Contains(match))
{
typelist.Nodes.Add(node);
added.Add(node.Text);
}
}
// Then if the filter is a number, add nodes whose thing number starts with that number
if (int.TryParse(tbFilter.Text.Trim(), out int number))
{
foreach (TreeNode node in nodes)
if (!added.Contains(node.Text) && (node.Tag as ThingTypeInfo).Index.ToString().StartsWith(number.ToString()))
{
typelist.Nodes.Add(node);
added.Add(node.Text);
}
}
doupdatenode = true;

View file

@ -303,11 +303,31 @@ namespace CodeImp.DoomBuilder.Windows
// Then add nodes, which titles contain given text
foreach(TreeNode n in allNodes)
{
foreach(TreeNode cn in n.Nodes)
foreach (TreeNode cn in n.Nodes)
{
LinedefActionInfo ai = cn.Tag as LinedefActionInfo;
if(ai != null && !added.Contains(ai.Title) && ai.Title.ToUpperInvariant().Contains(text))
if (ai != null && !added.Contains(ai.Title) && ai.Title.ToUpperInvariant().Contains(text))
{
filterednodes.Add(cn);
added.Add(ai.Title);
}
}
}
// Then if the filter is a number, add nodes whose action number starts with that number
if (int.TryParse(tbFilter.Text.Trim(), out int number))
{
foreach (TreeNode n in allNodes)
{
foreach (TreeNode cn in n.Nodes)
{
LinedefActionInfo ai = cn.Tag as LinedefActionInfo;
if (ai != null && !added.Contains(ai.Title) && ai.Index.ToString().StartsWith(number.ToString()))
{
filterednodes.Add(cn);
added.Add(ai.Title);
}
}
}
}