Fix #20393: subsurfed objects only allow a single material.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 15 Dec 2009 18:00:22 +0000 (18:00 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 15 Dec 2009 18:00:22 +0000 (18:00 +0000)
source/blender/blenkernel/intern/subsurf_ccg.c

index 793ea26a602371d16982f0cf7426e29c736f1ac7..072a665e0e949c92c8cc9b82639b314229df1fcf 100644 (file)
@@ -931,8 +931,8 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
        for(index = 0; index < totface; index++) {
                CCGFace *f = ccgdm->faceMap[index].face;
                int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
-               int mat_nr = 0;
-               int flag = ME_SMOOTH; /* assume face is smooth by default */
+               int flag = (faceFlags)? faceFlags[index*2]: ME_SMOOTH;
+               int mat_nr = (faceFlags)? faceFlags[index*2+1]: 0;
 
                for(S = 0; S < numVerts; S++) {
                        for(y = 0; y < gridSize - 1; y++) {
@@ -947,8 +947,7 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
                                        mf->v4 = getFaceIndex(ss, f, S, x + 1, y + 0,
                                                              edgeSize, gridSize);
                                        mf->mat_nr = mat_nr;
-                                       if(faceFlags) mf->flag = faceFlags[index*2];
-                                       else mf->flag = flag;
+                                       mf->flag = flag;
 
                                        i++;
                                }