[Bf-blender-cvs] [f87029f7b13] master: Fix T96424: Don't register undo step for empty knife cut

Pratik Borhade noreply at git.blender.org
Tue Apr 5 12:55:24 CEST 2022


Commit: f87029f7b13142499a37fb311a721d99bb1aecd7
Author: Pratik Borhade
Date:   Tue Apr 5 20:53:35 2022 +1000
Branches: master
https://developer.blender.org/rBf87029f7b13142499a37fb311a721d99bb1aecd7

Fix T96424: Don't register undo step for empty knife cut

Prevents undo push when no cut has been made.

Reviewed By: campbellbarton

Ref D14329

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

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 64d10f7e2af..73716f6edba 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -4399,6 +4399,11 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
         knifetool_exit(op);
         ED_workspace_status_text(C, NULL);
 
+        /* Exit early to prevent undo push for empty cuts. */
+        if (kcd->totkvert == 0) {
+          return OPERATOR_CANCELLED;
+        }
+
         return OPERATOR_FINISHED;
       case KNF_MODAL_UNDO:
         if (BLI_stack_is_empty(kcd->undostack)) {



More information about the Bf-blender-cvs mailing list