diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-11-27 21:12:48 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-11-27 21:19:55 +0300 |
commit | 2e8ba179f71131779899df5a916252922f029e43 (patch) | |
tree | f6c359f8420c84f0bdde7657d88ee734276e8f9c /source/blender/blenkernel/intern/cdderivedmesh.c | |
parent | 3d3f82a8df8cd0ec0ac873e1a56a7dc7c4751ba9 (diff) |
Fix T42653, solidify modifier not displaying correctly under edit mode.
Basically, our drawing code assumed we always use the edit mesh
materials, which can be different from the derived mesh
materials in modifiers doing overrides. We usually we want to use the
derived mesh when it is available instead.
There are two fixes here for both solid and textured mode. Unfortunately
the fixes do not help to make the display code less labyrinthian but I
expect this "should work" (tm and famous last words)
Solid mode fix is 95% from Bastien, thanks!
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index bfc70c91181..52261714ab1 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -667,7 +667,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, static void cdDM_drawFacesTex_common(DerivedMesh *dm, DMSetDrawOptionsTex drawParams, - DMSetDrawOptions drawParamsMapped, + DMSetDrawOptionsMappedTex drawParamsMapped, DMCompareDrawOptions compareDrawOptions, void *userData, DMDrawFlag uvflag) { @@ -759,7 +759,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, draw_option = DM_DRAW_OPTION_NORMAL; } else if (drawParamsMapped) { - draw_option = drawParamsMapped(userData, orig); + draw_option = drawParamsMapped(userData, orig, i); } else { if (nors) { @@ -769,7 +769,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, } } else if (drawParamsMapped) { - draw_option = drawParamsMapped(userData, i); + draw_option = drawParamsMapped(userData, i, i); } else { if (nors) { @@ -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); + draw_option = drawParamsMapped(userData, orig, actualFace); } } else if (drawParamsMapped) { - draw_option = drawParamsMapped(userData, actualFace); + draw_option = drawParamsMapped(userData, actualFace, actualFace); } } @@ -1089,6 +1089,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, else { /* we need to check if the next material changes */ int next_actualFace = dm->drawObject->triangle_to_mface[0]; + int prev_mat_nr = -1; for (i = 0; i < tottri; i++) { //int actualFace = dm->drawObject->triangle_to_mface[i]; @@ -1103,9 +1104,14 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, orig = (index_mf_to_mpoly) ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, actualFace) : actualFace; - if (orig == ORIGINDEX_NONE) - draw_option = setMaterial(mface->mat_nr + 1, NULL); - else if (setDrawOptions != NULL) + if (mface->mat_nr != prev_mat_nr) { + if (setMaterial) + draw_option = setMaterial(mface->mat_nr + 1, NULL); + + prev_mat_nr = mface->mat_nr; + } + + if (setDrawOptions != NULL && (orig != ORIGINDEX_NONE)) draw_option = setDrawOptions(userData, orig); if (draw_option == DM_DRAW_OPTION_STIPPLE) { @@ -1150,7 +1156,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, } static void cdDM_drawMappedFacesTex(DerivedMesh *dm, - DMSetDrawOptions setDrawOptions, + DMSetDrawOptionsMappedTex setDrawOptions, DMCompareDrawOptions compareDrawOptions, void *userData, DMDrawFlag flag) { |