Fix T55511: Decorator drag makes many undo steps

Each keyframe made a separate undo step.
This commit is contained in:
Campbell Barton
2018-06-18 08:25:05 +02:00
parent af51ec3214
commit b2f0803b5b
2 changed files with 4 additions and 1 deletions

View File

@@ -326,11 +326,13 @@ void ui_but_anim_paste_driver(bContext *C)
void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy))
{
wmWindowManager *wm = CTX_wm_manager(C);
uiBut *but = arg_but;
but = but->prev;
/* FIXME(campbell), swapping active pointer is weak. */
SWAP(struct uiHandleButtonData *, but->active, but->next->active);
wm->op_undo_depth++;
if (but->flag & UI_BUT_DRIVEN) {
/* pass */
@@ -354,4 +356,5 @@ void ui_but_anim_decorate_cb(bContext *C, void *arg_but, void *UNUSED(arg_dummy)
}
SWAP(struct uiHandleButtonData *, but->active, but->next->active);
wm->op_undo_depth--;
}

View File

@@ -1720,7 +1720,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
block, UI_BTYPE_BUT, 0, ICON_DOT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Animate property"));
UI_but_func_set(but, ui_but_anim_decorate_cb, but, NULL);
but->flag |= UI_BUT_DRAG_LOCK;
but->flag |= UI_BUT_UNDO | UI_BUT_DRAG_LOCK;
}
else {
/* We may show other information here in future, for now use empty space. */