Fix T56360: metaball viewport checkbox crash.
Do same as for other geometry types to compute bbox, instead of blindly returning NULL `ob->bb`...
This commit is contained in:
parent
8ec74106f8
commit
a6b65c75cd
Notes:
blender-bot
2023-02-14 05:26:54 +01:00
Referenced by issue #56360, metaball viewport checkbox crash
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue