Fix T71434: Sculpt lags changing brush size

Add a check to wm.radial_control so undo steps are only added
to properties that have undo enabled (as is done with number buttons).
This commit is contained in:
Campbell Barton 2019-11-14 00:37:51 +11:00
parent e527544b76
commit c7b7722254
Notes: blender-bot 2023-02-14 03:31:57 +01:00
Referenced by issue #71434, Sculpt Performance Regression in 2.81
1 changed files with 13 additions and 2 deletions

View File

@ -2654,7 +2654,8 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
{
RadialControl *rc = op->customdata;
float new_value, dist = 0.0f, zoom[2];
float delta[2], ret = OPERATOR_RUNNING_MODAL;
float delta[2];
int ret = OPERATOR_RUNNING_MODAL;
bool snap;
float angle_precision = 0.0f;
const bool has_numInput = hasNumInput(&rc->num_input);
@ -2856,6 +2857,16 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
ED_region_tag_redraw(CTX_wm_region(C));
radial_control_update_header(op, C);
if (ret & OPERATOR_FINISHED) {
wmWindowManager *wm = CTX_wm_manager(C);
if (wm->op_undo_depth == 0) {
ID *id = rc->ptr.owner_id;
if (ED_undo_is_legacy_compatible_for_property(C, id)) {
ED_undo_push(C, op->type->name);
}
}
}
if (ret != OPERATOR_RUNNING_MODAL) {
radial_control_cancel(C, op);
}
@ -2873,7 +2884,7 @@ static void WM_OT_radial_control(wmOperatorType *ot)
ot->modal = radial_control_modal;
ot->cancel = radial_control_cancel;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
ot->flag = OPTYPE_REGISTER | OPTYPE_BLOCKING;
/* all paths relative to the context */
PropertyRNA *prop;