diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-28 22:19:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-28 22:19:55 +0400 |
commit | b6ffc681b1813ff0f13900a21b1c38d1055c0aef (patch) | |
tree | c7dab441ff53c8a591bd13d857ca278dd63ed206 /source/blender/editors/space_view3d/view3d_snap.c | |
parent | c776d5e003a956ddc0e11d36f99b8b242de941b7 (diff) |
view-selected didnt work for metaballs in object mode (radius from previous commit was 2x too large too).
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index b9d75b12333..1678487d8bf 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -54,6 +54,7 @@ #include "BKE_depsgraph.h" #include "BKE_lattice.h" #include "BKE_main.h" +#include "BKE_mball.h" #include "BKE_object.h" #include "BKE_editmesh.h" #include "BKE_DerivedMesh.h" @@ -1091,25 +1092,14 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) /* metaballs are an exception */ if (obedit->type == OB_MBALL) { - const float scale = mat4_to_scale(obedit->obmat); - MetaBall *mb = obedit->data; - MetaElem *ml; - bool change = false; + float ob_min[3], ob_max[3]; + bool change; - for (ml = mb->elems.first; ml; ml = ml->next) { - if (ml->flag & SELECT) { - const float scale_mb = ml->rad * scale; - int i; - mul_v3_m4v3(centroid, obedit->obmat, &ml->x); - for (i = -1; i != 3; i += 2) { - copy_v3_v3(vec, centroid); - add_v3_fl(vec, scale_mb * i); - minmax_v3v3_v3(min, max, vec); - } - change = true; - } + change = BKE_mball_minmax_ex(obedit->data, ob_min, ob_max, obedit->obmat, SELECT); + if (change) { + minmax_v3v3_v3(min, max, ob_min); + minmax_v3v3_v3(min, max, ob_max); } - return change; } |