diff options
-rw-r--r-- | source/blender/blenkernel/intern/subsurf.c | 34 | ||||
-rw-r--r-- | source/blender/include/editmesh.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 30 | ||||
-rw-r--r-- | source/blender/src/editmesh.c | 10 | ||||
-rw-r--r-- | source/blender/src/editmesh_lib.c | 22 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 22 |
6 files changed, 67 insertions, 52 deletions
diff --git a/source/blender/blenkernel/intern/subsurf.c b/source/blender/blenkernel/intern/subsurf.c index 0b490ff645f..280af7c4a53 100644 --- a/source/blender/blenkernel/intern/subsurf.c +++ b/source/blender/blenkernel/intern/subsurf.c @@ -430,6 +430,12 @@ static HyperMesh *hypermesh_from_editmesh(EditMesh *em, int subdivLevels) { float creasefac= (float)subdivLevels; int flag; + /* hide flags rule: + - face hidden, not do. is easy + - edge hidden, always means face is hidden too + - vertex hidden, always means edge is hidden too + */ + /* we only add vertices with edges, 'f1' is a free flag */ /* added: check for hide flag in vertices */ for (ev= em->verts.first; ev; ev= ev->next) { @@ -462,22 +468,18 @@ static HyperMesh *hypermesh_from_editmesh(EditMesh *em, int subdivLevels) { } for (ef= em->faces.first; ef; ef= ef->next) { if(ef->h==0) { - // this extra check needed, hide flags can be inconsistant - if((ef->e1->h & 1) || (ef->e2->h & 1) || (ef->e3->h & 1) || (ef->e4 && (ef->e4->h & 1))); - else { - int nverts= ef->v4?4:3; - HyperVert *verts[4]; - HyperFace *f; - - verts[0]= (HyperVert*) ef->v1->prev; - verts[1]= (HyperVert*) ef->v2->prev; - verts[2]= (HyperVert*) ef->v3->prev; - if (nverts>3) - verts[3]= (HyperVert*) ef->v4->prev; - - f= hypermesh_add_face(hme, verts, nverts, DR_OPTIM); - f->orig.ef= ef; - } + int nverts= ef->v4?4:3; + HyperVert *verts[4]; + HyperFace *f; + + verts[0]= (HyperVert*) ef->v1->prev; + verts[1]= (HyperVert*) ef->v2->prev; + verts[2]= (HyperVert*) ef->v3->prev; + if (nverts>3) + verts[3]= (HyperVert*) ef->v4->prev; + + f= hypermesh_add_face(hme, verts, nverts, DR_OPTIM); + f->orig.ef= ef; } } diff --git a/source/blender/include/editmesh.h b/source/blender/include/editmesh.h index 7ba5da6e7d6..a8aed93b2bd 100644 --- a/source/blender/include/editmesh.h +++ b/source/blender/include/editmesh.h @@ -63,6 +63,7 @@ extern struct EditEdge *findedgelist(struct EditVert *v1, struct EditVert *v2); /* ******************* editmesh_lib.c */ extern void EM_fgon_flags(void); +extern void EM_hide_reset(void); extern int faceselectedOR(EditFace *efa, int flag); extern int faceselectedAND(EditFace *efa, int flag); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 385b910e9b4..f2168599079 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1030,14 +1030,14 @@ void calc_meshverts_ext_f2(void) EditVert *eve; float mat[4][4]; + if(em->verts.first==0) return; + eve= em->verts.first; + /* matrices */ areawinset(curarea->win); persp(PERSP_VIEW); mymultmatrix(G.obedit->obmat); - if(em->verts.first==0) return; - eve= em->verts.first; - MTC_Mat4SwapMat4(G.vd->persmat, mat); mygetsingmatrix(G.vd->persmat); @@ -2484,19 +2484,17 @@ static void draw_static_particle_system(Object *ob, PartEff *paf) static void glVertex_efa_edges(EditFace *efa) { - if(efa->e1->h==0) { - glVertex3fv(efa->v1->co); - glVertex3fv(efa->v2->co); - } - if(efa->e2->h==0) { - glVertex3fv(efa->v2->co); - glVertex3fv(efa->v3->co); - } - if(efa->e3->h==0) { - glVertex3fv(efa->e3->v1->co); - glVertex3fv(efa->e3->v2->co); - } - if(efa->e4 && efa->e4->h==0) { + + glVertex3fv(efa->v1->co); + glVertex3fv(efa->v2->co); + + glVertex3fv(efa->v2->co); + glVertex3fv(efa->v3->co); + + glVertex3fv(efa->e3->v1->co); + glVertex3fv(efa->e3->v2->co); + + if(efa->e4) { glVertex3fv(efa->e4->v1->co); glVertex3fv(efa->e4->v2->co); } diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index fc22e6b8466..9c9e9a83407 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -777,15 +777,17 @@ void make_editMesh() end_editmesh_fastmalloc(); // resets global function pointers - if (mesh_uses_displist(me)) - makeDispList(G.obedit); - /* this creates coherent selections. also needed for older files */ EM_selectmode_set(); - + /* paranoia check to enforce hide rules */ + EM_hide_reset(); + /* sets helper flags which arent saved */ EM_fgon_flags(); + countall(); + if (mesh_uses_displist(me)) makeDispList(G.obedit); + waitcursor(0); } diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c index d3e6314d154..7b718109085 100644 --- a/source/blender/src/editmesh_lib.c +++ b/source/blender/src/editmesh_lib.c @@ -302,15 +302,37 @@ void EM_selectmode_set(void) if(eed->f & SELECT) EM_select_edge(eed, 1); /* selects faces based on edge status */ EM_selectmode_flush(); + } else if(G.scene->selectmode == SCE_SELECT_FACE) { /* deselect eges, and select again based on face select */ for(eed= em->edges.first; eed; eed= eed->next) EM_select_edge(eed, 0); + for(efa= em->faces.first; efa; efa= efa->next) if(efa->f & SELECT) EM_select_face(efa, 1); } } +/* paranoia check, actually only for entering editmode. rule: +- vertex hidden, always means edge is hidden too +- edge hidden, always means face is hidden too +- face hidden, dont change anything +*/ +void EM_hide_reset(void) +{ + EditMesh *em = G.editMesh; + EditEdge *eed; + EditFace *efa; + + for(eed= em->edges.first; eed; eed= eed->next) + if(eed->v1->h || eed->v2->h) eed->h |= 1; + + for(efa= em->faces.first; efa; efa= efa->next) + if((efa->e1->h & 1) || (efa->e2->h & 1) || (efa->e3->h & 1) || (efa->e4 && (efa->e4->h & 1))) + efa->h= 1; + +} + /* ******** EXTRUDE ********* */ diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 89227db1af4..4b776e7fbaf 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -713,8 +713,11 @@ void hide_mesh(int swap) if(G.obedit==0) return; - /* hide happens on least dominant select mode */ - + /* hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */ + /* - vertex hidden, always means edge is hidden too + - edge hidden, always means face is hidden too + - face hidden, only set face hide + */ if(G.scene->selectmode & SCE_SELECT_VERTEX) { for(eve= em->verts.first; eve; eve= eve->next) { if((eve->f & SELECT)!=swap) { @@ -729,15 +732,13 @@ void hide_mesh(int swap) eed->h |= 1; eed->f &= ~SELECT; } - else eed->h= 0; } for(efa= em->faces.first; efa; efa= efa->next) { - if(efa->v1->h || efa->v2->h || efa->v3->h || (efa->v4 && efa->v4->h)) { + if(efa->e1->h || efa->e2->h || efa->e3->h || (efa->e4 && efa->e4->h)) { efa->h= 1; efa->f &= ~SELECT; } - else efa->h= 0; } } else if(G.scene->selectmode & SCE_SELECT_EDGE) { @@ -745,7 +746,6 @@ void hide_mesh(int swap) for(eed= em->edges.first; eed; eed= eed->next) { if((eed->f & SELECT)!=swap) { eed->h |= 1; - eed->v1->h= eed->v2->h= 1; EM_select_edge(eed, 0); } } @@ -755,7 +755,6 @@ void hide_mesh(int swap) efa->h= 1; efa->f &= ~SELECT; } - else efa->h= 0; } } else { @@ -763,15 +762,6 @@ void hide_mesh(int swap) for(efa= em->faces.first; efa; efa= efa->next) { if((efa->f & SELECT)!=swap) { efa->h= 1; - - efa->e1->h |= 1; - efa->e2->h |= 1; - efa->e3->h |= 1; - if(efa->e4) efa->e4->h |= 1; - - efa->v1->h= efa->v2->h= efa->v3->h= 1; - if(efa->v4) efa->v4->h= 1; - EM_select_face(efa, 0); } } |