[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43711] trunk/blender/source/blender/ editors/space_view3d/view3d_select.c: Replace hard-coded structures in selection callbacks in view3d_select with typedef-ed structures .

Sergey Sharybin sergey.vfx at gmail.com
Thu Jan 26 09:12:26 CET 2012


Revision: 43711
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43711
Author:   nazgul
Date:     2012-01-26 08:12:12 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
Replace hard-coded structures in selection callbacks in view3d_select with typedef-ed structures.

Should be no functional changes, but this discovered inconsistency in structures
used for armature circle selection, not sure how harmful this were, but it's not
nice to have such inconsistencies. Anyway, it's resolved now.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2012-01-26 07:33:14 UTC (rev 43710)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2012-01-26 08:12:12 UTC (rev 43711)
@@ -240,6 +240,12 @@
 
 /* *********************** GESTURE AND LASSO ******************* */
 
+typedef struct LassoSelectUserData {
+	ViewContext *vc;
+	rcti *rect;
+	int (*mcords)[2], moves, select, pass, done;
+} LassoSelectUserData;
+
 static int view3d_selectable_data(bContext *C)
 {
 	Object *ob = CTX_data_active_object(C);
@@ -456,7 +462,7 @@
 
 static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
 {
-	struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData;
+	LassoSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
 		eve->f = data->select?(eve->f|1):(eve->f&~1);
@@ -464,7 +470,7 @@
 }
 static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
 {
-	struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData;
+	LassoSelectUserData *data = userData;
 
 	if (EM_check_backbuf(em_solidoffs+index)) {
 		if (data->pass==0) {
@@ -483,16 +489,16 @@
 }
 static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
 {
-	struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } *data = userData;
+	LassoSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
-		EM_select_face_fgon(data->vc.em, efa, data->select);
+		EM_select_face_fgon(data->vc->em, efa, data->select);
 	}
 }
 
 static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	struct { ViewContext vc; rcti *rect; int (*mcords)[2], moves, select, pass, done; } data;
+	LassoSelectUserData data;
 	ToolSettings *ts= vc->scene->toolsettings;
 	rcti rect;
 	int bbsel;
@@ -502,7 +508,7 @@
 	/* set editmesh */
 	vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
 
-	data.vc= *vc;
+	data.vc= vc;
 	data.rect = ▭
 	data.mcords = mcords;
 	data.moves = moves;
@@ -610,7 +616,7 @@
 
 static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
-	struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } *data = userData;
+	LassoSelectUserData *data = userData;
 	Object *obedit= data->vc->obedit;
 	Curve *cu= (Curve*)obedit->data;
 
@@ -639,7 +645,7 @@
 
 static void do_lasso_select_curve(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	struct { ViewContext *vc; int (*mcords)[2]; short moves; short select; } data;
+	LassoSelectUserData data;
 
 	/* set vc->editnurb */
 	data.vc = vc;
@@ -656,7 +662,7 @@
 
 static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x, int y)
 {
-	struct { int (*mcords)[2]; short moves; short select; } *data = userData;
+	LassoSelectUserData *data = userData;
 
 	if (lasso_inside(data->mcords, data->moves, x, y)) {
 		bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
@@ -664,7 +670,7 @@
 }
 static void do_lasso_select_lattice(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	struct { int (*mcords)[2]; short moves; short select; } data;
+	LassoSelectUserData data;
 
 	/* set editdata in vc */
 	data.mcords = mcords;
@@ -1624,6 +1630,11 @@
 
 /* ********************  border and circle ************************************** */
 
+typedef struct BoxSelectUserData {
+	ViewContext *vc;
+	rcti *rect;
+	int select, pass, done;
+} BoxSelectUserData;
 
 int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2)
 {
@@ -1649,7 +1660,7 @@
 
 static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
-	struct { ViewContext *vc; rcti *rect; int select; } *data = userData;
+	BoxSelectUserData *data = userData;
 	Object *obedit= data->vc->obedit;
 	Curve *cu= (Curve*)obedit->data;
 
@@ -1677,7 +1688,7 @@
 }
 static int do_nurbs_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
-	struct { ViewContext *vc; rcti *rect; int select; } data;
+	BoxSelectUserData data;
 	
 	data.vc = vc;
 	data.rect = rect;
@@ -1694,7 +1705,7 @@
 
 static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, int y)
 {
-	struct { ViewContext vc; rcti *rect; int select; } *data = userData;
+	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
 		bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
@@ -1702,9 +1713,9 @@
 }
 static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
