[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42952] trunk/blender/source/blender/ blenkernel: sync changes from bmesh r42951 + some other minor edits.

Campbell Barton ideasman42 at gmail.com
Wed Dec 28 23:46:11 CET 2011


Revision: 42952
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42952
Author:   campbellbarton
Date:     2011-12-28 22:46:10 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
sync changes from bmesh r42951 + some other minor edits.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42951

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_mesh.h
    trunk/blender/source/blender/blenkernel/intern/mesh.c

Modified: trunk/blender/source/blender/blenkernel/BKE_mesh.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_mesh.h	2011-12-28 22:37:09 UTC (rev 42951)
+++ trunk/blender/source/blender/blenkernel/BKE_mesh.h	2011-12-28 22:46:10 UTC (rev 42952)
@@ -37,11 +37,13 @@
 struct DispList;
 struct ListBase;
 struct EditMesh;
-struct MDeformVert;
 struct Mesh;
+struct MPoly;
+struct MLoop;
 struct MFace;
 struct MEdge;
 struct MVert;
+struct MDeformVert;
 struct MCol;
 struct Object;
 struct MTFace;
@@ -49,6 +51,7 @@
 struct CustomData;
 struct DerivedMesh;
 struct Scene;
+struct MLoopUV;
 
 #ifdef __cplusplus
 extern "C" {
@@ -166,8 +169,9 @@
 
 /*convert a triangle of loop facedata to mface facedata*/
 void mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata,
-			   struct CustomData *pdata, int lindex[4], int findex,
-			   const int polyindex, const int mf_len);
+                                 struct CustomData *pdata, int lindex[4], int findex,
+                                 const int polyindex, const int mf_len,
+                                 const int numTex, const int numCol, const int hasWCol);
 
 #ifdef __cplusplus
 }

Modified: trunk/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh.c	2011-12-28 22:37:09 UTC (rev 42951)
+++ trunk/blender/source/blender/blenkernel/intern/mesh.c	2011-12-28 22:46:10 UTC (rev 42952)
@@ -370,9 +370,9 @@
 		tex_space_mesh(me);
 	}
 
-	if (loc_r) VECCOPY(loc_r, me->loc);
-	if (rot_r) VECCOPY(rot_r, me->rot);
-	if (size_r) VECCOPY(size_r, me->size);
+	if (loc_r) copy_v3_v3(loc_r, me->loc);
+	if (rot_r) copy_v3_v3(rot_r, me->rot);
+	if (size_r) copy_v3_v3(size_r, me->size);
 }
 
 float *get_mesh_orco_verts(Object *ob)
@@ -829,7 +829,7 @@
 			a= dl->parts*dl->nr;
 			data= dl->verts;
 			while(a--) {
-				VECCOPY(mvert->co, data);
+				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
 				mvert++;
@@ -852,7 +852,7 @@
 				a= dl->parts*dl->nr;
 				data= dl->verts;
 				while(a--) {
-					VECCOPY(mvert->co, data);
+					copy_v3_v3(mvert->co, data);
 					data+=3;
 					vertcount++;
 					mvert++;
@@ -875,7 +875,7 @@
 			a= dl->nr;
 			data= dl->verts;
 			while(a--) {
-				VECCOPY(mvert->co, data);
+				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
 				mvert++;
@@ -903,7 +903,7 @@
 			a= dl->parts*dl->nr;
 			data= dl->verts;
 			while(a--) {
-				VECCOPY(mvert->co, data);
+				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
 				mvert++;
@@ -992,8 +992,8 @@
 		me->totedge= totedge;
 
 		me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, allvert, me->totvert);
+		me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, alledge, me->totedge);
 		me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, allface, me->totface);
-		me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, alledge, me->totedge);
 
 		mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
 	} else {
@@ -1452,19 +1452,22 @@
 #ifdef USE_BMESH_FORWARD_COMPAT
 
 void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
-			   CustomData *pdata, int lindex[4], int findex,
-			   const int polyindex,
-			   const int mf_len /* 3 or 4 */
-			   )
+                                 CustomData *pdata, int lindex[4], int findex,
+                                 const int polyindex,
+                                 const int mf_len, /* 3 or 4 */
+
+                                 /* cache values to avoid lookups every time */
+                                 const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */
+                                 const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */
+                                 const int hasWCol /* CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL) */
+                                 )
 {
 	MTFace *texface;
 	MTexPoly *texpoly;
 	MCol *mcol;
 	MLoopCol *mloopcol;
 	MLoopUV *mloopuv;
-	int i, j, hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL);
-	int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
-	int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+	int i, j;
 	
 	for(i=0; i < numTex; i++){
 		texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
@@ -1527,6 +1530,10 @@
 	MFace *mface = NULL, *mf;
 	BLI_array_declare(mface);
 
+	const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
+	const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+	const int hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL);
+
 	mpoly = CustomData_get_layer(pdata, CD_MPOLY);
 	mloop = CustomData_get_layer(ldata, CD_MLOOP);
 
@@ -1582,7 +1589,8 @@
 				mf->v3 = mloop[mf->v3].v;
 
 				mesh_loops_to_mface_corners(fdata, ldata, pdata,
-				                            lindex, k, i, 3);
+				                            lindex, k, i, 3,
+				                            numTex, numCol, hasWCol);
 				test_index_face(mf, fdata, totface, 3);
 			}
 			else {
@@ -1601,7 +1609,8 @@
 				mf->v4 = mloop[mf->v4].v;
 
 				mesh_loops_to_mface_corners(fdata, ldata, pdata,
-				                            lindex, k, i, 4);
+				                            lindex, k, i, 4,
+				                            numTex, numCol, hasWCol);
 				test_index_face(mf, fdata, totface, 4);
 			}
 




More information about the Bf-blender-cvs mailing list