[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39471] branches/bmesh/blender/source/ blender/editors/space_view3d/drawobject.c: fix for missing clip check in mesh_foreachScreenFace__mapFunc, alsmo re-arranged the bmesh mapFunc' s since they were calculating values that weren't needed in some cases.

Campbell Barton ideasman42 at gmail.com
Tue Aug 16 22:00:57 CEST 2011


Revision: 39471
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39471
Author:   campbellbarton
Date:     2011-08-16 20:00:56 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
fix for missing clip check in mesh_foreachScreenFace__mapFunc, alsmo re-arranged the bmesh mapFunc's since they were calculating values that weren't needed in some cases.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c

Modified: branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c	2011-08-16 19:59:08 UTC (rev 39470)
+++ branches/bmesh/blender/source/blender/editors/space_view3d/drawobject.c	2011-08-16 20:00:56 UTC (rev 39471)
@@ -1642,15 +1642,12 @@
 
 	if (!BM_TestHFlag(eve, BM_HIDDEN)) {
 		short s[2]= {IS_CLIPPED, 0};
-		float co2[3];
 
-		VECCOPY(co2, co);
-
-		mul_m4_v3(data->vc.obedit->obmat, co2);
-
 		if (data->clipVerts) {
 			view3d_project_short_clip(data->vc.ar, co, s, 1);
 		} else {
+			float co2[2];
+			mul_v3_m4v3(co2, data->vc.obedit->obmat, co);
 			project_short_noclip(data->vc.ar, co2, s);
 		}
 
@@ -1683,20 +1680,19 @@
 {
 	struct { void (*func)(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index); void *userData; ViewContext vc; int clipVerts; float pmat[4][4], vmat[4][4]; } *data = userData;
 	BMEdge *eed = EDBM_get_edge_for_index(data->vc.em, index);
-	short s[2][2];
-	float v1_co[3], v2_co[3];
-	
-	VECCOPY(v1_co, v0co);
-	VECCOPY(v2_co, v1co);
 
-	mul_m4_v3(data->vc.obedit->obmat, v1_co);
-	mul_m4_v3(data->vc.obedit->obmat, v2_co);
-
 	if (!BM_TestHFlag(eed, BM_HIDDEN)) {
+		short s[2][2];
+
 		if (data->clipVerts==1) {
 			view3d_project_short_clip(data->vc.ar, v0co, s[0], 1);
 			view3d_project_short_clip(data->vc.ar, v1co, s[1], 1);
 		} else {
+			float v1_co[3], v2_co[3];
+
+			mul_v3_m4v3(v1_co, data->vc.obedit->obmat, v0co);
+			mul_v3_m4v3(v2_co, data->vc.obedit->obmat, v1co);
+
 			project_short_noclip(data->vc.ar, v1_co, s[0]);
 			project_short_noclip(data->vc.ar, v2_co, s[1]);
 
@@ -1734,16 +1730,18 @@
 static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
 {
 	struct { void (*func)(void *userData, BMFace *efa, int x, int y, int index); void *userData; ViewContext vc; float pmat[4][4], vmat[4][4]; } *data = userData;
-	float cent2[3];
 	BMFace *efa = EDBM_get_face_for_index(data->vc.em, index);
-	short s[2];
 
-	VECCOPY(cent2, cent);
 	if (efa && !BM_TestHFlag(efa, BM_HIDDEN)) {
-		mul_m4_v3(data->vc.obedit->obmat, cent2);
+		float cent2[3];
+		short s[2];
+
+		mul_v3_m4v3(cent2, data->vc.obedit->obmat, cent);
 		project_short(data->vc.ar, cent2, s);
 
-		data->func(data->userData, efa, s[0], s[1], index);
+		if (s[0] != IS_CLIPPED) {
+			data->func(data->userData, efa, s[0], s[1], index);
+		}
 	}
 }
 




More information about the Bf-blender-cvs mailing list