[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57460] trunk/blender/source/blender: code cleanup: remove checks for (select == LEFTMOUSE), this happened to work because its defined at 1, but confusingly checks against RIGHTMOUSE fail.

Campbell Barton ideasman42 at gmail.com
Sat Jun 15 08:03:15 CEST 2013


Revision: 57460
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57460
Author:   campbellbarton
Date:     2013-06-15 06:03:15 +0000 (Sat, 15 Jun 2013)
Log Message:
-----------
code cleanup: remove checks for (select == LEFTMOUSE), this happened to work because its defined at 1, but confusingly checks against RIGHTMOUSE fail.

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

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2013-06-14 20:43:54 UTC (rev 57459)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2013-06-15 06:03:15 UTC (rev 57460)
@@ -139,7 +139,7 @@
 
 /* local prototypes */
 
-static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, int select)
+static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, const bool select)
 {
 	BMVert *eve;
 	BMIter iter;
@@ -154,7 +154,7 @@
 	}
 }
 
-static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, int select)
+static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, const bool select)
 {
 	BMEdge *eed;
 	BMIter iter;
@@ -170,7 +170,7 @@
 	}
 }
 
-static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select)
+static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, const bool select)
 {
 	BMFace *efa;
 	BMIter iter;
@@ -188,7 +188,7 @@
 
 
 /* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
+static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, const bool select)
 {
 	MVert *mv = me->mvert;
 	unsigned int index;
@@ -205,7 +205,7 @@
 }
 
 /* object mode, edbm_ prefix is confusing here, rename? */
-static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select)
+static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const bool select)
 {
 	MPoly *mpoly = me->mpoly;
 	unsigned int index;
@@ -362,7 +362,7 @@
 		data->is_change |= is_point_done;
 	}
 }
-static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, bool select)
+static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[][2], short moves, const bool select)
 {
 	ViewContext vc_tmp;
 	LassoSelectUserData data;
@@ -403,7 +403,8 @@
 	}
 }
 
-static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves, bool extend, bool select)
+static void do_lasso_select_objects(ViewContext *vc, const int mcords[][2], const short moves,
+                                    const bool extend, const bool select)
 {
 	Base *base;
 	
@@ -415,8 +416,7 @@
 			ED_view3d_project_base(vc->ar, base);
 			if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) {
 				
-				if (select) ED_base_object_select(base, BA_SELECT);
-				else ED_base_object_select(base, BA_DESELECT);
+				ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
 				base->object->flag = base->flag;
 			}
 			if (base->object->mode & OB_MODE_POSE) {
@@ -781,7 +781,7 @@
 }
 
 #if 0
-static void do_lasso_select_node(int mcords[][2], short moves, short select)
+static void do_lasso_select_node(int mcords[][2], short moves, const bool select)
 {
 	SpaceNode *snode = sa->spacedata.first;
 	
@@ -1565,7 +1565,7 @@
 	const rcti *rect;
 	const rctf *rect_fl;
 	rctf       _rect_fl;
-	int select;
+	bool select;
 
 	/* runtime */
 	int pass;
@@ -1574,7 +1574,7 @@
 } BoxSelectUserData;
 
 static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data,
-                                           ViewContext *vc, const rcti *rect, const int select)
+                                           ViewContext *vc, const rcti *rect, const bool select)
 {
 	r_data->vc = vc;
 
@@ -2007,10 +2007,7 @@
 						}
 					}
 					else if (!bone_only) {
-						if (select)
-							ED_base_object_select(base, BA_SELECT);
-						else
-							ED_base_object_select(base, BA_DESELECT);
+						ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
 					}
 					
 					col += 4; /* next color */
@@ -2279,7 +2276,7 @@
 
 typedef struct CircleSelectUserData {
 	ViewContext *vc;
-	short select;
+	bool select;
 	int   mval[2];
 	float mval_fl[2];
 	float radius;
@@ -2290,7 +2287,7 @@
 } CircleSelectUserData;
 
 static void view3d_userdata_circleselect_init(CircleSelectUserData *r_data,
-                                              ViewContext *vc, const int select, const int mval[2], const float rad)
+                                              ViewContext *vc, const bool select, const int mval[2], const float rad)
 {
 	r_data->vc = vc;
 	r_data->select = select;
@@ -2330,7 +2327,7 @@
 	}
 }
 
-static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void mesh_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	ToolSettings *ts = vc->scene->toolsettings;
 	int bbsel;
