diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-06 20:04:13 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-06 20:04:13 +0300 |
commit | 53a3b64601d7725e9271885d236b01cdf07fb680 (patch) | |
tree | a7ae0d2135af664cba95a14e3a9592d12538b1e0 /source/blender/blenkernel/intern | |
parent | d3afaa20be10a3bac7c9019e067af947a2e8d5b3 (diff) |
Fix part of #20468: material changes when switch to sculpt mode.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 14 |
2 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 61f8ac09fb7..6ebd28833c5 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -414,15 +414,17 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, } if(cddm->pbvh) { - float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL); + if(dm->numFaceData) { + float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL); - /* should be per face */ - if(dm->numFaceData && mface->flag & ME_SMOOTH) - glShadeModel(GL_SMOOTH); - - BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors); + /* should be per face */ + if(!setMaterial(mface->mat_nr+1, NULL)) + return; - glShadeModel(GL_FLAT); + glShadeModel((mface->flag & ME_SMOOTH)? GL_SMOOTH: GL_FLAT); + BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors); + glShadeModel(GL_FLAT); + } return; } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 445fc23b069..2ad17b7d0b9 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1240,13 +1240,15 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes) MEM_freeN(faces); } - /* should be per face */ - if(faceFlags && faceFlags[0] & ME_SMOOTH) - glShadeModel(GL_SMOOTH); + if(dm->numFaceData) { + /* should be per face */ + if(!setMaterial(faceFlags[1], NULL)) + return; - BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL); - - glShadeModel(GL_FLAT); + glShadeModel((faceFlags[0] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT); + BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL); + glShadeModel(GL_FLAT); + } return; } |