Fix T59087: Empty meshes have large bound-box
Initialize to default values for meshes w/o vertices, note that zeroing for BKE_object_boundbox_calc_from_mesh matches old derived mesh code.
This commit is contained in:
@@ -922,7 +922,10 @@ BoundBox *BKE_mesh_boundbox_get(Object *ob)
|
||||
float min[3], max[3];
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
BKE_mesh_minmax(me, min, max);
|
||||
if (!BKE_mesh_minmax(me, min, max)) {
|
||||
min[0] = min[1] = min[2] = -1.0f;
|
||||
max[0] = max[1] = max[2] = 1.0f;
|
||||
}
|
||||
|
||||
if (ob->bb == NULL) {
|
||||
ob->bb = MEM_mallocN(sizeof(*ob->bb), __func__);
|
||||
|
||||
@@ -2516,7 +2516,10 @@ void BKE_object_boundbox_calc_from_mesh(struct Object *ob, struct Mesh *me_eval)
|
||||
|
||||
INIT_MINMAX(min, max);
|
||||
|
||||
BKE_mesh_minmax(me_eval, min, max);
|
||||
if (!BKE_mesh_minmax(me_eval, min, max)) {
|
||||
zero_v3(min);
|
||||
zero_v3(max);
|
||||
}
|
||||
|
||||
if (ob->bb == NULL) {
|
||||
ob->bb = MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
|
||||
|
||||
Reference in New Issue
Block a user