[Bf-blender-cvs] [c1990af] blender-v2.76a-release: PlayAnim: avoid list count setting frame from mouse
Campbell Barton
noreply at git.blender.org
Thu Oct 29 11:39:29 CET 2015
Commit: c1990affac41cb3cf02540649799bd7a2931af92
Author: Campbell Barton
Date: Thu Oct 15 16:45:49 2015 +1100
Branches: blender-v2.76a-release
https://developer.blender.org/rBc1990affac41cb3cf02540649799bd7a2931af92
PlayAnim: avoid list count setting frame from mouse
===================================================================
M source/blender/windowmanager/intern/wm_playanim.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index bf30fd8..2f7e113 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;
More information about the Bf-blender-cvs
mailing list