diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2015-08-13 19:12:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-08-13 19:12:08 +0300 |
commit | 3fa0a1a5bc0ff28328930ee12608497262b25912 (patch) | |
tree | ad87ae294bdfbc8e24add38f97dee41222a27ab0 /source/blender/blenkernel/intern/armature.c | |
parent | d2383ec6c07a298a290b83ba8347618e3b46c9d9 (diff) |
Add real boundbox support to lattice, and update armature one.
* draw lattice boundingboxes in 3dView [if "show_bounds" is used -- an option previously pretty useless for lattices]
* give proper values for lattice objects ".bound_box" in bpy
* give proper values for armature objects ".bound_box" in bpy
* lets users use "Dimensions" [in 3dView Transform panel] on lattices and armatures
* remove redundant calculations in "boundbox_armature()"
Armatures boundingboxes were already drawn in 3dView, if "show_bounds" was used.
Based on report T45735: Lattice's bounding_box doesn't update,
and a comment in code by @campbellbarton ("later we may want to add dimensions for lattice, armature etc too").
Revision: https://developer.blender.org/D1460
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 27d3d1c50fb..3643aa23998 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2182,39 +2182,27 @@ static int minmax_armature(Object *ob, float r_min[3], float r_max[3]) return (BLI_listbase_is_empty(&ob->pose->chanbase) == false); } -static void boundbox_armature(Object *ob, float loc[3], float size[3]) +static void boundbox_armature(Object *ob) { BoundBox *bb; float min[3], max[3]; - float mloc[3], msize[3]; if (ob->bb == NULL) - ob->bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox"); + ob->bb = MEM_mallocN(sizeof(BoundBox), "Armature boundbox"); bb = ob->bb; - if (!loc) - loc = mloc; - if (!size) - size = msize; - INIT_MINMAX(min, max); if (!minmax_armature(ob, min, max)) { min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - mid_v3_v3v3(loc, min, max); - - size[0] = (max[0] - min[0]) / 2.0f; - size[1] = (max[1] - min[1]) / 2.0f; - size[2] = (max[2] - min[2]) / 2.0f; - BKE_boundbox_init_from_minmax(bb, min, max); } BoundBox *BKE_armature_boundbox_get(Object *ob) { - boundbox_armature(ob, NULL, NULL); + boundbox_armature(ob); return ob->bb; } |