diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-11-27 22:12:46 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-11-27 22:12:46 +0300 |
commit | f4f5f3b209e1f1309966ca007370225a06ef86fe (patch) | |
tree | 1e55a8070f13c4d4393c7d84f7bf33b9ab5058d5 /source/blender/blenkernel/intern | |
parent | 2e8ba179f71131779899df5a916252922f029e43 (diff) |
Addition/correction to previous commit:
subsurf needs the same modifications in its derived mesh function or
materials don't get updated at all anymore.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 52261714ab1..7f49fc60bde 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -880,11 +880,11 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, draw_option = DM_DRAW_OPTION_NORMAL; } else if (drawParamsMapped) { - draw_option = drawParamsMapped(userData, orig, actualFace); + draw_option = drawParamsMapped(userData, orig, mf[actualFace].mat_nr); } } else if (drawParamsMapped) { - draw_option = drawParamsMapped(userData, actualFace, actualFace); + draw_option = drawParamsMapped(userData, actualFace, mf[actualFace].mat_nr); } } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 482c046b638..455c254242a 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2361,7 +2361,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, if (drawParams) draw_option = drawParams(tf, (mcol != NULL), mat_nr); else if (index != ORIGINDEX_NONE) - draw_option = (drawParamsMapped) ? drawParamsMapped(userData, index, i) : DM_DRAW_OPTION_NORMAL; + draw_option = (drawParamsMapped) ? drawParamsMapped(userData, index, mat_nr) : DM_DRAW_OPTION_NORMAL; else draw_option = GPU_enable_material(mat_nr, NULL) ? DM_DRAW_OPTION_NORMAL : DM_DRAW_OPTION_SKIP; @@ -2586,6 +2586,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, DMFlagMat *faceFlags = ccgdm->faceFlags; int useColors = flag & DM_DRAW_USE_COLORS; int gridFaces = gridSize - 1, totface; + int prev_mat_nr = -1; CCG_key_top_level(&key, ss); @@ -2626,9 +2627,16 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, { DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL; - if (index == ORIGINDEX_NONE) - draw_option = setMaterial(faceFlags ? faceFlags[origIndex].mat_nr + 1 : 1, NULL); /* XXX, no faceFlags no material */ - else if (setDrawOptions) + if (setMaterial) { + int mat_nr = faceFlags ? faceFlags[origIndex].mat_nr + 1 : 1; + + if (mat_nr != prev_mat_nr) { + setMaterial(mat_nr, NULL); /* XXX, no faceFlags no material */ + prev_mat_nr = mat_nr; + } + } + + if (setDrawOptions && (index != ORIGINDEX_NONE)) draw_option = setDrawOptions(userData, index); if (draw_option != DM_DRAW_OPTION_SKIP) { |