2.5
authorTon Roosendaal <ton@blender.org>
Sat, 10 Jan 2009 16:49:22 +0000 (16:49 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 10 Jan 2009 16:49:22 +0000 (16:49 +0000)
Added custom data pointer to custom region_draw_cb
Also removed the test with green rect.

source/blender/editors/include/ED_space_api.h
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_view3d/view3d_edit.c

index 20b1e2b5499c8202406170dadc5bf50183f09e66..08d2894ddf712925eb8b7a2011494ce6aaa37d8d 100644 (file)
@@ -61,8 +61,8 @@ void ED_file_exit(void);
 #define REGION_DRAW_POST       0
 
 void *ED_region_draw_cb_activate(struct ARegionType *, 
-                                                                void   (*draw)(const struct bContext *, struct ARegion *),
-                                                                int type);
+                                                                void   (*draw)(const struct bContext *, struct ARegion *, void *),
+                                                                void *custumdata, int type);
 void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int);
 void ED_region_draw_cb_exit(struct ARegionType *, void *);
 
index 8ed9bb10fd5430c83ffab1dc0d76dba202e8b77a..a07a1d0ecb39d3ecb91798af5f0319f7ba76f54d 100644 (file)
@@ -132,20 +132,22 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
 typedef struct RegionDrawCB {
        struct RegionDrawCB *next, *prev;
        
-       void            (*draw)(const struct bContext *, struct ARegion *);     
+       void (*draw)(const struct bContext *, struct ARegion *, void *);        
+       void *customdata;
        
        int type;
        
 } RegionDrawCB;
 
 void *ED_region_draw_cb_activate(ARegionType *art, 
-                                                                void   (*draw)(const struct bContext *, struct ARegion *),
-                                                                int type)
+                                                                void   (*draw)(const struct bContext *, struct ARegion *, void *),
+                                                                void *customdata, int type)
 {
        RegionDrawCB *rdc= MEM_callocN(sizeof(RegionDrawCB), "RegionDrawCB");
        
        BLI_addtail(&art->drawcalls, rdc);
        rdc->draw= draw;
+       rdc->customdata= customdata;
        rdc->type= type;
        
        return rdc;
@@ -170,7 +172,7 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
        
        for(rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
                if(rdc->type==type)
-                       rdc->draw(C, ar);
+                       rdc->draw(C, ar, rdc->customdata);
        }               
 }
 
index 90bc976f0155e962a82311bd58127b5aa29053d2..b2907cde8e754ce51c1e391544356b4c4c77b141 100644 (file)
@@ -97,7 +97,6 @@ typedef struct ViewOpsData {
        int origx, origy, oldx, oldy;
        int origkey;
 
-       void *vh; // XXX temp
 } ViewOpsData;
 
 #define TRACKBALLSIZE  (1.1)
@@ -364,10 +363,6 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
                default:
                        if(event->type==vod->origkey && event->val==0) {
 
-                               if(vod->vh) {
-                                       ED_region_draw_cb_exit(CTX_wm_region(C)->type, vod->vh);
-                                       ED_region_tag_redraw(CTX_wm_region(C));
-                               }
                                MEM_freeN(vod);
                                op->customdata= NULL;
 
@@ -378,12 +373,6 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
-static void vh_draw(const bContext *C, ARegion *ar)
-{
-       glColor3ub(100, 200, 100);
-       glRectf(-0.2,  -0.2,  0.2,  0.2); 
-}
-
 static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        ViewOpsData *vod;
@@ -392,8 +381,6 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
        viewops_data(C, op, event);
        vod= op->customdata;
 
-       vod->vh= ED_region_draw_cb_activate(CTX_wm_region(C)->type, vh_draw, REGION_DRAW_POST);
-       
        /* switch from camera view when: */
        if(vod->v3d->persp != V3D_PERSP) {