[Bf-blender-cvs] [dc25505] gooseberry: Make Hjalti happier commit.
Antony Riakiotakis
noreply at git.blender.org
Thu Apr 30 16:48:31 CEST 2015
Commit: dc25505aeada5ef9f964f11834f8bd37ec6cb8a7
Author: Antony Riakiotakis
Date: Thu Apr 30 16:48:10 2015 +0200
Branches: gooseberry
https://developer.blender.org/rBdc25505aeada5ef9f964f11834f8bd37ec6cb8a7
Make Hjalti happier commit.
Treat scrubbing as animation. This takes care of too many updates from
our armature system.
===================================================================
M source/blender/blenkernel/intern/sound.c
M source/blender/editors/animation/anim_ops.c
M source/blender/editors/screen/screen_ops.c
M source/blender/makesdna/DNA_screen_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 6a831d2..fb5d87d 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -615,13 +615,13 @@ void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
animation_playing = 0;
for (screen = bmain->screen.first; screen; screen = screen->id.next) {
- if (screen->animtimer) {
+ if (screen->animtimer || screen->scrubbing) {
animation_playing = 1;
break;
}
}
- if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
+ if ((scene->audio.flag & AUDIO_SCRUB) && !animation_playing) {
if (scene->audio.flag & AUDIO_SYNC) {
AUD_seek(scene->sound_scene_handle, cur_time);
AUD_seekSequencer(scene->sound_scene_handle, cur_time);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index efcc707..be992ba 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -121,10 +121,8 @@ static void change_frame_apply(bContext *C, wmOperator *op, bool final)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *window;
ScrArea *sa;
- /* since we follow drawflags, we can't send notifier but tag regions ourselves */
- /* only do audio if scrubbing */
- if (scene->audio.flag & AUDIO_SCRUB)
- BKE_sound_seek_scene(bmain, scene);
+
+ BKE_sound_seek_scene(bmain, scene);
ED_update_for_newframe(bmain, scene, 1);
@@ -218,6 +216,9 @@ static void change_frame_seq_preview_end(bContext *C, wmOperator *op)
WM_event_remove_timer(wm, win, data->timer);
MEM_freeN(data);
op->customdata = NULL;
+ /* add here too to take care of cancelling */
+ if (win->screen)
+ win->screen->scrubbing = false;
}
}
@@ -241,6 +242,9 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
op->customdata = data;
change_frame_seq_preview_begin(C, event);
+ if (win->screen)
+ win->screen->scrubbing = true;
+
change_frame_apply(C, op, false);
/* add temp handler */
@@ -260,12 +264,15 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ChangeFrameData *data = op->customdata;
+ wmWindow *win = CTX_wm_window(C);
int ret = OPERATOR_RUNNING_MODAL;
/* execute the events */
switch (event->type) {
case ESCKEY:
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
+ if (win->screen)
+ win->screen->scrubbing = false;
BKE_sound_seek_scene(bmain, scene);
ret = OPERATOR_FINISHED;
break;
@@ -292,8 +299,11 @@ static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
* the modal op) doesn't work for some reason
*/
if (event->val == KM_RELEASE) {
- WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
- BKE_sound_seek_scene(bmain, scene);
+ if (win->screen)
+ win->screen->scrubbing = false;
+ data->frame = frame_from_event(C, event);
+ RNA_int_set(op->ptr, "frame", data->frame);
+ change_frame_apply(C, op, true);
ret = OPERATOR_FINISHED;
}
break;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 9a36e82..89098f3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3517,7 +3517,7 @@ bScreen *ED_screen_animation_playing(const wmWindowManager *wm)
wmWindow *win;
for (win = wm->windows.first; win; win = win->next) {
- if (win->screen->animtimer) {
+ if (win->screen->animtimer || win->screen->scrubbing) {
return win->screen;
}
}
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 9b35925..5a707ef 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -69,7 +69,8 @@ typedef struct bScreen {
char do_draw_drag; /* notifier for dragging draw. */
char swap; /* indicator to survive swap-exchange systems */
char skip_handling; /* set to delay screen handling after switching back from maximized area */
- char pad[7];
+ char scrubbing; /* set while scrubbing to skip some updates done while animating */
+ char pad[6];
short mainwin; /* screensize subwindow, for screenedges and global menus */
short subwinactive; /* active subwindow */
More information about the Bf-blender-cvs
mailing list