diff options
author | Pratik Borhade <PratikPB2123> | 2022-04-05 13:53:35 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-05 13:55:10 +0300 |
commit | f87029f7b13142499a37fb311a721d99bb1aecd7 (patch) | |
tree | 446e2cc73f6023fe898f12a31942a35ca1436f2c /source/blender/editors/mesh | |
parent | d00de988c36a6bde9bccdd75cd544085df2d472c (diff) |
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
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 5 |
1 files changed, 5 insertions, 0 deletions
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)) { |