=bmesh= merge from trunk at r36529
[blender.git] / source / blender / editors / transform / transform_manipulator.c
index 2fa094c6b8b78969c1ff1517cdf149cb18fea606..8cd6785b6c49a9ebd28794234f76218a9809c8af 100644 (file)
@@ -61,6 +61,7 @@
 #include "BKE_mesh.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
+#include "BKE_tessmesh.h"
 
 #include "BLI_math.h"
 #include "BLI_editVert.h"
@@ -298,20 +299,22 @@ int calc_manipulator_stats(const bContext *C)
                if((ob->lay & v3d->lay)==0) return 0;
 
                if(obedit->type==OB_MESH) {
-                       EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
-                       EditVert *eve;
-                       EditSelection ese;
+                       BMEditMesh *em = ((Mesh*)obedit->data)->edit_btmesh;
+                       BMesh *bm = em->bm;
+                       BMVert *eve;
+                       BMEditSelection ese;
+                       BMIter iter;
                        float vec[3]= {0,0,0};
 
                        /* USE LAST SELECTE WITH ACTIVE */
-                       if (v3d->around==V3D_ACTIVE && EM_get_actSelection(em, &ese)) {
-                               EM_editselection_center(vec, &ese);
+                       if (v3d->around==V3D_ACTIVE && EDBM_get_actSelection(em, &ese)) {
+                               EDBM_editselection_center(em, vec, &ese);
                                calc_tw_center(scene, vec);
                                totsel= 1;
                        } else {
                                /* do vertices for center, and if still no normal found, use vertex normals */
-                               for(eve= em->verts.first; eve; eve= eve->next) {
-                                       if(eve->f & SELECT) {
+                               BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+                                       if(BM_TestHFlag(eve, BM_SELECT)) {
                                                totsel++;
                                                calc_tw_center(scene, eve->co);
                                        }
@@ -508,7 +511,7 @@ int calc_manipulator_stats(const bContext *C)
 
                case V3D_MANIP_GIMBAL:
                {
-                       float mat[3][3];
+                               float mat[3][3];
                        if (gimbal_axis(ob, mat)) {
                                copy_m4_m3(rv3d->twmat, mat);
                                break;
@@ -520,8 +523,8 @@ int calc_manipulator_stats(const bContext *C)
                                float mat[3][3];
                                ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
                                copy_m4_m3(rv3d->twmat, mat);
-                               break;
-                       }
+                                               break;
+                                               }
                        /* no break we define 'normal' as 'local' in Object mode */
                case V3D_MANIP_LOCAL:
                        copy_m4_m4(rv3d->twmat, ob->obmat);
@@ -923,12 +926,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
                                        glBegin(GL_LINES);
                                        glVertex3f(0.0f, 0.0f, 0.2f);
                                        glVertex3f(0.0f, 0.0f, 1.0f);
-                                       glEnd();
+                               glEnd();
                                        postOrtho(ortho);
-                               }
                        }
                }
        }
+       }
 
        if(arcs==0 && moving) {