[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51238] trunk/blender/source/blender/ editors: object center selection now uses floats, also fix own error in circle selection in recent refactor.

Campbell Barton ideasman42 at gmail.com
Wed Oct 10 03:54:07 CEST 2012


Revision: 51238
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51238
Author:   campbellbarton
Date:     2012-10-10 01:54:02 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
object center selection now uses floats, also fix own error in circle selection in recent refactor.

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

Modified: trunk/blender/source/blender/editors/mesh/editmesh_slide.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_slide.c	2012-10-10 01:22:19 UTC (rev 51237)
+++ trunk/blender/source/blender/editors/mesh/editmesh_slide.c	2012-10-10 01:54:02 UTC (rev 51238)
@@ -409,7 +409,8 @@
 	/* Nearest edge */
 	BMEdge *nst_edge = NULL;
 
-	const float mval_float[] = { (float)event->mval[0], (float)event->mval[1]};
+	const float mval_float[2] = {(float)event->mval[0],
+	                             (float)event->mval[1]};
 
 	/* Set mouse coords */
 	copy_v2_v2_int(vso->view_context->mval, event->mval);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2012-10-10 01:22:19 UTC (rev 51237)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2012-10-10 01:54:02 UTC (rev 51238)
@@ -1415,9 +1415,12 @@
 	View3D *v3d = CTX_wm_view3d(C);
 	Scene *scene = CTX_data_scene(C);
 	Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL;
-	int temp, a, dist = 100;
+	int  a;
+	float dist = 100.0f;
 	int retval = 0;
 	short hits;
+	const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
+
 	
 	/* setup view context for argument to callbacks */
 	view3d_set_viewcontext(C, &vc);
@@ -1438,13 +1441,16 @@
 			base = startbase;
 			while (base) {
 				if (BASE_SELECTABLE(v3d, base)) {
-					ED_view3d_project_base(ar, base);
-					temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
-					if (base == BASACT) temp += 10;
-					if (temp < dist) {
-						
-						dist = temp;
-						basact = base;
+					float screen_co[2];
+					if (ED_view3d_project_float_global(ar, base->object->obmat[3], screen_co,
+					                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)
+					{
+						float dist_temp = len_manhattan_v2v2(mval_fl, screen_co);
+						if (base == BASACT) dist_temp += 10.0f;
+						if (dist_temp < dist) {
+							dist = dist_temp;
+							basact = base;
+						}
 					}
 				}
 				base = base->next;
@@ -2653,11 +2659,12 @@
 	const float radius_squared = rad * rad;
 	const float mval_fl[2] = {mval[0], mval[1]};
 	int is_change = FALSE;
+	int select_flag = select ? SELECT : 0;
 
 	Base *base;
 	select = select ? BA_SELECT : BA_DESELECT;
 	for (base = FIRSTBASE; base; base = base->next) {
-		if (((base->flag & SELECT) == 0) && BASE_SELECTABLE(vc->v3d, base)) {
+		if (BASE_SELECTABLE(vc->v3d, base) && ((base->flag & SELECT) != select_flag)) {
 			float screen_co[2];
 			if (ED_view3d_project_float_global(vc->ar, base->object->obmat[3], screen_co,
 			                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN) == V3D_PROJ_RET_OK)




More information about the Bf-blender-cvs mailing list