mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 00:35:23 +08:00
Collisions editing progress
This commit is contained in:
@@ -103,6 +103,10 @@ namespace CodeWalker.Project
|
||||
{
|
||||
bounds[item.CollisionPoly.Owner] = 1;
|
||||
}
|
||||
if (item.CollisionVertex?.Owner != null)
|
||||
{
|
||||
bounds[item.CollisionVertex.Owner] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -763,6 +767,58 @@ namespace CodeWalker.Project
|
||||
}
|
||||
}
|
||||
|
||||
public class CollisionVertexPositionUndoStep : UndoStep
|
||||
{
|
||||
public BoundVertex Vertex { get; set; }
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public CollisionVertexPositionUndoStep(BoundVertex vertex, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
Vertex = vertex;
|
||||
StartPosition = startpos;
|
||||
EndPosition = vertex?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
if (Vertex != null)
|
||||
{
|
||||
Vertex.Position = p;
|
||||
}
|
||||
|
||||
if (Vertex != sel.CollisionVertex) wf.SelectCollisionVertex(Vertex);
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (Vertex?.Owner != null)
|
||||
{
|
||||
wf.UpdateCollisionBoundsGraphics(Vertex.Owner);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Collision Vertex " + (Vertex?.Index.ToString() ?? "") + ": Position";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PathNodePositionUndoStep : UndoStep
|
||||
|
||||
Reference in New Issue
Block a user