Fix error introduced by removing faces before executing bridge

Commit 86abddc9, caused an error when the face-region included boundary edges.
Since removing the faces first, caused the edges along the boundaries to be removed.

Add support for deleting faces and internal edges, that keeps boundaries.
This commit is contained in:
Campbell Barton
2016-05-09 16:20:28 +10:00
parent 69be8d7cbd
commit e0e7d94f79
3 changed files with 14 additions and 1 deletions

View File

@@ -161,6 +161,7 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
break; break;
} }
case DEL_FACES: case DEL_FACES:
case DEL_FACES_KEEP_BOUNDARY:
{ {
/* go through and mark all edges and all verts of all faces for delete */ /* go through and mark all edges and all verts of all faces for delete */
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
@@ -190,11 +191,20 @@ void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type)
} }
/* also mark all the vertices of remaining edges for keeping */ /* also mark all the vertices of remaining edges for keeping */
BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
/* Only exception to normal 'DEL_FACES' logic. */
if (type == DEL_FACES_KEEP_BOUNDARY) {
if (BM_edge_is_boundary(e)) {
BMO_elem_flag_disable(bm, e, oflag);
}
}
if (!BMO_elem_flag_test(bm, e, oflag)) { if (!BMO_elem_flag_test(bm, e, oflag)) {
BMO_elem_flag_disable(bm, e->v1, oflag); BMO_elem_flag_disable(bm, e->v1, oflag);
BMO_elem_flag_disable(bm, e->v2, oflag); BMO_elem_flag_disable(bm, e->v2, oflag);
} }
} }
/* now delete marked face */ /* now delete marked face */
bmo_remove_tagged_faces(bm, oflag); bmo_remove_tagged_faces(bm, oflag);
/* delete marked edge */ /* delete marked edge */

View File

@@ -285,6 +285,9 @@ enum {
DEL_ONLYFACES, DEL_ONLYFACES,
DEL_EDGESFACES, DEL_EDGESFACES,
DEL_FACES, DEL_FACES,
/* A version of 'DEL_FACES' that keeps edges on face boundaries,
* allowing the surrounding edge-loop to be kept from removed face regions. */
DEL_FACES_KEEP_BOUNDARY,
DEL_ONLYTAGGED DEL_ONLYTAGGED
}; };

View File

@@ -5133,7 +5133,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
} }
BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
"delete geom=%hf context=%i", "delete geom=%hf context=%i",
BM_ELEM_TAG, DEL_FACES); BM_ELEM_TAG, DEL_FACES_KEEP_BOUNDARY);
} }
BMO_op_exec(em->bm, &bmop); BMO_op_exec(em->bm, &bmop);