-	struct { ViewContext vc; rcti *rect; int select, pass, done; } data;
+	BoxSelectUserData data;
 
-	data.vc= *vc;
+	data.vc= vc;
 	data.rect = rect;
 	data.select = select;
 
@@ -1719,7 +1730,7 @@
 
 static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
 {
-	struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData;
+	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
 		eve->f = data->select?(eve->f|1):(eve->f&~1);
@@ -1727,7 +1738,7 @@
 }
 static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
 {
-	struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData;
+	BoxSelectUserData *data = userData;
 
 	if(EM_check_backbuf(em_solidoffs+index)) {
 		if (data->pass==0) {
@@ -1744,19 +1755,19 @@
 }
 static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
 {
-	struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData;
+	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
-		EM_select_face_fgon(data->vc.em, efa, data->select);
+		EM_select_face_fgon(data->vc->em, efa, data->select);
 	}
 }
 static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
-	struct { ViewContext vc; rcti *rect; short select, pass, done; } data;
+	BoxSelectUserData data;
 	ToolSettings *ts= vc->scene->toolsettings;
 	int bbsel;
 	
-	data.vc= *vc;
+	data.vc= vc;
 	data.rect = rect;
 	data.select = select;
 	data.pass = 0;
@@ -2251,9 +2262,16 @@
 
 /* -------------------- circle select --------------------------------------------- */
 
+typedef struct CircleSelectUserData {
+	ViewContext *vc;
+	short select;
+	int mval[2];
+	float radius;
+} CircleSelectUserData;
+
 static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
 	float r = sqrt(mx*mx + my*my);
 
@@ -2263,7 +2281,7 @@
 }
 static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 
 	if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) {
 		EM_select_edge(eed, data->select);
@@ -2271,7 +2289,7 @@
 }
 static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
 	float r = sqrt(mx*mx + my*my);
 	
@@ -2284,7 +2302,7 @@
 {
 	ToolSettings *ts= vc->scene->toolsettings;
 	int bbsel;
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } data;
+	CircleSelectUserData data;
 	
 	bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -2346,7 +2364,7 @@
 	Object *ob= vc->obact;
 	Mesh *me = ob?ob->data:NULL;
 	/* int bbsel; */ /* UNUSED */
-	/* struct {ViewContext *vc; short select; int mval[2]; float radius; } data = {NULL}; */ /* UNUSED */
+	/* CircleSelectUserData data = {NULL}; */ /* UNUSED */
 	if (me) {
 		em_vertoffs= me->totvert+1;	/* max index array */
 
@@ -2361,7 +2379,7 @@
 
 static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
 	float r = sqrt(mx*mx + my*my);
 	Object *obedit= data->vc->obedit;
@@ -2392,7 +2410,7 @@
 }
 static void nurbscurve_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } data;
+	CircleSelectUserData data;
 
 	/* set vc-> edit data */
 	
@@ -2409,7 +2427,7 @@
 
 static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int y)
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
 	float r = sqrt(mx*mx + my*my);
 
@@ -2419,7 +2437,7 @@
 }
 static void lattice_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } data;
+	CircleSelectUserData data;
 
 	/* set vc-> edit data */
 	
@@ -2436,7 +2454,7 @@
 // NOTE: pose-bone case is copied from editbone case...
 static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int x, int y)
 {
-	struct {ViewContext *vc; short select; int mval[2]; float radius; } *data = userData;
+	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
 	float r = sqrt(mx*mx + my*my);
 	
@@ -2451,7 +2469,7 @@
 }
 static void pose_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-blender-cvs mailing list