@@ -2345,7 +2342,7 @@
 
 	if (ts->selectmode & SCE_SELECT_VERTEX) {
 		if (bbsel) {
-			edbm_backbuf_check_and_select_verts(vc->em, select == LEFTMOUSE);
+			edbm_backbuf_check_and_select_verts(vc->em, select);
 		}
 		else {
 			mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -2354,7 +2351,7 @@
 
 	if (ts->selectmode & SCE_SELECT_EDGE) {
 		if (bbsel) {
-			edbm_backbuf_check_and_select_edges(vc->em, select == LEFTMOUSE);
+			edbm_backbuf_check_and_select_edges(vc->em, select);
 		}
 		else {
 			mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
@@ -2363,7 +2360,7 @@
 	
 	if (ts->selectmode & SCE_SELECT_FACE) {
 		if (bbsel) {
-			edbm_backbuf_check_and_select_faces(vc->em, select == LEFTMOUSE);
+			edbm_backbuf_check_and_select_faces(vc->em, select);
 		}
 		else {
 			mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
@@ -2374,7 +2371,7 @@
 	EDBM_selectmode_flush(vc->em);
 }
 
-static void paint_facesel_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void paint_facesel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	Object *ob = vc->obact;
 	Mesh *me = ob ? ob->data : NULL;
@@ -2384,7 +2381,7 @@
 		bm_vertoffs = me->totpoly + 1; /* max index array */
 
 		/* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
-		edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE);
+		edbm_backbuf_check_and_select_tfaces(me, select);
 		EDBM_backbuf_free();
 		paintface_flush_flags(ob);
 	}
@@ -2398,7 +2395,7 @@
 		BKE_BIT_TEST_SET(mv->flag, data->select, SELECT);
 	}
 }
-static void paint_vertsel_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	const int use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT);
 	Object *ob = vc->obact;
@@ -2410,7 +2407,7 @@
 		bm_vertoffs = me->totvert + 1; /* max index array */
 
 		/* bbsel = */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
-		edbm_backbuf_check_and_select_verts_obmode(me, select == LEFTMOUSE);
+		edbm_backbuf_check_and_select_verts_obmode(me, select);
 		EDBM_backbuf_free();
 	}
 	else {
@@ -2459,7 +2456,7 @@
 		}
 	}
 }
-static void nurbscurve_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void nurbscurve_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
 
@@ -2478,7 +2475,7 @@
 		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
-static void lattice_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void lattice_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
 
@@ -2546,7 +2543,7 @@
 		data->is_change |= is_point_done;
 	}
 }
-static void pose_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void pose_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
 	
@@ -2632,7 +2629,7 @@
 		data->is_change |= is_point_done;
 	}
 }
-static void armature_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void armature_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
 	bArmature *arm = vc->obedit->data;
@@ -2660,7 +2657,7 @@
 		data->is_change = true;
 	}
 }
-static void mball_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static void mball_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
 
@@ -2673,7 +2670,7 @@
 
 /** Callbacks for circle selection in Editmode */
 
-static void obedit_circle_select(ViewContext *vc, short select, const int mval[2], float rad)
+static void obedit_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	switch (vc->obedit->type) {
 		case OB_MESH:
@@ -2697,16 +2694,16 @@
 	}
 }
 
-static bool object_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
+static bool object_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
 {
 	Scene *scene = vc->scene;
 	const float radius_squared = rad * rad;
 	const float mval_fl[2] = {mval[0], mval[1]};
 	bool is_change = false;
-	int select_flag = select ? SELECT : 0;
+	const int select_flag = select ? SELECT : 0;
 
+
 	Base *base;
-	select = select ? BA_SELECT : BA_DESELECT;
 	for (base = FIRSTBASE; base; base = base->next) {
 		if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag & SELECT) != select_flag)) {
 			float screen_co[2];
@@ -2714,7 +2711,7 @@
 			                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
 			{
 				if (len_squared_v2v2(mval_fl, screen_co) <= radius_squared) {
-					ED_base_object_select(base, select);
+					ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
 					is_change = true;
 				}
 			}
@@ -2731,11 +2728,9 @@
 	Object *obact = CTX_data_active_object(C);
 	const int radius = RNA_int_get(op->ptr, "radius");
 	const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
-	int select;
+	const bool select = (gesture_mode == GESTURE_MODAL_SELECT);
 	const int mval[2] = {RNA_int_get(op->ptr, "x"),
 	                     RNA_int_get(op->ptr, "y")};
-	
-	select = (gesture_mode == GESTURE_MODAL_SELECT);
 
 	if (CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
 	    (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) )

Modified: trunk/blender/source/blender/freestyle/CMakeLists.txt

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list