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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-06 18:16:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-06 18:16:23 +0300
commit63f3e1ac7c8a0e65fa2a347c7769cd8c07c0dc78 (patch)
tree4da8abeb9a1b5a3c2182b60326e5d775a48df560 /source/blender/windowmanager/intern/wm_playanim.c
parent49af17beb8d2aca856ff8e23bac99841d1b45f5b (diff)
parent22150eb4094ca4caf8c231ab137dcee9dc445bca (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/windowmanager/intern/wm_playanim.c')
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 8c062be2a00..ec9db1dd98e 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -139,6 +139,9 @@ typedef struct PlayState {
/* restarts player for file drop */
char dropped_file[FILE_MAX];
+
+ bool need_frame_update;
+ int frame_cursor_x;
} PlayState;
/* for debugging */
@@ -558,8 +561,18 @@ static void update_sound_fps(void)
#endif
}
-static void change_frame(PlayState *ps, int cx)
+static void tag_change_frame(PlayState *ps, int cx)
+{
+ ps->need_frame_update = true;
+ ps->frame_cursor_x = cx;
+}
+
+static void change_frame(PlayState *ps)
{
+ if (!ps->need_frame_update) {
+ return;
+ }
+
int sizex, sizey;
int i, i_last;
@@ -569,7 +582,7 @@ static void change_frame(PlayState *ps, int cx)
playanim_window_get_size(&sizex, &sizey);
i_last = ((struct PlayAnimPict *)picsbase.last)->frame;
- i = (i_last * cx) / sizex;
+ i = (i_last * ps->frame_cursor_x) / sizex;
CLAMP(i, 0, i_last);
#ifdef WITH_AUDASPACE
@@ -610,6 +623,8 @@ static void change_frame(PlayState *ps, int cx)
ps->sstep = true;
ps->wait2 = false;
ps->next_frame = 0;
+
+ ps->need_frame_update = false;
}
static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
@@ -961,7 +976,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
if (type == GHOST_kEventButtonDown) {
if (inside_window) {
g_WS.qual |= WS_QUAL_LMOUSE;
- change_frame(ps, cx);
+ tag_change_frame(ps, cx);
}
}
else
@@ -1006,7 +1021,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
GHOST_ScreenToClient(g_WS.ghost_window, cd->x, cd->y, &cx, &cy);
- change_frame(ps, cx);
+ tag_change_frame(ps, cx);
}
break;
}
@@ -1442,23 +1457,18 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
ps.next_frame = ps.direction;
- while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, ps.wait2))) {
- if (hasevent) {
- GHOST_DispatchEvents(g_WS.ghost_system);
- }
- /* Note, this still draws for mousemoves on pause */
- if (ps.wait2) {
- if (hasevent) {
- if (ibuf) {
- while (pupdate_time()) PIL_sleep_ms(1);
- ptottime -= swaptime;
- playanim_toscreen(&ps, ps.picture, ibuf, ps.fontid, ps.fstep);
- }
- }
- }
- if (ps.go == false) {
- break;
- }
+ while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0))) {
+ GHOST_DispatchEvents(g_WS.ghost_system);
+ }
+ if (ps.go == false) {
+ break;
+ }
+ change_frame(&ps);
+ if (!hasevent) {
+ PIL_sleep_ms(1);
+ }
+ if (ps.wait2) {
+ continue;
}
ps.wait2 = ps.sstep;