From 799afc1aa4bff22a6aed21a1cfe7da9e55d18a10 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Sep 2011 16:57:16 +0000 Subject: [PATCH] Fix #28226: Selection highlighting is wrong when Solidify Modifier is used Set origindices for edges/faces created for rim to ORIGINDEX_NONE. Also discovered error in recent editmode VBO fix -- it used to crash when comparing faces with ORIGINDEX_NONE original index. --- source/blender/blenkernel/intern/cdderivedmesh.c | 10 +++++++--- source/blender/modifiers/intern/MOD_solidify.c | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index e1939335268..afa310b0b80 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -981,9 +981,13 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us if(!flush && compareDrawOptions) { int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace]; - /* also compare draw options and flush buffer if they're different - need for face selection highlight in edit mode */ - flush|= compareDrawOptions(userData, orig, next_orig) == 0; + if(orig==ORIGINDEX_NONE || next_orig==ORIGINDEX_NONE) { + flush= 1; + } else { + /* also compare draw options and flush buffer if they're different + need for face selection highlight in edit mode */ + flush|= compareDrawOptions(userData, orig, next_orig) == 0; + } } if(flush) { diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index afe6da8b38a..757da28e4b5 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -524,7 +524,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if(smd->flag & MOD_SOLIDIFY_RIM) { - + int *origindex; /* bugger, need to re-calculate the normals for the new edge faces. * This could be done in many ways, but probably the quickest way is to calculate the average normals for side faces only. @@ -551,18 +551,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, {0, 3, 3, 0}}; /* add faces & edges */ + origindex= result->getEdgeDataArray(result, CD_ORIGINDEX); ed= medge + (numEdges * 2); for(i=0; iv1= new_vert_arr[i]; ed->v2= new_vert_arr[i] + numVerts; ed->flag |= ME_EDGEDRAW; + origindex[numEdges * 2 + i]= ORIGINDEX_NONE; + if(crease_rim) ed->crease= crease_rim; } /* faces */ mf= mface + (numFaces * 2); + origindex= result->getFaceDataArray(result, CD_ORIGINDEX); for(i=0; iv1], nor); add_v3_v3(edge_vert_nos[ed->v2], nor); #endif + origindex[numFaces * 2 + i]= ORIGINDEX_NONE; } #ifdef SOLIDIFY_SIDE_NORMALS