diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-01 22:26:57 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-01 22:26:57 +0400 |
commit | b5332f293e7e07115118ee3aaef668f6f5abf910 (patch) | |
tree | 5d83f37c83fac662d37cb7b52735fd8d8a4d2861 /source/blender/editors/space_view3d/drawmesh.c | |
parent | c21f19374bfc140ad9b9ca59c22dd9ce6caf376c (diff) |
Fixed issue with multiple textures and editmode when VBOs are enabled
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 4fc9c1e2839..e83591b73f5 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -513,7 +513,7 @@ static int draw_tface_mapped__set_draw(void *userData, int index) static int draw_em_tf_mapped__set_draw(void *userData, int index) { - struct {EditMesh *em; short has_mcol; short has_mtface;} *data = userData; + struct {DerivedMesh *dm; EditMesh *em; short has_mcol; short has_mtface;} *data = userData; EditMesh *em = data->em; EditFace *efa= EM_get_face_for_index(index); MTFace *tface; @@ -644,6 +644,21 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index) return 1; } +static int compareDrawOptionsEm(void *userData, int cur_index, int next_index) +{ + struct {DerivedMesh *dm; EditMesh *em; short has_mcol; short has_mtface;} *data= userData; + MFace *mf = DM_get_face_data_layer(data->dm, CD_MFACE); + MTFace *tf = DM_get_face_data_layer(data->dm, CD_MTFACE); + + if(mf && mf[cur_index].mat_nr != mf[next_index].mat_nr) + return 0; + + if(tf && tf[cur_index].tpage != tf[next_index].tpage) + return 0; + + return 1; +} + void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) { Mesh *me= ob->data; @@ -658,13 +673,14 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec glColor4f(1.0f,1.0f,1.0f,1.0f); if(ob->mode & OB_MODE_EDIT) { - struct {EditMesh *em; short has_mcol; short has_mtface;} data; + struct {DerivedMesh *dm; EditMesh *em; short has_mcol; short has_mtface;} data; + data.dm = dm; data.em= me->edit_mesh; data.has_mcol= CustomData_has_layer(&me->edit_mesh->fdata, CD_MCOL); data.has_mtface= CustomData_has_layer(&me->edit_mesh->fdata, CD_MTFACE); - dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, NULL, &data); + dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data); } else if(draw_flags & DRAW_FACE_SELECT) { if(ob->mode & OB_MODE_WEIGHT_PAINT) |