Fix #30337: missed Set Origin for Metaball

Implemented Set Origin operator for Meta Balls.
This commit is contained in:
2012-02-26 08:55:31 +00:00
parent 8285fef0e8
commit f268918d50
3 changed files with 80 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_group_types.h"
@@ -48,6 +49,7 @@
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -836,6 +838,27 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
break;
}
}
else if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
else if(around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
else { BKE_metaball_center_bounds(mb, cent); }
negate_v3_v3(cent_neg, cent);
BKE_metaball_translate(mb, cent_neg);
tot_change++;
mb->id.flag |= LIB_DOIT;
do_inverse_offset= TRUE;
if(obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
}
break;
}
}
/* offset other selected objects */
if(do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {