[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44979] trunk/blender/source/blender/ editors: Fix for [#30495] Framerate goes crazy after changing Sync mode from "Frame Dropping" to " no Sync" while playing anim

Joerg Mueller nexyon at gmail.com
Sun Mar 18 23:21:32 CET 2012


Revision: 44979
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44979
Author:   nexyon
Date:     2012-03-18 22:21:29 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
Fix for [#30495] Framerate goes crazy after changing Sync mode from "Frame Dropping" to "no Sync" while playing anim

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_screen_types.h
    trunk/blender/source/blender/editors/screen/screen_ops.c

Modified: trunk/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen_types.h	2012-03-18 22:06:57 UTC (rev 44978)
+++ trunk/blender/source/blender/editors/include/ED_screen_types.h	2012-03-18 22:21:29 UTC (rev 44979)
@@ -41,6 +41,7 @@
 	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) */
+	double last_duration;	/* used for frame dropping */
 } ScreenAnimData;
 
 /* for animplayer */

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2012-03-18 22:06:57 UTC (rev 44978)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2012-03-18 22:21:29 UTC (rev 44979)
@@ -2915,13 +2915,12 @@
 		}
 		else {
 			if (sync) {
-				int step = floor(wt->duration * FPS);
+				int step = floor((wt->duration - sad->last_duration) * FPS);
 				/* skip frames */
 				if (sad->flag & ANIMPLAY_FLAG_REVERSE)
 					scene->r.cfra -= step;
 				else
 					scene->r.cfra += step;
-				wt->duration -= ((double)step)/FPS;
 			}
 			else {
 				/* one frame +/- */
@@ -2932,6 +2931,8 @@
 			}
 		}
 		
+		sad->last_duration = wt->duration;
+
 		/* reset 'jumped' flag before checking if we need to jump... */
 		sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
 		




More information about the Bf-blender-cvs mailing list