[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60365] trunk/blender/source/blender/ editors/mesh/editmesh_knife.c: knife was projecting vertex locations to the screen when it wasnt needed.

Campbell Barton ideasman42 at gmail.com
Wed Sep 25 13:38:30 CEST 2013


Revision: 60365
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60365
Author:   campbellbarton
Date:     2013-09-25 11:38:30 +0000 (Wed, 25 Sep 2013)
Log Message:
-----------
knife was projecting vertex locations to the screen when it wasnt needed.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-09-25 11:11:41 UTC (rev 60364)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife.c	2013-09-25 11:38:30 UTC (rev 60365)
@@ -1358,13 +1358,16 @@
 				/* both kfe ends are in cutting triangle */
 				n_isects = 2;
 			}
-			else if (isect_line_tri_epsilon_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, NULL, depsilon)) {
+			else if (isect_line_tri_epsilon_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3,
+			                                   &lambda, NULL, depsilon))
+			{
 				/* kfe intersects cutting triangle lambda of the way along kfe */
 				interp_v3_v3v3(isects[0], kfe->v1->cageco, kfe->v2->cageco, lambda);
 				n_isects = 1;
 			}
+
 			for (j = 0; j < n_isects; j++) {
-				float p[3], no[3], view[3], sp[2];
+				float p[3];
 
 				copy_v3_v3(p, isects[j]);
 				if (kcd->curr.vert && len_squared_v3v3(kcd->curr.vert->cageco, p) < depsilon_sq) {
@@ -1384,17 +1387,19 @@
 					continue;
 				}
 
-				knife_project_v2(kcd, p, sp);
-				ED_view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
-				mul_m4_v3(kcd->ob->imat, view);
-
 				if (kcd->cut_through) {
 					f_hit = NULL;
 				}
 				else {
 					/* check if this point is visible in the viewport */
-					float p1[3], lambda1;
+					float p1[3], no[3], view[3], sp[2];
+					float lambda1;
 
+					/* screen projection */
+					knife_project_v2(kcd, p, sp);
+					ED_view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
+					mul_m4_v3(kcd->ob->imat, view);
+
 					/* if face isn't planer, p may be behind the current tesselated tri,
 					 * so move it onto that and then a little towards eye */
 					if (isect_line_tri_v3(p, view, ls[0]->v->co, ls[1]->v->co, ls[2]->v->co, &lambda1, NULL)) {




More information about the Bf-blender-cvs mailing list