[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51065] trunk/blender/source/blender/ editors: replace ED_view3d_project_float with ED_view3d_project_float_global

Campbell Barton ideasman42 at gmail.com
Fri Oct 5 05:20:17 CEST 2012


Revision: 51065
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51065
Author:   campbellbarton
Date:     2012-10-05 03:20:14 +0000 (Fri, 05 Oct 2012)
Log Message:
-----------
replace ED_view3d_project_float with ED_view3d_project_float_global

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature_sketch.c
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/editors/transform/transform_snap.c

Modified: trunk/blender/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2012-10-05 03:06:01 UTC (rev 51064)
+++ trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2012-10-05 03:20:14 UTC (rev 51065)
@@ -910,9 +910,9 @@
 	for (i = start; i <= end; i++) {
 		float ray_start[3], ray_normal[3];
 		float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p);
-		float pval[2];
+		float pval[2] = {0, 0};
 
-		ED_view3d_project_float(ar, stk->points[i].p, pval);
+		ED_view3d_project_float_global(ar, stk->points[i].p, pval, V3D_PROJ_TEST_NOP);
 		ED_view3d_win_to_ray(ar, v3d, pval, ray_start, ray_normal);
 
 		mul_v3_fl(ray_normal, distance * progress / length);
@@ -1462,8 +1462,8 @@
 		float s_p2[3] = {0, 0, 0};
 		int g_i;
 
