diff options
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editcurve_undo.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c index 1bc2d6219b9..4ced6ce506c 100644 --- a/source/blender/editors/curve/editcurve_undo.c +++ b/source/blender/editors/curve/editcurve_undo.c @@ -60,10 +60,16 @@ typedef struct { ListBase fcurves, drivers; int actnu; int flag; + + /* Stored in the object, needed since users may change the active key while in edit-mode. */ + struct { + short shapenr; + } obedit; + size_t undo_size; } UndoCurve; -static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu) +static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu, short *r_shapenr) { ListBase *undobase = &ucu->nubase; ListBase *editbase = BKE_curve_editNurbs_get(cu); @@ -102,10 +108,11 @@ static void undocurve_to_editcurve(UndoCurve *ucu, Curve *cu) cu->actvert = ucu->actvert; cu->actnu = ucu->actnu; cu->flag = ucu->flag; + *r_shapenr = ucu->obedit.shapenr; ED_curve_updateAnimPaths(cu); } -static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu) +static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shapenr) { BLI_assert(BLI_array_is_zeroed(ucu, 1)); ListBase *nubase = BKE_curve_editNurbs_get(cu); @@ -149,6 +156,8 @@ static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu) ucu->actvert = cu->actvert; ucu->actnu = cu->actnu; ucu->flag = cu->flag; + + ucu->obedit.shapenr = shapenr; } static void undocurve_free_data(UndoCurve *uc) @@ -196,7 +205,7 @@ static bool curve_undosys_step_encode(struct bContext *C, UndoStep *us_p) { CurveUndoStep *us = (CurveUndoStep *)us_p; us->obedit_ref.ptr = editcurve_object_from_context(C); - undocurve_from_editcurve(&us->data, us->obedit_ref.ptr->data); + undocurve_from_editcurve(&us->data, us->obedit_ref.ptr->data, us->obedit_ref.ptr->shapenr); us->step.data_size = us->data.undo_size; return true; } @@ -209,7 +218,7 @@ static void curve_undosys_step_decode(struct bContext *C, UndoStep *us_p, int UN CurveUndoStep *us = (CurveUndoStep *)us_p; Object *obedit = us->obedit_ref.ptr; - undocurve_to_editcurve(&us->data, obedit->data); + undocurve_to_editcurve(&us->data, obedit->data, &obedit->shapenr); DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL); } |