initial merge of bmesh customdata layer code into trunk, ifdef'd out for now with USE_BMESH_FORWARD_COMPAT.

This commit is contained in:
Campbell Barton 2011-12-28 13:15:17 +00:00
parent 164237b8d5
commit 312b080397
5 changed files with 92 additions and 0 deletions

View File

@ -867,6 +867,30 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 24: CD_RECAST */
{sizeof(MRecast), "MRecast", 1,"Recast",NULL,NULL,NULL,NULL}
#ifdef USE_BMESH_FORWARD_COMPAT
,
/* 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},
/* END BMESH ONLY */
#endif /* USE_BMESH_FORWARD_COMPAT */
};
static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
@ -875,6 +899,13 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
/* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco",
/* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps",
/* 20-24 */"CDWeightMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
#ifdef USE_BMESH_FORWARD_COMPAT
,
/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
/* 30-31 */ "CDSubSurfCrease", "CDWeightLoopCol"
#endif /* USE_BMESH_FORWARD_COMPAT */
};
const CustomDataMask CD_MASK_BAREMESH =

View File

@ -29,6 +29,7 @@
* \ingroup DNA
*/
#ifndef DNA_CUSTOMDATA_TYPES_H
#define DNA_CUSTOMDATA_TYPES_H
@ -36,6 +37,8 @@
extern "C" {
#endif
#include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */
/** descriptor and storage for a custom data layer */
typedef struct CustomDataLayer {
int type; /* type of data in layer */
@ -94,8 +97,27 @@ typedef struct CustomData {
#define CD_TEXTURE_MCOL 22
#define CD_CLOTH_ORCO 23
#define CD_RECAST 24
#ifdef USE_BMESH_FORWARD_COMPAT
/* 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
#else
#define CD_NUMTYPES 25
#endif
/* Bits for CustomDataMask */
#define CD_MASK_MVERT (1 << CD_MVERT)
#define CD_MASK_MSTICKY (1 << CD_MSTICKY)
@ -121,6 +143,20 @@ typedef struct CustomData {
#define CD_MASK_CLOTH_ORCO (1 << CD_CLOTH_ORCO)
#define CD_MASK_RECAST (1 << CD_RECAST)
#ifdef USE_BMESH_FORWARD_COMPAT
/* BMESH ONLY START */
#define CD_MASK_MPOLY (1 << CD_MPOLY)
#define CD_MASK_MLOOP (1 << CD_MLOOP)
#define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX)
#define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY)
#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 */
#endif
/* CustomData.flag */
/* indicates layer should not be copied by CustomData_from_template or

View File

@ -45,4 +45,6 @@
/* hrmf, we need a better include then this */
#include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */
// #define USE_BMESH_FORWARD_COMPAT
#endif /* DNA_DEFS_H */

View File

@ -36,6 +36,8 @@
#include "DNA_ID.h"
#include "DNA_customdata_types.h"
#include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */
struct DerivedMesh;
struct Ipo;
struct Key;

View File

@ -72,6 +72,27 @@ typedef struct MCol {
char a, r, g, b;
} MCol;
#ifdef USE_BMESH_FORWARD_COMPAT
/*new face structure, replaces MFace, which is now
only used for storing tesselations.*/
typedef struct MPoly {
/* offset into loop array and number of loops in the face */
int loopstart;
int totloop; /* keep signed since we need to subtract when getting the previous loop */
short mat_nr;
char flag, pad;
} MPoly;
/*the e here is because we want to move away from
relying on edge hashes.*/
typedef struct MLoop {
unsigned int v; /*vertex index*/
unsigned int e; /*edge index*/
} MLoop;
#endif /* USE_BMESH_FORWARD_COMPAT */
/*bmesh custom data stuff*/
typedef struct MTexPoly {
struct Image *tpage;