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
path: root/source
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2010-10-11 14:40:34 +0400
committerJanne Karhu <jhkarh@gmail.com>2010-10-11 14:40:34 +0400
commite444c777145ccf297bc00f8e4690b78ed4ea85c9 (patch)
tree90632f4afba618011483f3eb9a622339208fe054 /source
parent737bc66f2aee939dc98adb4d6e9610a99c09059a (diff)
Fix for [#20064] Cloth simulation doesn't stop when marker is set back to frame 1 after exiting mesh edit.
* First frame was dropped some times when animation was running because clicking "go to start/end frame" changed the current frame directly. * Now only the animtimer changes the frame and clicking the "go to" queues the next frame for animtimer.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_screen_types.h3
-rw-r--r--source/blender/editors/screen/screen_ops.c40
2 files changed, 35 insertions, 8 deletions
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index c5abd5465d7..18d6a1a48cc 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -38,6 +38,7 @@ typedef struct ScreenAnimData {
short refresh;
short flag; /* flags for playback */
int sfra; /* frame that playback was started from */
+ int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
} ScreenAnimData;
/* for animplayer */
@@ -50,6 +51,8 @@ enum {
ANIMPLAY_FLAG_SYNC = (1<<2),
/* don't drop frames (and ignore SCE_FRAME_DROP flag) */
ANIMPLAY_FLAG_NO_SYNC = (1<<3),
+ /* use nextfra at next timer update */
+ ANIMPLAY_FLAG_USE_NEXT_FRAME,
};
/* ----------------------------------------------------- */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 613c8bc0178..584112ccacd 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1553,15 +1553,32 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
static int frame_jump_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
-
- if (RNA_boolean_get(op->ptr, "end"))
- CFRA= PEFRA;
- else
- CFRA= PSFRA;
-
- sound_seek_scene(C);
+ wmTimer *animtimer= CTX_wm_screen(C)->animtimer;
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ /* Don't change CFRA directly if animtimer is running as this can cause
+ * first/last frame not to be actually shown (bad since for example physics
+ * simulations aren't reset properly).
+ */
+ if(animtimer) {
+ ScreenAnimData *sad = animtimer->customdata;
+
+ sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
+
+ if (RNA_boolean_get(op->ptr, "end"))
+ sad->nextfra= PEFRA;
+ else
+ sad->nextfra= PSFRA;
+ }
+ else {
+ if (RNA_boolean_get(op->ptr, "end"))
+ CFRA= PEFRA;
+ else
+ CFRA= PSFRA;
+
+ sound_seek_scene(C);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ }
return OPERATOR_FINISHED;
}
@@ -2513,6 +2530,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
}
}
}
+
+ /* next frame overriden by user action (pressed jump to first/last frame) */
+ if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
+ scene->r.cfra = sad->nextfra;
+ sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
+ sad->flag |= ANIMPLAY_FLAG_JUMPED;
+ }
if (sad->flag & ANIMPLAY_FLAG_JUMPED)
sound_seek_scene(C);