[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42924] branches/bmesh/blender/source/ blender: sync customdata layers up with trunk.

Campbell Barton ideasman42 at gmail.com
Wed Dec 28 14:11:55 CET 2011


Revision: 42924
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42924
Author:   campbellbarton
Date:     2011-12-28 13:11:46 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
sync customdata layers up with trunk. existing bmesh files will crash on load but this is unavoidable.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
    branches/bmesh/blender/source/blender/makesdna/DNA_customdata_types.h

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c	2011-12-28 12:39:35 UTC (rev 42923)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c	2011-12-28 13:11:46 UTC (rev 42924)
@@ -976,48 +976,55 @@
 	MCol *mcol = (MCol*)data;
 	int i;
 
-	for(i = 0; i < 4*count; i++)
+	for(i = 0; i < 4*count; i++) {
 		mcol[i] = default_mcol;
+	}
 }
 
 static void layerInterp_bweight(void **sources, float *weights,
-                             float *UNUSED(sub_weights), int count, void *dest)
+                                float *UNUSED(sub_weights), int count, void *dest)
 {
-	float *f = dest, *src;
+	float *f = dest;
 	float **in = (float **)sources;
 	int i;
 	
 	if(count <= 0) return;
 
 	*f = 0.0f;
-	
-	for(i = 0; i < count; ++i) {
-		float weight = weights ? weights[i] : 1.0f;
-		
-		src = in[i];
-		*f += *src * weight;
+
+	if (weights) {
+		for(i = 0; i < count; ++i) {
+			*f += *in[i] * weights[i];
+		}
 	}
+	else {
+		for(i = 0; i < count; ++i) {
+			*f += *in[i];
+		}
+	}
 }
 
 static void layerInterp_shapekey(void **sources, float *weights,
-                             float *UNUSED(sub_weights), int count, void *dest)
+                                 float *UNUSED(sub_weights), int count, void *dest)
 {
-	float *co = dest, *src;
+	float *co = dest;
 	float **in = (float **)sources;
 	int i;
 
 	if(count <= 0) return;
 
-	memset(co, 0, sizeof(float)*3);
-	
-	for(i = 0; i < count; ++i) {
-		float weight = weights ? weights[i] : 1.0f;
-		
-		src = in[i];
-		co[0] += src[0] * weight;
-		co[1] += src[1] * weight;
-		co[2] += src[2] * weight;
+	zero_v3(co);
+
+	if (weights) {
+		for(i = 0; i < count; ++i) {
+			madd_v3_v3fl(co, in[i], weights[i]);
+		}
 	}
+	else {
+		for(i = 0; i < count; ++i) {
+			add_v3_v3(co, in[i]);
+		}
+	}
 }
 
 /* note, these numbered comments below are copied from trunk,
@@ -1080,34 +1087,55 @@
 	/* 20: CD_WEIGHT_MCOL */
 	{sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
 	 layerSwap_mcol, layerDefault_mcol},
-	{sizeof(MPoly), "MPoly", 1, "NGon Face", NULL, NULL, NULL, NULL, NULL},
-	{sizeof(MLoop), "MLoop", 1, "NGon Face-Vertex", NULL, NULL, NULL, NULL, NULL},
-	{sizeof(float)*3, "", 0, "ClothOrco", NULL, NULL, layerInterp_shapekey},
 	/* 21: CD_ID_MCOL */
 	{sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
 	 layerSwap_mcol, layerDefault_mcol},
-	{sizeof(MCol)*4, "MCol", 4, "TextureCol", NULL, NULL, layerInterp_mcol,
+	/* 22: CD_TEXTURE_MCOL */
+	{sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
 	 layerSwap_mcol, layerDefault_mcol},
+	/* 23: CD_CLOTH_ORCO */
+	{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+	/* 24: CD_RECAST */
+	{sizeof(MRecast), "MRecast", 1,"Recast",NULL,NULL,NULL,NULL}
+
+/* BMESH ONLY */
+	,
+	/* 25: CD_MPOLY */
+	{sizeof(MPoly), "MPoly", 1, "NGon Face", NULL, NULL, NULL, NULL, NULL},
+	/* 26: CD_MLOOP */
+	{sizeof(MLoop), "MLoop", 1, "NGon Face-Vertex", NULL, NULL, NULL, NULL, NULL},
+	/* 27: CD_SHAPE_KEYINDEX */
 	{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+	/* 28: CD_SHAPEKEY */
 	{sizeof(float)*3, "", 0, "ShapeKey", NULL, NULL, layerInterp_shapekey},
+	/* 29: CD_BWEIGHT */
 	{sizeof(float), "", 0, "BevelWeight", NULL, NULL, layerInterp_bweight},
+	/* 30: CD_CREASE */
 	{sizeof(float), "", 0, "SubSurfCrease", NULL, NULL, layerInterp_bweight},
+	/* 31: CD_WEIGHT_MLOOPCOL */
 	{sizeof(MLoopCol), "MLoopCol", 1, "WeightLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
 	 layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
 	 layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
-	/* 24: CD_RECAST */
-	{sizeof(MRecast), "MRecast", 1,"Recast",NULL,NULL,NULL,NULL}
+/* END BMESH ONLY */
+
+
 };
 
 /* note, numbers are from trunk and need updating for bmesh */
 
 static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
-	/*   0-4 */ "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace", "CDMTFace",
-	/*   5-9 */ "CDMCol", "CDOrigIndex", "CDNormal", "CDPolyIndex","CDMFloatProperty",
-	/* 10-14 */ "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco", "CDMTexPoly", "CDMLoopUV",
-	/* 15-19 */ "CDMloopCol", "CDTangent", "CDMDisps", "CDWeightMCol", "CDMPoly", 
-	/* 20-24 */ "CDMLoop", "CDMClothOrco", "CDMLoopCol", "CDIDCol", "CDTextureCol",
-	/* ?-? */ "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight", "CDSubSurfCrease", "CDMRecast"
+	/*   0-4 */ "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace",
+	/*   5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags",
+	/* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco",
+	/* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps",
+	/* 20-24 */"CDWeightMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
+
+/* BMESH ONLY */
+	,
+	/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
+	/* 30-31 */ "CDSubSurfCrease", "CDWeightLoopCol"
+/* END BMESH ONLY */
+
 };
 
 

Modified: branches/bmesh/blender/source/blender/makesdna/DNA_customdata_types.h
===================================================================
--- branches/bmesh/blender/source/blender/makesdna/DNA_customdata_types.h	2011-12-28 12:39:35 UTC (rev 42923)
+++ branches/bmesh/blender/source/blender/makesdna/DNA_customdata_types.h	2011-12-28 13:11:46 UTC (rev 42924)
@@ -90,17 +90,21 @@
 #define CD_TANGENT		18
 #define CD_MDISPS		19
 #define CD_WEIGHT_MCOL	20 /* for displaying weightpaint colors */
-#define CD_MPOLY		21
-#define CD_MLOOP		22
+#define CD_ID_MCOL		21
+#define CD_TEXTURE_MCOL	22
 #define CD_CLOTH_ORCO	23
-#define CD_ID_MCOL		24
-#define CD_TEXTURE_MCOL		25
-#define CD_SHAPE_KEYINDEX	26
-#define CD_SHAPEKEY		27
-#define CD_BWEIGHT		28
-#define CD_CREASE		29
-#define CD_WEIGHT_MLOOPCOL	30
-#define CD_RECAST		31
+#define CD_RECAST		24
+
+/* BMESH ONLY START */
+#define CD_MPOLY		25
+#define CD_MLOOP		26
+#define CD_SHAPE_KEYINDEX	27
+#define CD_SHAPEKEY		28
+#define CD_BWEIGHT		29
+#define CD_CREASE		30
+#define CD_WEIGHT_MLOOPCOL	31
+/* BMESH ONLY END */
+
 #define CD_NUMTYPES		32
 
 /* Bits for CustomDataMask */
@@ -125,18 +129,18 @@
 #define CD_MASK_TANGENT		(1 << CD_TANGENT)
 #define CD_MASK_MDISPS		(1 << CD_MDISPS)
 #define CD_MASK_WEIGHT_MCOL	(1 << CD_WEIGHT_MCOL)
+#define CD_MASK_CLOTH_ORCO	(1 << CD_CLOTH_ORCO)
+#define CD_MASK_RECAST		(1 << CD_RECAST)
+
+/* BMESH ONLY START */
 #define CD_MASK_MPOLY		(1 << CD_MPOLY)
 #define CD_MASK_MLOOP		(1 << CD_MLOOP)
-#define CD_MASK_WEIGHT_MLOOPCOL (1 << CD_WEIGHT_MLOOPCOL)
 #define CD_MASK_SHAPE_KEYINDEX	(1 << CD_SHAPE_KEYINDEX)
 #define CD_MASK_SHAPEKEY	(1 << CD_SHAPEKEY)
-#define CD_MASK_CLOTH_ORCO	(1 << CD_CLOTH_ORCO)
-#define CD_MASK_RECAST		(1 << CD_RECAST)
-
-/* derivedmesh wants CustomDataMask for weightpaint too, is not customdata though */
-#define CD_MASK_WEIGHTPAINT	(1 << CD_WEIGHTPAINT)
 #define CD_MASK_BWEIGHT		(1 << CD_BWEIGHT)
 #define CD_MASK_CREASE		(1 << CD_CREASE)
+#define CD_MASK_WEIGHT_MLOOPCOL (1 << CD_WEIGHT_MLOOPCOL)
+/* BMESH ONLY END */
 
 /* CustomData.flag */
 




More information about the Bf-blender-cvs mailing list