diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-27 05:52:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-27 05:52:34 +0400 |
commit | 5256a5d66ceec9ad647d85e67a4057fa78217269 (patch) | |
tree | 2c768220043ba366d30abbc7f6945d5e69920359 /source/blender/bmesh | |
parent | bec7c8c7aa951dd98ee4a7c14a434a4d0ac02688 (diff) |
BMesh: let vert-connect make degenerate faces when only 2 verts selected
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_opdefines.c | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_connect.c | 9 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_connect_pair.c | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index b50e08404b0..305ae5283b0 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -875,6 +875,7 @@ static BMOpDefine bmo_connect_verts_def = { "connect_verts", /* slots_in */ {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, + {"check_degenerate", BMO_OP_SLOT_BOOL}, /* prevent splits with overlaps & intersections */ {{'\0'}}, }, /* slots_out */ diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 315a644d90f..89969640320 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -39,7 +39,7 @@ #define EDGE_OUT 1 #define FACE_TAG 2 -static int bm_face_connect_verts(BMesh *bm, BMFace *f) +static int bm_face_connect_verts(BMesh *bm, BMFace *f, const bool check_degenerate) { BMLoop *(*loops_split)[2] = BLI_array_alloca(loops_split, f->len); STACK_DECLARE(loops_split); @@ -82,7 +82,9 @@ static int bm_face_connect_verts(BMesh *bm, BMFace *f) l_pair[1] = loops_split[0][0]; } - BM_face_legal_splits(f, loops_split, STACK_SIZE(loops_split)); + if (check_degenerate) { + BM_face_legal_splits(f, loops_split, STACK_SIZE(loops_split)); + } for (i = 0; i < STACK_SIZE(loops_split); i++) { BMVert **v_pair; @@ -128,6 +130,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op) BMIter iter; BMVert *v; BMFace *f; + const bool check_degenerate = BMO_slot_bool_get(op->slots_in, "check_degenerate"); BLI_LINKSTACK_DECLARE(faces, BMFace *); BLI_LINKSTACK_INIT(faces); @@ -147,7 +150,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op) /* connect faces */ while ((f = BLI_LINKSTACK_POP(faces))) { - if (bm_face_connect_verts(bm, f) == -1) { + if (bm_face_connect_verts(bm, f, check_degenerate) == -1) { BMO_error_raise(bm, op, BMERR_CONNECTVERT_FAILED, NULL); } } diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c index 1b78a6b1dc7..b3d78f40b6f 100644 --- a/source/blender/bmesh/operators/bmo_connect_pair.c +++ b/source/blender/bmesh/operators/bmo_connect_pair.c @@ -529,6 +529,8 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op) #if 1 if (found_all) { + /* leave 'check_degenerate' off, if a user tries to cut with 2 verts, + * always connect even when resulting faces are degenerate [#39418] */ BMOperator op_sub; BMO_op_initf(bm, &op_sub, 0, "connect_verts verts=%fv", VERT_OUT); |