diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 5b317aebbf0..6943dcb3e5d 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -39,6 +39,7 @@ #define FACE_NEW 2 #define EDGE_MARK 4 #define EDGE_DONE 8 +#define FACE_OUT 16 void bmo_connect_verts_exec(BMesh *bm, BMOperator *op) { @@ -514,6 +515,8 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__); } else { + BMO_elem_flag_enable(bm, f, FACE_OUT); + l_iter = BM_FACE_FIRST_LOOP(f); if (l_1) BM_elem_attrs_copy(bm, bm, l_1, l_iter); l_iter = l_iter->next; @@ -525,6 +528,8 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) } } + BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_OUT); + cleanup: BLI_array_free(ee1); BLI_array_free(ee2); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 843a36cda35..92cc3366b3e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4802,19 +4802,32 @@ void MESH_OT_bevel(wmOperatorType *ot) static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) { + BMOperator bmop; Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); + const int use_merge = RNA_boolean_get(op->ptr, "use_merge"); + const float merge_factor = RNA_float_get(op->ptr, "merge_factor"); - if (!EDBM_op_callf(em, op, - "bridge_loops edges=%he use_merge=%b merge_factor=%f", - BM_ELEM_SELECT, RNA_boolean_get(op->ptr, "use_merge"), RNA_float_get(op->ptr, "merge_factor"))) - { - return OPERATOR_CANCELLED; - } - - EDBM_update_generic(C, em, TRUE); + EDBM_op_init(em, &bmop, op, + "bridge_loops edges=%he use_merge=%b merge_factor=%f", + BM_ELEM_SELECT, use_merge, merge_factor); - return OPERATOR_FINISHED; + BMO_op_exec(em->bm, &bmop); + + /* when merge is used the edges are joined and remain selected */ + if (use_merge == FALSE) { + EDBM_flag_disable_all(em, BM_ELEM_SELECT); + BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE); + } + + if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + return OPERATOR_CANCELLED; + + } + else { + EDBM_update_generic(C, em, TRUE); + return OPERATOR_FINISHED; + } } void MESH_OT_bridge_edge_loops(wmOperatorType *ot)