diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-11-21 00:43:16 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-11-21 00:43:16 +0300 |
commit | ac2e77cac5d4d7e2c41c9190494a06961b13be6d (patch) | |
tree | 8ca2543cc9565734b8f0d591a0b253a530dacf19 /source/blender/editors | |
parent | 06fdd5b95df436d2b9dc158a0e36e8e357f8538d (diff) |
[#24827] Crash when auto-keyframing while playing animation
Reported by André Oliveira
Need to pass valid context to autokeying callback function.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform.c | 18 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 3 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 |
3 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 2c88402352b..63287f86464 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1490,6 +1490,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int { int options = 0; + t->context = C; + /* added initialize, for external calls to set stuff in TransInfo, like undo string */ t->state = TRANS_STARTING; @@ -1723,11 +1725,15 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } } + t->context = NULL; + return 1; } -void transformApply(const bContext *C, TransInfo *t) +void transformApply(bContext *C, TransInfo *t) { + t->context = C; + if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) { selectConstraint(t); @@ -1752,15 +1758,17 @@ void transformApply(const bContext *C, TransInfo *t) //do_screenhandlers(G.curscreen); t->redraw |= TREDRAW_HARD; } + + t->context = NULL; } -void drawTransformApply(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) +void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; if (t->redraw & TREDRAW_SOFT) { t->redraw |= TREDRAW_HARD; - transformApply(C, t); + transformApply((bContext *)C, t); } } @@ -1768,6 +1776,8 @@ int transformEnd(bContext *C, TransInfo *t) { int exit_code = OPERATOR_RUNNING_MODAL; + t->context = C; + if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) { /* handle restoring objects */ @@ -1804,6 +1814,8 @@ int transformEnd(bContext *C, TransInfo *t) viewRedrawForce(C, t); } + t->context = NULL; + return exit_code; } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index de978626b3e..2778aa4df08 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -317,6 +317,7 @@ typedef struct TransInfo { float axis_orig[3]; /* TransCon can change 'axis', store the original value here */ void *view; + struct bContext *context; /* Only valid (non null) during an operator called function. */ struct ScrArea *sa; struct ARegion *ar; struct Scene *scene; @@ -448,7 +449,7 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot); int initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event, int mode); void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); int transformEvent(TransInfo *t, struct wmEvent *event); -void transformApply(const struct bContext *C, TransInfo *t); +void transformApply(struct bContext *C, TransInfo *t); int transformEnd(struct bContext *C, TransInfo *t); void setTransformViewMatrices(TransInfo *t); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 6e71cf30112..02db25fb50b 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -817,7 +817,7 @@ void recalcData(TransInfo *t) // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes? if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) { animrecord_check_state(t->scene, &ob->id, t->animtimer); - autokeyframe_ob_cb_func(NULL, t->scene, (View3D *)t->view, ob, t->mode); + autokeyframe_ob_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode); } /* sets recalc flags fully, instead of flushing existing ones |