Fix: Don't create undo step for empty box select in VSE

In `gesture_box_apply`, check if `exec` function returns
`OPERATOR_CANCELLED` and return 0 to prevent any undo items from being
created.

Pull Request #105065
This commit is contained in:
Lucas Tadeu
2023-03-01 18:47:46 +01:00
committed by Richard Antalik
parent d449539cd2
commit 515cb14056
2 changed files with 13 additions and 2 deletions

View File

@@ -1641,8 +1641,10 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
const bool handles = RNA_boolean_get(op->ptr, "include_handles");
const bool select = (sel_op != SEL_OP_SUB);
bool changed = false;
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
ED_sequencer_deselect_all(scene);
changed |= ED_sequencer_deselect_all(scene);
}
rctf rectf;
@@ -1680,6 +1682,8 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
}
seq->flag &= ~SEQ_RIGHTSEL;
}
changed = true;
}
/* Left handle. */
if (rectf.xmin < (SEQ_time_left_handle_frame_get(scene, seq) + handsize)) {
@@ -1694,16 +1698,23 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
seq->flag &= ~SEQ_LEFTSEL;
}
}
changed = true;
}
/* Regular box selection. */
else {
SET_FLAG_FROM_TEST(seq->flag, select, SELECT);
seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
changed = true;
}
}
}
if (!changed) {
return OPERATOR_CANCELLED;
}
sequencer_select_do_updates(C, scene);
return OPERATOR_FINISHED;

View File

@@ -157,7 +157,7 @@ static bool gesture_box_apply(bContext *C, wmOperator *op)
retval = op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
return 1;
return (retval & OPERATOR_FINISHED) ? 1 : 0;
}
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)