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_sequencer | |
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_sequencer')
3 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 070ae72d789..fc51438d121 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2345,7 +2345,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); UI_view2d_view_restore(C); ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); - UI_view2d_scrollers_draw(v2d, NULL); /* Draw channel numbers. */ { @@ -2355,3 +2354,13 @@ void draw_timeline_seq(const bContext *C, ARegion *region) UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT); } } + +void draw_timeline_seq_display(const bContext *C, ARegion *region) +{ + const Scene *scene = CTX_data_scene(C); + const SpaceSeq *sseq = CTX_wm_space_seq(C); + View2D *v2d = ®ion->v2d; + + ED_time_scrub_draw_current_frame(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); + UI_view2d_scrollers_draw(v2d, NULL); +} diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 12533dbc74f..fee07e8941d 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -43,6 +43,7 @@ struct wmOperator; /* sequencer_draw.c */ void draw_timeline_seq(const struct bContext *C, struct ARegion *region); +void draw_timeline_seq_display(const struct bContext *C, struct ARegion *region); void sequencer_draw_preview(const struct bContext *C, struct Scene *scene, struct ARegion *region, diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index f52cfdd34c0..368f9c1af19 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -521,6 +521,12 @@ static void sequencer_main_region_draw(const bContext *C, ARegion *region) draw_timeline_seq(C, region); } +/* Strip editing timeline. */ +static void sequencer_main_region_draw_overlay(const bContext *C, ARegion *region) +{ + draw_timeline_seq_display(C, region); +} + static void sequencer_main_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(area), ARegion *region, @@ -865,6 +871,7 @@ void ED_spacetype_sequencer(void) art->regionid = RGN_TYPE_WINDOW; art->init = sequencer_main_region_init; art->draw = sequencer_main_region_draw; + art->draw_overlay = sequencer_main_region_draw_overlay; art->listener = sequencer_main_region_listener; art->message_subscribe = sequencer_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; |