diff options
author | Jeroen Bakker <jbakker> | 2020-06-23 08:59:34 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2020-06-23 13:03:17 +0300 |
commit | bbb2e0614fc3c017f4dbcdb8a26be612e8cb282e (patch) | |
tree | 44f695b04ce732d0c5a6bf35a6883b70044563e7 /source/blender/editors/space_nla | |
parent | 87ceff3d1b5805658622a314a84620b52ab98c7d (diff) |
Performance: Draw play head as an overlay
When playing back animations a playhead is updated in all the animation editors.
The drawing of the playhead is part of the drawing of the main region
`RGN_TYPE_WINDOW` that redraws the whole region.
This change will draw the play head and window scrollers when updating the
screen. This affects the Action editor, Timeline, Graph editor, NLA editor and
Sequence editor. There is noticeable speedup when using complex animation files.
Spring 02_020_A.anim.blend fps went from 11.8 to 12.5 when showing a timeline
and a action editor on a Ryzen 1700.
* When playing back animation the markers don't jump up/down when near the
frame. This could be added back.
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D8066
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/space_nla.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index aeb5c30c809..b09536e0621 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -259,13 +259,10 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) UI_view2d_text_cache_draw(region); } - UI_view2d_view_ortho(v2d); - /* current frame */ if (snla->flag & SNLA_DRAWTIME) { cfra_flag |= DRAWCFRA_UNIT_SECONDS; } - ANIM_draw_cfra(C, v2d, cfra_flag); /* markers */ UI_view2d_view_orthoSpecial(region, v2d, 1); @@ -286,6 +283,17 @@ static void nla_main_region_draw(const bContext *C, ARegion *region) UI_view2d_view_restore(C); ED_time_scrub_draw(region, scene, snla->flag & SNLA_DRAWTIME, true); +} + +static void nla_main_region_draw_overlay(const bContext *C, ARegion *region) +{ + /* draw entirely, view changes should be handled here */ + const SpaceNla *snla = CTX_wm_space_nla(C); + const Scene *scene = CTX_data_scene(C); + View2D *v2d = ®ion->v2d; + + /* scrubbing region */ + ED_time_scrub_draw_current_frame(region, scene, snla->flag & SNLA_DRAWTIME, true); /* scrollers */ UI_view2d_scrollers_draw(v2d, NULL); @@ -614,6 +622,7 @@ void ED_spacetype_nla(void) art->regionid = RGN_TYPE_WINDOW; art->init = nla_main_region_init; art->draw = nla_main_region_draw; + art->draw_overlay = nla_main_region_draw_overlay; art->listener = nla_main_region_listener; art->message_subscribe = nla_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; |