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/editors/space_view3d/drawmesh.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/editors/space_view3d/drawmesh.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 7334afe7c69..a09dd84673a 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -668,48 +668,48 @@ static void update_tface_color_layer(DerivedMesh *dm) } } -static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index) +static DMDrawOption draw_tface_mapped__set_draw(void *userData, int origindex, int UNUSED(index)) { Mesh *me = ((drawTFace_userData *)userData)->me; /* array checked for NULL before calling */ - MPoly *mpoly = &me->mpoly[index]; + MPoly *mpoly = &me->mpoly[origindex]; - BLI_assert(index >= 0 && index < me->totpoly); + BLI_assert(origindex >= 0 && origindex < me->totpoly); if (mpoly->flag & ME_HIDE) { return DM_DRAW_OPTION_SKIP; } else { - MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[index] : NULL; + MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[origindex] : NULL; MTFace mtf = {{{0}}}; int matnr = mpoly->mat_nr; if (tpoly) { ME_MTEXFACE_CPY(&mtf, tpoly); } - + return draw_tface__set_draw(&mtf, (me->mloopcol != NULL), matnr); } } -static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index) +static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int origindex, int index) { drawEMTFMapped_userData *data = userData; BMEditMesh *em = data->em; BMFace *efa; - if (UNLIKELY(index >= em->bm->totface)) + if (UNLIKELY(origindex >= em->bm->totface)) return DM_DRAW_OPTION_NORMAL; - efa = BM_face_at_index(em->bm, index); + efa = BM_face_at_index(em->bm, origindex); if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { return DM_DRAW_OPTION_SKIP; } else { MTFace mtf = {{{0}}}; - int matnr = efa->mat_nr; + int matnr = (data->mf) ? data->mf[index].mat_nr : efa->mat_nr; if (data->has_mtface) { MTexPoly *tpoly = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); |