diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-07 07:58:23 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-07 07:58:23 +0400 |
commit | 0c7487d1ebe35d3221e129252835667892e5a8a4 (patch) | |
tree | b622dc751def37b1a52930c719d8af0e0daf2cba /source/blender/bmesh/operators/bmo_edgesplit.c | |
parent | 4fe4cfdb88c83dc2d41dacb201b8a8212efc5c07 (diff) |
re: edge split with edges only connected to 2 faces (with no other faces around the verts)
turns out old code also had the same bug (just coincidance it was noticed after my change)
now boundry verts are tagged so edges connected to them are not seen is missing a tagged, adjacent edge.
this fixes [#30471]
Diffstat (limited to 'source/blender/bmesh/operators/bmo_edgesplit.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_edgesplit.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c index a390313ed36..8af80a184c0 100644 --- a/source/blender/bmesh/operators/bmo_edgesplit.c +++ b/source/blender/bmesh/operators/bmo_edgesplit.c @@ -223,7 +223,7 @@ void bmo_edgesplit_exec(BMesh *bm, BMOperator *op) BMFace *f, *f2; BMLoop *l, *l2, *l3; BMLoop *l_next, *l_prev; - BMEdge *e, *e2; + BMEdge *e; BMVert *v, *v2; /* face/vert aligned vert array */ @@ -236,23 +236,41 @@ void bmo_edgesplit_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_SEAM, BM_EDGE); - /* single marked edges unconnected to any other marked edges - * are illegal, go through and unmark them */ - BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { - for (i = 0; i < 2; i++) { - BM_ITER(e2, &iter, bm, BM_EDGES_OF_VERT, i ? e->v2 : e->v1) { - if (e != e2 && BMO_elem_flag_test(bm, e2, EDGE_SEAM)) { - break; - } - } - if (e2) { - break; + /* untag edges not connected to other tagged edges */ + { + unsigned char *vtouch; + unsigned char *vt; + + BM_mesh_elem_index_ensure(bm, BM_VERT); + + vtouch = MEM_callocN(sizeof(char) * bm->totvert, __func__); + + /* tag all boundry verts so as not to untag an edge which is inbetween only 2 faces [] */ + BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + if (BM_edge_is_boundary(e)) { + vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++; + vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++; } } - if (!e2) { - BMO_elem_flag_disable(bm, e, EDGE_SEAM); + /* single marked edges unconnected to any other marked edges + * are illegal, go through and unmark them */ + BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { + /* lame, but we dont want the count to exceed 255, + * so just count to 2, its all we need */ + unsigned char *vt; + vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++; + vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++; } + BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { + if (vtouch[BM_elem_index_get(e->v1)] == 1 && + vtouch[BM_elem_index_get(e->v2)] == 1) + { + BMO_elem_flag_disable(bm, e, EDGE_SEAM); + } + } + + MEM_freeN(vtouch); } etags = MEM_callocN(sizeof(EdgeTag) * bm->totedge, "EdgeTag"); |