svn merge -r39878:39890 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Sat, 3 Sep 2011 12:57:33 +0000 (12:57 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 3 Sep 2011 12:57:33 +0000 (12:57 +0000)
1  2 
source/blender/blenkernel/intern/customdata.c
source/blender/editors/object/object_edit.c

index 9fe07834750edbe669826a988301a528a99b4907,c342bbc917f5b96ee850515d949fa3f422404057..f47e38f6d17e59f00352ee62aaaf9959f8884a17
@@@ -983,97 -805,69 +983,121 @@@ static void layerDefault_mcol(void *dat
                mcol[i] = default_mcol;
  }
  
 +static void layerInterp_bweight(void **sources, float *weights,
 +                             float *UNUSED(sub_weights), int count, void *dest)
 +{
 +      float *f = dest, *src;
 +      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;
 +      }
 +}
 +
 +static void layerInterp_shapekey(void **sources, float *weights,
 +                             float *UNUSED(sub_weights), int count, void *dest)
 +{
 +      float *co = dest, *src;
 +      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;
 +      }
 +}
  
++/* note, these numbered comments below are copied from trunk,
++ * while _most_ match, some at the end need adding and are out of sync */
  static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
+       /* 0: CD_MVERT */
        {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 1: CD_MSTICKY */
        {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
         NULL},
+       /* 2: CD_MDEFORMVERT */
        {sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert,
         layerFree_mdeformvert, layerInterp_mdeformvert, NULL, NULL},
+       /* 3: CD_MEDGE */
        {sizeof(MEdge), "MEdge", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 4: CD_MFACE */
        {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 5: CD_MTFACE */
        {sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL,
         layerInterp_tface, layerSwap_tface, layerDefault_tface},
+       /* 6: CD_MCOL */
        /* 4 MCol structs per face */
        {sizeof(MCol)*4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
+       /* 7: CD_ORIGINDEX */
        {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 8: CD_NORMAL */
        /* 3 floats per normal vector */
 -      {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 +      {sizeof(float)*3, "vec3f", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 9: CD_FLAGS */
        {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 -      {sizeof(MFloatProperty), "MFloatProperty",1,"Float",NULL,NULL,NULL,NULL},
+       /* 10: CD_PROP_FLT */
 -      {sizeof(MIntProperty), "MIntProperty",1,"Int",NULL,NULL,NULL,NULL},
 +      {sizeof(MFloatProperty), "MFloatProperty",1,"Float", layerCopy_propFloat,NULL,NULL,NULL},
+       /* 11: CD_PROP_INT */
 -      {sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL},
 +      {sizeof(MIntProperty), "MIntProperty",1,"Int",layerCopy_propInt,NULL,NULL,NULL},
+       /* 12: CD_PROP_STR */
 +      {sizeof(MStringProperty), "MStringProperty",1,"String",layerCopy_propString,NULL,NULL,NULL},
+       /* 13: CD_ORIGSPACE */
        {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
         layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
+       /* 14: CD_ORCO */
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 15: CD_MTEXPOLY */
        {sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL},
 -      {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL},
+       /* 16: CD_MLOOPUV */
 -      {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol},
 -      /* 18: CD_TANGENT */
 +      {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL,
 +       layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, 
 +       layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv},
+       /* 17: CD_MLOOPCOL */
 +      {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, 
 +       layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, 
 +       layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
        {sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 19: CD_MDISPS */
        {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
 -       layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, layerRead_mdisps, layerWrite_mdisps,
 -       layerFilesize_mdisps, layerValidate_mdisps},
 +       layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, 
 +       NULL, NULL, NULL, NULL, NULL, NULL, 
 +       layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps, layerValidate_mdisps},
+       /* 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},
 -      /* 22: CD_TEXTURE_MCOL */
 -      {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
 +      {sizeof(MCol)*4, "MCol", 4, "TextureCol", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
 -      /* 23: CD_CLOTH_ORCO */
 -      {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
 +      {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 +      {sizeof(float)*3, "", 0, "ShapeKey", NULL, NULL, layerInterp_shapekey},
 +      {sizeof(float), "", 0, "BevelWeight", NULL, NULL, layerInterp_bweight},
 +      {sizeof(float), "", 0, "SubSurfCrease", NULL, NULL, layerInterp_bweight},
 +      {sizeof(MLoopCol), "MLoopCol", 1, "WeightLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
 +       layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
 +       layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
  };
  
  static const char *LAYERTYPENAMES[CD_NUMTYPES] = {