switch arg order for BM_face_other_* funcs (make face come first), and add nice ascii...
[blender.git] / source / blender / editors / mesh / loopcut.c
index 59861d674f286f82b23fc841b74539c17d69b07b..bbc495706ac621340afae08cd93da3e7f7f75db5 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "DNA_ID.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_userdef_types.h"
@@ -50,7 +51,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_dynstr.h" /*for WM_operator_pystring */
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_blender.h"
@@ -133,8 +133,8 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
        }
 }
 
-/*given two opposite edges in a face, finds the ordering of their vertices so
-  that cut preview lines won't cross each other*/
+/* given two opposite edges in a face, finds the ordering of their vertices so
* that cut preview lines won't cross each other*/
 static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed, 
                                 BMVert *lastv1, BMVert *v[2][2])
 {
@@ -161,7 +161,7 @@ static void edgering_find_order(BMEditMesh *em, BMEdge *lasteed, BMEdge *eed,
                return;
        }
        
-       l2 = BM_face_other_loop(l->e, l->f, eed->v1);
+       l2 = BM_face_other_loop(l->f, l->e, eed->v1);
        rev = (l2 == l->prev);
        while (l2->v != lasteed->v1 && l2->v != lasteed->v2) {
                l2 = rev ? l2->prev : l2->next;
@@ -255,7 +255,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
                lasteed = eed;
        }
        
-       if (lasteed != startedge && BM_edge_share_faces(lasteed, startedge)) {
+       if (lasteed != startedge && BM_edge_share_face_count(lasteed, startedge)) {
                v[1][0] = v[0][0];
                v[1][1] = v[0][1];
 
@@ -308,9 +308,9 @@ static void ringsel_finish(bContext *C, wmOperator *op)
                edgering_sel(lcd, cuts, 1);
                
                if (lcd->do_cut) {
-                       BM_mesh_esubdivideflag(lcd->ob, em->bm, BM_ELEM_SELECT, 0.0f, 
-                                         0.0f, 0, cuts, SUBDIV_SELECT_LOOPCUT, 
-                                         SUBD_PATH, 0, 0, 0);
+                       BM_mesh_esubdivideflag(lcd->ob, em->bm, BM_ELEM_SELECT, 0.0f,
+                                              0.0f, 0, cuts, SUBDIV_SELECT_LOOPCUT,
+                                              SUBD_PATH, 0, FALSE, 0);
                        
                        /* force edge slide to edge select mode in in face select mode */
                        if (em->selectmode & SCE_SELECT_FACE) {
@@ -373,7 +373,7 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
        lcd->ar= CTX_wm_region(C);
        lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
        lcd->ob = CTX_data_edit_object(C);
-       lcd->em= ((Mesh *)lcd->ob->data)->edit_btmesh;
+       lcd->em = BMEdit_FromObject(lcd->ob);
        lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend");
        lcd->do_cut = do_cut;
        
@@ -395,56 +395,6 @@ static int ringcut_cancel (bContext *C, wmOperator *op)
        return OPERATOR_CANCELLED;
 }
 
-/* for bmesh this tool is in bmesh_select.c */
-#if 0
-
-static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
-{
-       tringselOpData *lcd;
-       EditEdge *edge;
-       int dist = 75;
-       
-       view3d_operator_needs_opengl(C);
-
-       if (!ringsel_init(C, op, 0))
-               return OPERATOR_CANCELLED;
-       
-       lcd = op->customdata;
-       
-       if (lcd->em->selectmode == SCE_SELECT_FACE) {
-               PointerRNA props_ptr;
-               int extend = RNA_boolean_get(op->ptr, "extend");
-
-               ringsel_exit(op);
-
-               WM_operator_properties_create(&props_ptr, "MESH_OT_loop_select");
-               RNA_boolean_set(&props_ptr, "extend", extend);
-               WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, &props_ptr);
-               WM_operator_properties_free(&props_ptr);
-
-               return OPERATOR_CANCELLED;
-       }
-
-       lcd->vc.mval[0] = evt->mval[0];
-       lcd->vc.mval[1] = evt->mval[1];
-       
-       edge = findnearestedge(&lcd->vc, &dist);
-       if(!edge) {
-               ringsel_exit(op);
-               return OPERATOR_CANCELLED;
-       }
-
-       lcd->eed = edge;
-       ringsel_find_edge(lcd, 1);
-
-       ringsel_finish(C, op);
-       ringsel_exit(op);
-
-       return OPERATOR_FINISHED;
-}
-
-#endif
-
 static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
 {
        Object *obedit= CTX_data_edit_object(C);