Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2015-08-13 19:12:08 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-08-13 19:12:08 +0300
commit3fa0a1a5bc0ff28328930ee12608497262b25912 (patch)
treead87ae294bdfbc8e24add38f97dee41222a27ab0 /source/blender/blenkernel/intern/lattice.c
parentd2383ec6c07a298a290b83ba8347618e3b46c9d9 (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/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 86927609ff6..d3f666e2109 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -61,6 +61,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
+#include "BKE_object.h"
#include "BKE_deform.h"
@@ -1138,6 +1139,30 @@ void BKE_lattice_center_median(Lattice *lt, float cent[3])
mul_v3_fl(cent, 1.0f / (float)numVerts);
}
+static void boundbox_lattice(Object *ob)
+{
+ BoundBox *bb;
+ Lattice *lt;
+ float min[3], max[3];
+
+ if (ob->bb == NULL)
+ ob->bb = MEM_mallocN(sizeof(BoundBox), "Lattice boundbox");
+
+ bb = ob->bb;
+ lt = ob->data;
+
+ INIT_MINMAX(min, max);
+ BKE_lattice_minmax(lt, min, max);
+ BKE_boundbox_init_from_minmax(bb, min, max);
+}
+
+BoundBox *BKE_lattice_boundbox_get(Object *ob)
+{
+ boundbox_lattice(ob);
+
+ return ob->bb;
+}
+
void BKE_lattice_minmax(Lattice *lt, float min[3], float max[3])
{
int i, numVerts;