diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-02-12 03:44:26 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-02-12 03:44:26 +0300 |
commit | b482b8543eb10102c6c09756e08977a3b69ff633 (patch) | |
tree | 4532177f73045cc5cdb3582766d1e121604a53a1 /source/blender/editors/screen | |
parent | f0e873cabe0797c74fba440c8b11b4e2c038f791 (diff) |
Bugfix #21051: Restored 'Playback FPS'
This commit restores the 'Playback FPS' option which showed an indicator of the frame rate of animation playback in the 3D-View.
The info for this is now stored in a temp struct in scene data, with the status info being updated by the "animation step" operator instead of relying on globals as the old code did. This seems a lot more stable than in 2.49, but the accuracy is still questionable.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 26 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 9 |
2 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 048ade764d5..5c987f8d6d0 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1614,6 +1614,32 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa) } } +/* update frame rate info for viewport drawing */ +void ED_refresh_viewport_fps(bContext *C) +{ + wmTimer *animtimer= CTX_wm_screen(C)->animtimer; + Scene *scene= CTX_data_scene(C); + + /* is anim playback running? */ + if (animtimer && (U.uiflag & USER_SHOW_FPS)) { + ScreenFrameRateInfo *fpsi= scene->fps_info; + + /* if there isn't any info, init it first */ + if (fpsi == NULL) + fpsi= scene->fps_info= MEM_callocN(sizeof(ScreenFrameRateInfo), "refresh_viewport_fps fps_info"); + + /* update the values */ + fpsi->redrawtime= fpsi->lredrawtime; + fpsi->lredrawtime= animtimer->ltime; + } + else { + /* playback stopped or shouldn't be running */ + if (scene->fps_info) + MEM_freeN(scene->fps_info); + scene->fps_info= NULL; + } +} + /* redraws: uses defines from stime->redraws * enable: 1 - forward on, -1 - backwards on, 0 - off */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7f63fc11e64..13709935141 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2481,9 +2481,8 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) if(sad->flag & ANIMPLAY_FLAG_JUMPED) sound_seek_scene(C); - + /* since we follow drawflags, we can't send notifier but tag regions ourselves */ - ED_update_for_newframe(C, 1); for(sa= screen->areabase.first; sa; sa= sa->next) { @@ -2497,6 +2496,12 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) } } + /* update frame rate info too + * NOTE: this may not be accurate enough, since we might need this after modifiers/etc. + * have been calculated instead of just before updates have been done? + */ + ED_refresh_viewport_fps(C); + /* recalculate the timestep for the timer now that we've finished calculating this, * since the frames-per-second value may have been changed */ |