diff --git a/source/creator/actions/mesh.d b/source/creator/actions/mesh.d index 98b9be6b0..e34b0a7df 100644 --- a/source/creator/actions/mesh.d +++ b/source/creator/actions/mesh.d @@ -75,14 +75,16 @@ abstract class MeshAction : LazyBoundAction { class MeshAddAction : MeshAction { MeshVertex*[] vertices; + MeshVertex*[][4] axisVertices; this(string name, IncMeshEditorOne editor, IncMesh mesh, void delegate() update = null) { super(name, editor, mesh, update); } - void addVertex(MeshVertex* vertex) { + void addVertex(MeshVertex* vertex, int axis = 0) { vertices ~= vertex; mesh.vertices ~= vertex; + axisVertices[axis] ~= vertex; dirty = true; } @@ -96,6 +98,9 @@ class MeshAddAction : MeshAction { override void clear() { vertices.length = 0; + foreach (v; axisVertices) { + v.length = 0; + } super.clear(); } diff --git a/source/creator/viewport/common/mesheditor/tools/point.d b/source/creator/viewport/common/mesheditor/tools/point.d index e4769868e..89463cdfd 100644 --- a/source/creator/viewport/common/mesheditor/tools/point.d +++ b/source/creator/viewport/common/mesheditor/tools/point.d @@ -148,7 +148,7 @@ class PointTool : NodeSelect { } else { impl.foreachMirror((uint axis) { vertex = new MeshVertex(impl.mirror(axis, impl.mousePos)); - action.addVertex(vertex); + action.addVertex(vertex, axis); }); } impl.refreshMesh(); @@ -169,7 +169,7 @@ class PointTool : NodeSelect { auto lastAddAction = incActionFindLast!MeshAddAction(3); if (lastAddAction is null || lastAddAction.vertices.length == 0) return; - auto prevVertexIdx = impl.getVertexFromPoint(lastAddAction.vertices[$ - 1].position); + auto prevVertexIdx = impl.getVertexFromPoint(lastAddAction.axisVertices[0][$ - 1].position); auto prevVertex = impl.getVerticesByIndex([prevVertexIdx])[0]; if (prevVertex == null) return; auto action = new MeshConnectAction(impl.getTarget().name, impl, mesh);