mesh bridge tool now leaves bridge faces selected.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 24 Aug 2012 17:58:49 +0000 (17:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 24 Aug 2012 17:58:49 +0000 (17:58 +0000)
source/blender/bmesh/operators/bmo_connect.c
source/blender/editors/mesh/editmesh_tools.c

index 5b317aebbf03b4fb50fd91ba758548ba744590e9..6943dcb3e5d1f1054c0a6bcde1ccffe515fa8132 100644 (file)
@@ -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);
index 843a36cda35d84ad711fa3472f559ebd5e50c419..92cc3366b3e2d733b76245ca7db8d17c57eed035 100644 (file)
@@ -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_op_init(em, &bmop, op,
+                    "bridge_loops edges=%he use_merge=%b merge_factor=%f",
+                    BM_ELEM_SELECT, use_merge, merge_factor);
+
+       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);
        }
-       
-       EDBM_update_generic(C, em, TRUE);
 
-       return OPERATOR_FINISHED;
+       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)