diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-06 11:29:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-06 11:29:57 +0400 |
commit | e8bc3fe0e363d53499c1d0e0a56c503069103d41 (patch) | |
tree | e0d7e8e5d6d6ca7e9ff486dbdad61985467f76ee | |
parent | e55833a0944fdaa78c879228dc993a11b3ca0e9b (diff) |
object-mode lattice bounds were not taken into account when calculating min/max.
effected view-selected, center-origin & local view.
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 73 |
1 files changed, 46 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d0fbc6247b5..16fa1605467 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2387,24 +2387,42 @@ void object_set_dimensions(Object *ob, const float *value) void minmax_object(Object *ob, float *min, float *max) { BoundBox bb; - Mesh *me; - Curve *cu; float vec[3]; int a; + short change= FALSE; switch(ob->type) { - case OB_CURVE: case OB_FONT: case OB_SURF: - cu= ob->data; - - if(cu->bb==NULL) tex_space_curve(cu); - bb= *(cu->bb); - - for(a=0; a<8; a++) { - mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + { + Curve *cu= ob->data; + + if(cu->bb==NULL) tex_space_curve(cu); + bb= *(cu->bb); + + for(a=0; a<8; a++) { + mul_m4_v3(ob->obmat, bb.vec[a]); + DO_MINMAX(bb.vec[a], min, max); + } + change= TRUE; + } + break; + case OB_LATTICE: + { + Lattice *lt= ob->data; + BPoint *bp= lt->def; + int u, v, w; + + for(w=0; w<lt->pntsw; w++) { + for(v=0; v<lt->pntsv; v++) { + for(u=0; u<lt->pntsu; u++, bp++) { + mul_v3_m4v3(vec, ob->obmat, bp->vec); + DO_MINMAX(vec, min, max); + } + } + } + change= TRUE; } break; case OB_ARMATURE: @@ -2416,25 +2434,27 @@ void minmax_object(Object *ob, float *min, float *max) mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); DO_MINMAX(vec, min, max); } - break; + change= TRUE; } - /* no break, get_mesh will give NULL and it passes on to default */ + break; case OB_MESH: - me= get_mesh(ob); - - if(me) { - bb = *mesh_get_bb(ob); - - for(a=0; a<8; a++) { - mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + { + Mesh *me= get_mesh(ob); + + if(me) { + bb = *mesh_get_bb(ob); + + for(a=0; a<8; a++) { + mul_m4_v3(ob->obmat, bb.vec[a]); + DO_MINMAX(bb.vec[a], min, max); + } + change= TRUE; } } - if(min[0] < max[0] ) break; - - /* else here no break!!!, mesh can be zero sized */ - - default: + break; + } + + if(change == FALSE) { DO_MINMAX(ob->obmat[3], min, max); copy_v3_v3(vec, ob->obmat[3]); @@ -2444,7 +2464,6 @@ void minmax_object(Object *ob, float *min, float *max) copy_v3_v3(vec, ob->obmat[3]); sub_v3_v3(vec, ob->size); DO_MINMAX(vec, min, max); - break; } } |