Fix #34941: Space.draw_handler_add now supports PRE_VIEW and POST_VIEW callbacks
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 10 Apr 2013 16:59:55 +0000 (16:59 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 10 Apr 2013 16:59:55 +0000 (16:59 +0000)
for more editors: timeline, graph, action, NLA, sequencer, image, clip.

source/blender/editors/include/ED_mask.h
source/blender/editors/mask/mask_draw.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_time/space_time.c

index 6644f59be94ff7f88593eda51b5206c78e70c6cb..420ab24e5e9df1ca8848fc99dee1c44d5901ec09 100644 (file)
@@ -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);
 
index af9d3341e618ae855049b5ef0f317a669995d2a8..89881ad36e1300494d008abdf3159448150abfac 100644 (file)
@@ -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);
        }
 
index e0ca589c1fb793eab0aecd3c2404e929d90ef899..137ac367815e222fe2679e030b5c31c6e59114d2 100644 (file)
@@ -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);
index 734c0e6c479fec6ccb08cdfa89511f72ba83331e..98c26a447b7f348a484025e8d3f002206727bec9 100644 (file)
@@ -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);
        
index 9bc23ca17c2b61c8aac08064fbedd74461611094..815610ff1df5c9bea0cf2905a3afd01b1f56c1e5 100644 (file)
@@ -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) */
index 7c9014bd45f452c5c65169a3742256e64a2bb466..ccf600009934b3878e22bba94daf22e8a0cd37f9 100644 (file)
@@ -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);
        
index 3a7610cbf2a2310f3e38f14a40e73e08903c9292..9f73248b6d0a2b7b2381a866fb700299c4a78a76 100644 (file)
@@ -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);
 
index e5bd9e62c74235812a301b1132fc898df76e2084..0f798aa18930b684b2764bb9a20d8f3f37a6f15c 100644 (file)
@@ -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);