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.
This commit is contained in:
Sergey Sharybin 2011-09-22 16:57:16 +00:00
parent 9ea32d34c4
commit 799afc1aa4
2 changed files with 13 additions and 4 deletions

@ -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) {

@ -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; i<newEdges; i++, ed++) {
ed->v1= 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; i<newFaces; i++, mf++) {
int eidx= new_edge_arr[i];
int fidx= edge_users[eidx];
@ -623,6 +627,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
add_v3_v3(edge_vert_nos[ed->v1], nor);
add_v3_v3(edge_vert_nos[ed->v2], nor);
#endif
origindex[numFaces * 2 + i]= ORIGINDEX_NONE;
}
#ifdef SOLIDIFY_SIDE_NORMALS