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
This commit is contained in:
Pratik Borhade 2022-04-05 20:53:35 +10:00 committed by Campbell Barton
parent d00de988c3
commit f87029f7b1
Notes: blender-bot 2023-02-14 07:25:51 +01:00
Referenced by commit 067f0d40ae, Fix knife tool use-after free on completion
Referenced by issue #96424, Knife tool creates an undo step even there is no cut over object
1 changed files with 5 additions and 0 deletions

View File

@ -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)) {