[Bf-blender-cvs] [eb3f7228ee5] soc-2021-knife-tools: Knife: Fixed undo not working with cut through

Cian Jinks noreply at git.blender.org
Fri Jul 16 23:12:42 CEST 2021


Commit: eb3f7228ee5ff1aae985666b258dd56df319d2b8
Author: Cian Jinks
Date:   Fri Jul 16 21:22:14 2021 +0100
Branches: soc-2021-knife-tools
https://developer.blender.org/rBeb3f7228ee5ff1aae985666b258dd56df319d2b8

Knife: Fixed undo not working with cut through

The number of new cuts recorded each undo frame was set based on linehits.
This broke when cut through was enabled.
Solution was to increment the new cuts count every time #knife_add_single_cut is ran.

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

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 1b24e3eb404..7c6685e0a46 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1684,6 +1684,9 @@ static void knife_add_single_cut(KnifeTool_OpData *kcd,
   if (kfe->basef && !find_ref(&kfe->faces, kfe->basef)) {
     knife_edge_append_face(kcd, kfe, kfe->basef);
   }
+
+  /* Update current undo frame cut count. */
+  kcd->undo->cuts++;
 }
 
 /* Given a list of KnifeLineHits for one face, sorted by l
@@ -2017,7 +2020,6 @@ static void knife_add_cut(KnifeTool_OpData *kcd)
   BLI_ghash_free(facehits, NULL, NULL);
   MEM_freeN(kcd->linehits);
   kcd->linehits = NULL;
-  kcd->undo->cuts = kcd->totlinehit - 1;
   kcd->totlinehit = 0;
 }



More information about the Bf-blender-cvs mailing list