Cleanup: de-duplicate active item center access
[blender.git] / source / blender / editors / object / object_edit.c
index efbea1ee30ede6c9035ac2ae7b3c34379c242228..c745a13087df61620ca8124417c266a6be252c15 100644 (file)
@@ -1766,68 +1766,6 @@ void OBJECT_OT_mode_set_or_submode(wmOperatorType *ot)
        RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
-bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_only, float r_center[3])
-{
-       switch (obedit->type) {
-               case OB_MESH:
-               {
-                       BMEditMesh *em = BKE_editmesh_from_object(obedit);
-                       BMEditSelection ese;
-
-                       if (BM_select_history_active_get(em->bm, &ese)) {
-                               BM_editselection_center(&ese, r_center);
-                               return true;
-                       }
-                       break;
-               }
-               case OB_ARMATURE:
-               {
-                       bArmature *arm = obedit->data;
-                       EditBone *ebo = arm->act_edbone;
-
-                       if (ebo && (!select_only || (ebo->flag & (BONE_SELECTED | BONE_ROOTSEL)))) {
-                               copy_v3_v3(r_center, ebo->head);
-                               return true;
-                       }
-
-                       break;
-               }
-               case OB_CURVE:
-               case OB_SURF:
-               {
-                       Curve *cu = obedit->data;
-
-                       if (ED_curve_active_center(cu, r_center)) {
-                               return true;
-                       }
-                       break;
-               }
-               case OB_MBALL:
-               {
-                       MetaBall *mb = obedit->data;
-                       MetaElem *ml_act = mb->lastelem;
-
-                       if (ml_act && (!select_only || (ml_act->flag & SELECT))) {
-                               copy_v3_v3(r_center, &ml_act->x);
-                               return true;
-                       }
-                       break;
-               }
-               case OB_LATTICE:
-               {
-                       BPoint *actbp = BKE_lattice_active_point_get(obedit->data);
-
-                       if (actbp) {
-                               copy_v3_v3(r_center, actbp->vec);
-                               return true;
-                       }
-                       break;
-               }
-       }
-
-       return false;
-}
-
 static bool move_to_collection_poll(bContext *C)
 {
        if (CTX_wm_space_outliner(C) != NULL) {