Collisions editing progress

This commit is contained in:
dexy
2020-01-07 20:51:53 +11:00
Unverified
parent edba2cfae9
commit 3c60801e84
12 changed files with 1113 additions and 7 deletions
+36
View File
@@ -415,6 +415,10 @@ namespace CodeWalker.Project.Panels
n = boundsnode.Nodes.Add("Edit Polygon");
n.Name = "EditPoly";
n.Tag = b; //this tag should get updated with the selected poly!
n = boundsnode.Nodes.Add("Edit Vertex");
n.Name = "EditVertex";
n.Tag = b; //this tag should get updated with the selected vertex!
}
}
@@ -1186,6 +1190,15 @@ namespace CodeWalker.Project.Panels
polynode.Tag = p;
return polynode;
}
public TreeNode FindCollisionVertexTreeNode(BoundVertex v)
{
if (v == null) return null;
var ybnnode = FindCollisionBoundsTreeNode(v.Owner);
var vertnode = GetChildTreeNode(ybnnode, "EditVertex");
if (vertnode == null) return null;
vertnode.Tag = v;
return vertnode;
}
public TreeNode FindYndTreeNode(YndFile ynd)
{
if (ProjectTreeView.Nodes.Count <= 0) return null;
@@ -1580,6 +1593,29 @@ namespace CodeWalker.Project.Panels
}
}
}
public void TrySelectCollisionVertexTreeNode(BoundVertex vert)
{
TreeNode tnode = FindCollisionVertexTreeNode(vert);
if (tnode == null)
{
tnode = FindCollisionBoundsTreeNode(vert?.Owner);
}
if (tnode == null)
{
tnode = FindYbnTreeNode(vert?.Owner?.GetRootYbn());
}
if (tnode != null)
{
if (ProjectTreeView.SelectedNode == tnode)
{
OnItemSelected?.Invoke(vert);
}
else
{
ProjectTreeView.SelectedNode = tnode;
}
}
}
public void TrySelectPathNodeTreeNode(YndNode node)
{
TreeNode tnode = FindPathNodeTreeNode(node);