merge with trunk/2.5 at r24378
[blender-staging.git] / source / blender / editors / space_view3d / view3d_buttons.c
index 8c0eff4902072dc086d5efd4ad603abcc38e5d28..25ddb64a6d1ea5c2bcf461c140676e85f8576d45 100644 (file)
@@ -70,6 +70,7 @@
 #include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 
 #include "BIF_gl.h"
 
@@ -167,31 +168,30 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, 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;
@@ -215,8 +215,6 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, 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;
@@ -592,7 +590,7 @@ static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo
        }
 //     row= uiLayoutRow(layout, 0);
        
-       RNA_pointer_create(&ob->id, &RNA_PoseChannel, pchan, &pchanptr);
+               RNA_pointer_create(&ob->id, &RNA_PoseChannel, pchan, &pchanptr);
 
        col= uiLayoutColumn(layout, 0);
        
@@ -726,10 +724,10 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim)
 //     row= uiLayoutRow(layout, 0);
 
        RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr);
-       
+               
        col= uiLayoutColumn(layout, 0);
        uiItemR(col, "Location", 0, &ptr, "location", 0);
-       
+               
        uiItemR(col, "Radius", 0, &ptr, "radius", 0);
        uiItemR(col, "Stiffness", 0, &ptr, "stiffness", 0);
        
@@ -790,7 +788,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                break;
 
-       
+                               
        case B_OBJECTPANELMEDIAN:
                if(ob) {
                        v3d_editvertex_buts(C, NULL, v3d, ob, 1.0);
@@ -1089,7 +1087,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
        else {
 
                v3d_transform_butsR(col, &obptr);
-       }
+               }
 }
 
 #if 0