diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-01 22:26:48 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-01 22:26:48 +0400 |
commit | c21f19374bfc140ad9b9ca59c22dd9ce6caf376c (patch) | |
tree | 778a5a4112945a1597c237b7e945a6cbf6204413 /source/blender/editors/space_view3d/drawmesh.c | |
parent | 9b931aa0dba5226c4ff770562c88fbd969f230fa (diff) |
Fixed crash caused by recent VBO's changes
Crash was caused by non-initialized original index passing to compareDrawOptions
callback. Due to in some cases it's enough to know indices of faces in final DM
(like for comparing if the same texture used for mesh drawing) assume this
callback receives index in final DM and if it's needed it will make conversion
to original index itself.
This should help reaching extra speed if textured object is affected by
bevel modifiers, i.e.
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 690694cb7d9..4fc9c1e2839 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -631,14 +631,14 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl) static int compareDrawOptions(void *userData, int cur_index, int next_index) { - Mesh *me= (Mesh*) userData; - MFace *mf= CustomData_get_layer(&me->fdata, CD_MFACE); - MTFace *tf= CustomData_get_layer(&me->fdata, CD_MTFACE); + DerivedMesh *dm= (DerivedMesh*) userData; + MFace *mf = DM_get_face_data_layer(dm, CD_MFACE); + MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); - if(mf[cur_index].mat_nr != mf[next_index].mat_nr) + if(mf && mf[cur_index].mat_nr != mf[next_index].mat_nr) return 0; - if(tf[cur_index].tpage != tf[next_index].tpage) + if(tf && tf[cur_index].tpage != tf[next_index].tpage) return 0; return 1; @@ -683,7 +683,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL)) add_tface_color_layer(dm); - dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, ob->data); + dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, dm); } } |