WM: don't set repeat flag w/ interactive repeat

This allows operators to distinguish between redo and executing
repeat last operator, needed for T60777 fix.
This commit is contained in:
Campbell Barton 2019-01-25 11:29:41 +11:00
parent b5a2dc16fc
commit e63c360bcd
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by issue #60777, grid fill bug on repeat last operation
3 changed files with 13 additions and 6 deletions

View File

@ -3359,7 +3359,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
if (lastop) {
WM_operator_free_all_after(wm, lastop);
WM_operator_repeat(C, lastop);
WM_operator_repeat_interactive(C, lastop);
}
return OPERATOR_CANCELLED;

View File

@ -322,6 +322,7 @@ int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_call_notest(struct bContext *C, struct wmOperator *op);
int WM_operator_repeat (struct bContext *C, struct wmOperator *op);
int WM_operator_repeat_interactive(struct bContext *C, struct wmOperator *op);
bool WM_operator_repeat_check(const struct bContext *C, struct wmOperator *op);
bool WM_operator_is_repeat(const struct bContext *C, const struct wmOperator *op);
int WM_operator_name_call_ptr(struct bContext *C, struct wmOperatorType *ot, short context, struct PointerRNA *properties);

View File

@ -940,7 +940,9 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
}
/* if repeat is true, it doesn't register again, nor does it free */
static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, const bool store)
static int wm_operator_exec(
bContext *C, wmOperator *op,
const bool repeat, const bool use_repeat_op_flag, const bool store)
{
wmWindowManager *wm = CTX_wm_manager(C);
int retval = OPERATOR_CANCELLED;
@ -958,12 +960,12 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons
wm->op_undo_depth++;
}
if (repeat) {
if (repeat && use_repeat_op_flag) {
op->flag |= OP_IS_REPEAT;
}
retval = op->type->exec(C, op);
OPERATOR_RETVAL_CHECK(retval);
if (repeat) {
if (repeat && use_repeat_op_flag) {
op->flag &= ~OP_IS_REPEAT;
}
@ -1015,7 +1017,7 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
int WM_operator_call_ex(bContext *C, wmOperator *op,
const bool store)
{
return wm_operator_exec(C, op, false, store);
return wm_operator_exec(C, op, false, false, store);
}
int WM_operator_call(bContext *C, wmOperator *op)
@ -1038,7 +1040,11 @@ int WM_operator_call_notest(bContext *C, wmOperator *op)
*/
int WM_operator_repeat(bContext *C, wmOperator *op)
{
return wm_operator_exec(C, op, true, true);
return wm_operator_exec(C, op, true, true, true);
}
int WM_operator_repeat_interactive(bContext *C, wmOperator *op)
{
return wm_operator_exec(C, op, true, false, true);
}
/**
* \return true if #WM_operator_repeat can run