svn merge -r38000:38200 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender-staging.git] / source / blender / editors / transform / transform_manipulator.c
index d62227a122d7081ebc5efc36bd031206b32ef3a5..218e90af717b35f03a6c7a98ce2f105bc293a79c 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"
@@ -299,17 +300,29 @@ 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 {
+#if 1                  /* OLD CODE */
+                               /* do vertices for center, and if still no normal found, use vertex normals */
+                               BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
+                                       if(BM_TestHFlag(eve, BM_SELECT)) {
+                                               totsel++;
+                                               calc_tw_center(scene, eve->co);
+                                       }
+                               }
+
+#else                  // BMESH_TODO
                                /* do vertices/edges/faces for center depending on selection
                                   mode. note we can't use just vertex selection flag because
                                   it is not flush down on changes */
@@ -369,6 +382,7 @@ int calc_manipulator_stats(const bContext *C)
                                                }
                                        }
                                }
+#endif
                        }
                } /* end editmesh */
                else if (obedit->type==OB_ARMATURE){