diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-15 08:45:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-15 08:56:30 +0300 |
commit | b4b2caffd8852fa831c4160c2fb6dec23e416c74 (patch) | |
tree | 897a882c8501b35aba5fd15e51eb225933fe58d2 /source/blender/windowmanager | |
parent | 02966427944fb4da5ef23b58950e42dc2ad6c3bb (diff) |
PlayAnim: avoid list count setting frame from mouse
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_playanim.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 1c32373767e..27b46099edb 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -544,17 +544,16 @@ static void update_sound_fps(void) static void change_frame(PlayState *ps, int cx) { int sizex, sizey; - int i; + int i, i_last; - playanim_window_get_size(&sizex, &sizey); - ps->picture = picsbase.first; - /* TODO - store in ps direct? */ - i = 0; - while (ps->picture) { - i++; - ps->picture = ps->picture->next; + if (BLI_listbase_is_empty(&picsbase)) { + return; } - i = (i * cx) / sizex; + + playanim_window_get_size(&sizex, &sizey); + i_last = ((struct PlayAnimPict *)picsbase.last)->frame; + i = (i_last * cx) / sizex; + CLAMP(i, 0, i_last); #ifdef WITH_AUDASPACE if (scrub_handle) { @@ -588,11 +587,8 @@ static void change_frame(PlayState *ps, int cx) } #endif - ps->picture = picsbase.first; - for (; i > 0; i--) { - if (ps->picture->next == NULL) break; - ps->picture = ps->picture->next; - } + ps->picture = BLI_findlink(&picsbase, i); + BLI_assert(ps->picture != NULL); ps->sstep = true; ps->wait2 = false; |