[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18442] branches/blender2.5/blender/source /blender/editors: 2.5

Ton Roosendaal ton at blender.org
Sat Jan 10 17:49:25 CET 2009


Revision: 18442
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18442
Author:   ton
Date:     2009-01-10 17:49:22 +0100 (Sat, 10 Jan 2009)

Log Message:
-----------
2.5

Added custom data pointer to custom region_draw_cb
Also removed the test with green rect.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_space_api.h
    branches/blender2.5/blender/source/blender/editors/space_api/spacetypes.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_space_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_space_api.h	2009-01-10 16:46:29 UTC (rev 18441)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_space_api.h	2009-01-10 16:49:22 UTC (rev 18442)
@@ -61,8 +61,8 @@
 #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 *);
 

Modified: branches/blender2.5/blender/source/blender/editors/space_api/spacetypes.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_api/spacetypes.c	2009-01-10 16:46:29 UTC (rev 18441)
+++ branches/blender2.5/blender/source/blender/editors/space_api/spacetypes.c	2009-01-10 16:49:22 UTC (rev 18442)
@@ -132,20 +132,22 @@
 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 @@
 	
 	for(rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
 		if(rdc->type==type)
-			rdc->draw(C, ar);
+			rdc->draw(C, ar, rdc->customdata);
 	}		
 }
 

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-01-10 16:46:29 UTC (rev 18441)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_edit.c	2009-01-10 16:49:22 UTC (rev 18442)
@@ -97,7 +97,6 @@
 	int origx, origy, oldx, oldy;
 	int origkey;
 
-	void *vh; // XXX temp
 } ViewOpsData;
 
 #define TRACKBALLSIZE  (1.1)
@@ -364,10 +363,6 @@
 		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 @@
 	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 @@
 	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) {
 





More information about the Bf-blender-cvs mailing list