-		ED_view3d_project_float(ar, gesture->points[s_i].p, s_p1);
-		ED_view3d_project_float(ar, gesture->points[s_i + 1].p, s_p2);
+		ED_view3d_project_float_global(ar, gesture->points[s_i].p, s_p1, V3D_PROJ_TEST_NOP);
+		ED_view3d_project_float_global(ar, gesture->points[s_i + 1].p, s_p2, V3D_PROJ_TEST_NOP);
 
 		/* start checking from second next, because two consecutive cannot intersect */
 		for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++) {
@@ -1472,8 +1472,8 @@
 			float vi[3];
 			float lambda;
 
-			ED_view3d_project_float(ar, gesture->points[g_i].p, g_p1);
-			ED_view3d_project_float(ar, gesture->points[g_i + 1].p, g_p2);
+			ED_view3d_project_float_global(ar, gesture->points[g_i].p, g_p1, V3D_PROJ_TEST_NOP);
+			ED_view3d_project_float_global(ar, gesture->points[g_i + 1].p, g_p2, V3D_PROJ_TEST_NOP);
 
 			if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
 				SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
@@ -1540,8 +1540,8 @@
 			float s_p2[3] = {0, 0, 0};
 			int g_i;
 
-			ED_view3d_project_float(ar, stk->points[s_i].p, s_p1);
-			ED_view3d_project_float(ar, stk->points[s_i + 1].p, s_p2);
+			ED_view3d_project_float_global(ar, stk->points[s_i].p, s_p1, V3D_PROJ_TEST_NOP);
+			ED_view3d_project_float_global(ar, stk->points[s_i + 1].p, s_p2, V3D_PROJ_TEST_NOP);
 
 			for (g_i = 0; g_i < gesture->nb_points - 1; g_i++) {
 				float g_p1[3] = {0, 0, 0};
@@ -1549,8 +1549,8 @@
 				float vi[3];
 				float lambda;
 
-				ED_view3d_project_float(ar, gesture->points[g_i].p, g_p1);
-				ED_view3d_project_float(ar, gesture->points[g_i + 1].p, g_p2);
+				ED_view3d_project_float_global(ar, gesture->points[g_i].p, g_p1, V3D_PROJ_TEST_NOP);
+				ED_view3d_project_float_global(ar, gesture->points[g_i + 1].p, g_p2, V3D_PROJ_TEST_NOP);
 
 				if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
 					SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2012-10-05 03:06:01 UTC (rev 51064)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2012-10-05 03:20:14 UTC (rev 51065)
@@ -150,7 +150,6 @@
 eV3DProjStatus ED_view3d_project_float_global(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
 eV3DProjStatus ED_view3d_project_float_object(struct ARegion *ar, const float co[3], float r_co[2], eV3DProjTest flag);
 
-void ED_view3d_project_float(struct ARegion *ar, const float co[3], float r_co[2]);
 void ED_view3d_project_float_noclip(struct ARegion *ar, const float co[3], float r_co[2]);
 void ED_view3d_project_float_v2_m4(const struct ARegion *a, const float co[3], float r_co[2], float mat[4][4]);
 void ED_view3d_project_float_v3_m4(struct ARegion *a, const float co[3], float r_co[3], float mat[4][4]);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2012-10-05 03:06:01 UTC (rev 51064)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2012-10-05 03:20:14 UTC (rev 51065)
@@ -322,11 +322,16 @@
 	add_v3_v3v3(offset, location, ortho);
 
 	/* project the center of the brush, and the tangent point to the view onto the screen */
-	ED_view3d_project_float(vc->ar, location, p1);
-	ED_view3d_project_float(vc->ar, offset, p2);
-
-	/* the distance between these points is the size of the projected brush in pixels */
-	return len_v2v2(p1, p2);
+	if ((ED_view3d_project_float_global(vc->ar, location, p1, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) &&
+	    (ED_view3d_project_float_global(vc->ar, offset,   p2, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS))
+	{
+		/* the distance between these points is the size of the projected brush in pixels */
+		return len_v2v2(p1, p2);
+	}
+	else {
+		BLI_assert(0);  /* assert because the code that sets up the vectors should disallow this */
+		return 0;
+	}
 }
 
 static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2012-10-05 03:06:01 UTC (rev 51064)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2012-10-05 03:20:14 UTC (rev 51065)
@@ -1047,25 +1047,6 @@
 	return ED_view3d_project_float_ex(ar, rv3d->persmatob, TRUE, co, r_co, flag);
 }
 
-
-void ED_view3d_project_float(ARegion *ar, const float co[3], float r_co[2])
-{
-	RegionView3D *rv3d = ar->regiondata;
-
-	float vec4[4];
-
-	copy_v3_v3(vec4, co);
-	vec4[3] = 1.0;
-	r_co[0] = IS_CLIPPED;
-
-	mul_m4_v4(rv3d->persmat, vec4);
-
-	if (vec4[3] > (float)BL_NEAR_CLIP) {
-		r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
-		r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
-	}
-}
-
 void ED_view3d_project_float_noclip(ARegion *ar, const float co[3], float r_co[2])
 {
 	RegionView3D *rv3d = ar->regiondata;

Modified: trunk/blender/source/blender/editors/transform/transform_snap.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_snap.c	2012-10-05 03:06:01 UTC (rev 51064)
+++ trunk/blender/source/blender/editors/transform/transform_snap.c	2012-10-05 03:20:14 UTC (rev 51065)
@@ -317,18 +317,18 @@
 				copy_v3_v3(iloc, td->ob->obmat[3]);
 			}
 			
-			ED_view3d_project_float(t->ar, iloc, mval);
-			
-			if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) {
-//				if (t->flag & (T_EDIT|T_POSE)) {
-//					mul_m4_v3(imat, loc);
-//				}
-//				
-				sub_v3_v3v3(tvec, loc, iloc);
-				
-				mul_m3_v3(td->smtx, tvec);
-				
-				add_v3_v3(td->loc, tvec);
+			if (ED_view3d_project_float_global(t->ar, iloc, mval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+				if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) {
+//					if (t->flag & (T_EDIT|T_POSE)) {
+//						mul_m4_v3(imat, loc);
+//					}
+
+					sub_v3_v3v3(tvec, loc, iloc);
+
+					mul_m3_v3(td->smtx, tvec);
+
+					add_v3_v3(td->loc, tvec);
+				}
 			}
 			
 			//XXX constraintTransLim(t, td);




More information about the Bf-blender-cvs mailing list