[Bf-blender-cvs] [1996456ae2e] soc-2021-knife-tools: Knife: Fixed undo deleting last vertex every time

Cian Jinks noreply at git.blender.org
Sun Jul 11 20:27:09 CEST 2021


Commit: 1996456ae2efc45fba2163d442ea15a9e888f703
Author: Cian Jinks
Date:   Sun Jul 11 19:26:24 2021 +0100
Branches: soc-2021-knife-tools
https://developer.blender.org/rB1996456ae2efc45fba2163d442ea15a9e888f703

Knife: Fixed undo deleting last vertex every time

Undo was deleting the first vertex of the last cut segment every time.
Now it only deletes it if the vertex has no other edges touching it.

===================================================================

M	source/blender/editors/mesh/editmesh_knife.c

===================================================================

diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 6ac5b34f2da..1b24e3eb404 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -3368,8 +3368,17 @@ static void knifetool_undo(KnifeTool_OpData *kcd)
     }
 
     if (lastkfe) {
-      /* If the last vertex is touching any other cut edges don't remove it. */
+      /* If the first vertex is touching any other cut edges don't remove it. */
       Ref *ref;
+      for (ref = v1->edges.first; ref; ref = ref->next) {
+        kfe = ref->ref;
+        if (kfe->is_cut && !kfe->is_invalid) {
+          v1->is_invalid = false;
+          break;
+        }
+      }
+
+      /* If the second vertex is touching any other cut edges don't remove it. */
       for (ref = v2->edges.first; ref; ref = ref->next) {
         kfe = ref->ref;
         if (kfe->is_cut && !kfe->is_invalid) {
@@ -3377,6 +3386,7 @@ static void knifetool_undo(KnifeTool_OpData *kcd)
           break;
         }
       }
+
       if (kcd->mode == MODE_DRAGGING) {
         /* Restore kcd->prev. */
         kcd->prev = undo->pos;



More information about the Bf-blender-cvs mailing list