[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18980] branches/blender2.5/blender/source /blender: 2.5
Ton Roosendaal
ton at blender.org
Sun Feb 15 14:09:19 CET 2009
Revision: 18980
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18980
Author: ton
Date: 2009-02-15 14:09:19 +0100 (Sun, 15 Feb 2009)
Log Message:
-----------
2.5
Anim playback now uses "Sync" option, skipping frames to match
real time (as set by the frames/sec button).
This is a quicky for tests with audio. Note that the real time
in seconds to update sound to in ED_update_for_newframe() would be:
(scene->r.cfra / FPS) + screen->animtimer->duration
Also this can have a slight inaccuracy, the time between the timer
handler and the ED_update_for_newframe() notifier is not known,
but in general nearly zero. A better implementation is possible, but
thats for later. :)
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-02-15 11:41:22 UTC (rev 18979)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-02-15 13:09:19 UTC (rev 18980)
@@ -24,6 +24,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <math.h>
+
#include "MEM_guardedalloc.h"
#include "BLI_arithb.h"
@@ -1774,7 +1776,14 @@
if(screen->animtimer==event->customdata) {
Scene *scene= CTX_data_scene(C);
- scene->r.cfra++;
+ if(scene->audio.flag & AUDIO_SYNC) {
+ wmTimer *wt= screen->animtimer;
+ int step = floor(wt->duration * FPS);
+ scene->r.cfra += step;
+ wt->duration -= ((float)step)/FPS;
+ }
+ else
+ scene->r.cfra++;
if (scene->r.psfra) {
if(scene->r.cfra > scene->r.pefra)
Modified: branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c 2009-02-15 11:41:22 UTC (rev 18979)
+++ branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c 2009-02-15 13:09:19 UTC (rev 18980)
@@ -528,7 +528,8 @@
/* This timer system only gives maximum 1 timer event per redraw cycle,
to prevent queues to get overloaded.
Timer handlers should check for delta to decide if they just
- update, or follow real time
+ update, or follow real time.
+ Timer handlers can also set duration to match frames passed */
*/
static int wm_window_timer(const bContext *C)
{
More information about the Bf-blender-cvs
mailing list