diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-23 22:26:44 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-23 22:40:43 +0300 |
commit | a6b65c75cd2d08afb0bc9543e0528ac583b720a3 (patch) | |
tree | c9750adafa6576a26cd96525e8852041e9ff176d /source/blender/blenkernel | |
parent | 8ec74106f83f02d170facb75868783ccae5a222f (diff) |
Fix T56360: metaball viewport checkbox crash.
Do same as for other geometry types to compute bbox, instead of blindly
returning NULL `ob->bb`...
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_mball.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index e6874cd064b..2eee5f72c0f 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -32,6 +32,7 @@ * \since March 2001 * \author nzc */ +struct BoundBox; struct Depsgraph; struct Main; struct MetaBall; @@ -54,6 +55,7 @@ bool BKE_mball_is_basis(struct Object *ob); struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob); void BKE_mball_texspace_calc(struct Object *ob); +struct BoundBox *BKE_mball_boundbox_get(struct Object *ob); float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase); void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index bc2d7ed79d5..5e4f5614370 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -238,6 +238,23 @@ void BKE_mball_texspace_calc(Object *ob) bb->flag &= ~BOUNDBOX_DIRTY; } +/** Return or compute bbox for given metaball object. */ +BoundBox *BKE_mball_boundbox_get(Object *ob) +{ + BLI_assert(ob->type == OB_MBALL); + + if (ob->bb != NULL && (ob->bb->flag & BOUNDBOX_DIRTY) == 0) { + return ob->bb; + } + + /* This should always only be called with evaluated objects, but currently RNA is a problem here... */ + if (ob->runtime.curve_cache != NULL) { + BKE_mball_texspace_calc(ob); + } + + return ob->bb; +} + float *BKE_mball_make_orco(Object *ob, ListBase *dispbase) { BoundBox *bb; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b4060d6e60a..aa5c006482a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2442,7 +2442,7 @@ BoundBox *BKE_object_boundbox_get(Object *ob) bb = BKE_curve_boundbox_get(ob); } else if (ob->type == OB_MBALL) { - bb = ob->bb; + bb = BKE_mball_boundbox_get(ob); } else if (ob->type == OB_LATTICE) { bb = BKE_lattice_boundbox_get(ob); |