diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-15 09:14:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-15 09:14:05 +0300 |
commit | 27389362a48a7d79df7c7f6df46760f27d421e6f (patch) | |
tree | 937c5820ee0ca1c9def9afab685b2aa878e066eb /source/blender/blenkernel/intern/object.c | |
parent | 0941d9932352f5070d209ac7398bf5494c55a869 (diff) |
Mesh: remove DerivedMesh for boundbox calculation
Fixes edit-mesh not having a boundbox calculated for it.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1ff15ed19d5..fdb2e3a1180 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2558,6 +2558,23 @@ void BKE_object_boundbox_flag(Object *ob, int flag, const bool set) } } +void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval) +{ + float min[3], max[3]; + + INIT_MINMAX(min, max); + + BKE_mesh_minmax(me_eval, min, max); + + if (ob->bb == NULL) { + ob->bb = MEM_callocN(sizeof(BoundBox), "DM-BoundBox"); + } + + BKE_boundbox_init_from_minmax(ob->bb, min, max); + + ob->bb->flag &= ~BOUNDBOX_DIRTY; +} + void BKE_object_dimensions_get(Object *ob, float vec[3]) { BoundBox *bb = NULL; |