Fix #34941: Space.draw_handler_add now supports PRE_VIEW and POST_VIEW callbacks
for more editors: timeline, graph, action, NLA, sequencer, image, clip.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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) */
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user