2.5: weight paint mode fix for corrupted layer data, and added

a customdata layer specifically to store weightpaint colors
instead of abusing the vertex colors layers.
This commit is contained in:
2009-04-02 14:38:40 +00:00
parent 4bb41c3dcd
commit e9ad9f894e
5 changed files with 123 additions and 135 deletions

View File

@@ -482,10 +482,14 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
MVert *mv = cddm->mvert;
MFace *mf = cddm->mface;
MCol *mc = DM_get_face_data_layer(dm, CD_MCOL);
MCol *mc;
float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
mc = DM_get_face_data_layer(dm, CD_WEIGHT_MCOL);
if(!mc)
mc = DM_get_face_data_layer(dm, CD_MCOL);
for(i = 0; i < dm->numFaceData; i++, mf++) {
int drawSmooth = (mf->flag & ME_SMOOTH);
@@ -926,13 +930,6 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob)
index = CustomData_get_layer(&dm->faceData, CD_ORIGINDEX);
for(i = 0; i < mesh->totface; ++i, ++index)
*index = i;
/* works in conjunction with hack during modifier calc, where active mcol
layer with weight paint colors is temporarily added */
/* XXX make this real but temporary layer */
// if ((G.f & G_WEIGHTPAINT) &&
// (ob && ob==(scene->basact?scene->basact->object:NULL)))
// CustomData_duplicate_referenced_layer(&dm->faceData, CD_MCOL);
return dm;
}