From ac224a64f408fcc8f90f7ea0124cbe4b9ef1e811 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 10 Apr 2013 16:59:55 +0000 Subject: Fix #34941: Space.draw_handler_add now supports PRE_VIEW and POST_VIEW callbacks for more editors: timeline, graph, action, NLA, sequencer, image, clip. --- source/blender/editors/include/ED_mask.h | 2 +- source/blender/editors/mask/mask_draw.c | 8 ++++++-- source/blender/editors/space_action/space_action.c | 6 ++++++ source/blender/editors/space_graph/space_graph.c | 6 ++++++ source/blender/editors/space_image/space_image.c | 3 +++ source/blender/editors/space_nla/space_nla.c | 6 ++++++ source/blender/editors/space_sequencer/sequencer_draw.c | 5 +++++ source/blender/editors/space_time/space_time.c | 6 ++++++ 8 files changed, 39 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 6644f59be94..420ab24e5e9 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -58,7 +58,7 @@ void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar, const char draw_flag, const char draw_type, const int width_i, const int height_i, const float aspx, const float aspy, - const short do_scale_applied, const short do_post_draw, + const short do_scale_applied, const short do_draw_cb, float stabmat[4][4], const struct bContext *C); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index af9d3341e61..89881ad36e1 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -541,7 +541,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, const char draw_flag, const char draw_type, const int width_i, const int height_i, /* convert directly into aspect corrected vars */ const float aspx, const float aspy, - const short do_scale_applied, const short do_post_draw, + const short do_scale_applied, const short do_draw_cb, float stabmat[4][4], /* optional - only used by clip */ const bContext *C /* optional - only used when do_post_draw is set or called from clip editor */ ) @@ -601,10 +601,14 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, glMultMatrixf(stabmat); } + if (do_draw_cb) { + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + } + /* draw! */ draw_masklays(C, mask, draw_flag, draw_type, width, height); - if (do_post_draw) { + if (do_draw_cb) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); } diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index e0ca589c1fb..137ac367815 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -185,6 +185,8 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + /* data */ if (ANIM_animdata_get_context(C, &ac)) { draw_channel_strips(&ac, saction, ar); @@ -204,6 +206,10 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) /* preview range */ UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); + + /* callback */ + UI_view2d_view_ortho(v2d); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); /* reset view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 734c0e6c479..98c26a447b7 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -242,6 +242,8 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { /* draw ghost curves */ @@ -295,6 +297,10 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); + /* callback */ + UI_view2d_view_ortho(v2d); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + /* reset view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 9bc23ca17c2..815610ff1df 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -667,6 +667,9 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) /* and uvs in 0.0-1.0 space */ UI_view2d_view_ortho(v2d); + + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + draw_uvedit_main(sima, ar, scene, obedit, obact); /* check for mask (delay draw) */ diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 7c9014bd45f..ccf60000993 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -284,6 +284,8 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + /* data */ if (ANIM_animdata_get_context(C, &ac)) { /* strips and backdrops */ @@ -308,6 +310,10 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); + /* callback */ + UI_view2d_view_ortho(v2d); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + /* reset view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 3a7610cbf2a..9f73248b6d0 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1404,6 +1404,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* regular grid-pattern over the rest of the view (i.e. 25-frame grid lines) */ // NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30... UI_view2d_constant_grid_draw(v2d); + + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); seq_draw_sfra_efra(scene, v2d); @@ -1443,6 +1445,9 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) } + /* callback */ + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + /* reset view matrix */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index e5bd9e62c74..0f798aa1893 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -487,6 +487,8 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES | V2D_VERTICAL_AXIS)); UI_view2d_grid_free(grid); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + /* start and end frame */ time_draw_sfra_efra(scene, v2d); @@ -508,6 +510,10 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) /* caches */ time_draw_cache(stime, obact, scene); + /* callback */ + UI_view2d_view_ortho(v2d); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + /* reset view matrix */ UI_view2d_view_restore(C); -- cgit v1.2.3