merge with 2.5 (not trunk, last merge message said that on accident) at r22252
[blender.git] / source / blender / editors / space_view3d / view3d_buttons.c
index 4b7f7ebed29ffde0d7c7c34242ad5c334c793609..f64954af6c3d82b79379d08225c7c1f2b4b5dcaa 100644 (file)
@@ -69,6 +69,7 @@
 #include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 
 #include "BIF_gl.h"
 
@@ -164,31 +165,30 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d,
 
        if(ob->type==OB_MESH) {
                Mesh *me= ob->data;
-               EditMesh *em = BKE_mesh_get_editmesh(me);
-               EditVert *eve, *evedef=NULL;
-               EditEdge *eed;
+               BMEditMesh *em = me->edit_btmesh;
+               BMesh *bm = em->bm;
+               BMVert *eve, *evedef=NULL;
+               BMEdge *eed;
+               BMIter iter;
                
-               eve= em->verts.first;
-               while(eve) {
-                       if(eve->f & SELECT) {
+               BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+                       if(BM_TestHFlag(eve, BM_SELECT)) {
                                evedef= eve;
                                tot++;
                                VecAddf(median, median, eve->co);
                        }
-                       eve= eve->next;
                }
-               eed= em->edges.first;
-               while(eed) {
-                       if((eed->f & SELECT)) {
+
+               BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
+                       if(BM_TestHFlag(eed, BM_SELECT)) {
                                totedge++;
                                median[3]+= eed->crease;
                        }
-                       eed= eed->next;
                }
 
                /* check for defgroups */
                if(evedef)
-                       dvert= CustomData_em_get(&em->vdata, evedef->data, CD_MDEFORMVERT);
+                       dvert= CustomData_bmesh_get(&em->bm->vdata, evedef->head.data, CD_MDEFORMVERT);
                if(tot==1 && dvert && dvert->totweight) {
                        bDeformGroup *dg;
                        int i, max=1, init=1;
@@ -212,8 +212,6 @@ static void v3d_editvertex_buts(const bContext *C, uiBlock *block, View3D *v3d,
                                tfp->defweightp= &dvert->dw[0].weight;
                        }
                }
-
-               BKE_mesh_end_editmesh(me, em);
        }
        else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
                Curve *cu= ob->data;