Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-02 16:18:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-02 16:18:10 +0300
commit89fdd8890633700f559039998f8d95c7a5f97df4 (patch)
treea77306882df479d5d2d89f0f9d3529394b4fbe01 /source/blender/editors/curve/editcurve_undo.c
parent57bbd478a58a944a8f3146af25cfe34ee055fc86 (diff)
parent4ffa05c30b10eb8a07dd0a9b43466f6d11bc1364 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/curve/editcurve_undo.c')
-rw-r--r--source/blender/editors/curve/editcurve_undo.c17
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 5775835e5ff..4eb2abaefad 100644
--- a/source/blender/editors/curve/editcurve_undo.c
+++ b/source/blender/editors/curve/editcurve_undo.c
@@ -61,10 +61,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);
@@ -103,10 +109,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);
@@ -150,6 +157,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)
@@ -197,7 +206,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;
}
@@ -210,7 +219,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);
DEG_id_tag_update(&obedit->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
}