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
path: root/source
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2015-08-17 17:59:32 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-08-17 18:02:22 +0300
commit3047b96eaa962fe45d2333f5ea4be809e02787cd (patch)
treef9d6cf90e3de89e77e2a4851cd0d244d5fd364b1 /source
parentad43262fdb6ac6f0cc01a56c1316912f3018d788 (diff)
Lattice min_max: add a version of the func using lattice's final DispList,
and use it for bbox computing. Revision: https://developer.blender.org/D1462
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_lattice.h1
-rw-r--r--source/blender/blenkernel/intern/lattice.c20
2 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index e91d0e0ed87..677d8e34229 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -81,6 +81,7 @@ struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice);
struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
struct BoundBox *BKE_lattice_boundbox_get(struct Object *ob);
+void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], float max[3]);
void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index d3f666e2109..009e1d20328 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1152,7 +1152,7 @@ static void boundbox_lattice(Object *ob)
lt = ob->data;
INIT_MINMAX(min, max);
- BKE_lattice_minmax(lt, min, max);
+ BKE_lattice_minmax_dl(ob, lt, min, max);
BKE_boundbox_init_from_minmax(bb, min, max);
}
@@ -1163,6 +1163,24 @@ BoundBox *BKE_lattice_boundbox_get(Object *ob)
return ob->bb;
}
+void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3])
+{
+ DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL;
+
+ if (!dl) {
+ BKE_lattice_minmax(lt, min, max);
+ }
+ else {
+ int i, numVerts;
+
+ if (lt->editlatt) lt = lt->editlatt->latt;
+ numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ for (i = 0; i < numVerts; i++)
+ minmax_v3v3_v3(min, max, &dl->verts[i * 3]);
+ }
+}
+
void BKE_lattice_minmax(Lattice *lt, float min[3], float max[3])
{
int i, numVerts;