Fix uninitialized memory use lattice-boundbox

Many other places weren't clearing boundbox dirty flag after calculation.
This commit is contained in:
Campbell Barton 2016-03-04 21:50:54 +11:00 committed by Sergey Sharybin
parent ce4a8210b3
commit 15ac4b4f9b
5 changed files with 14 additions and 4 deletions

View File

@ -3655,6 +3655,8 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
ob->bb = MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
BKE_boundbox_init_from_minmax(ob->bb, min, max);
ob->bb->flag &= ~BOUNDBOX_DIRTY;
}
/* --- NAVMESH (begin) --- */

View File

@ -2221,8 +2221,7 @@ static void boundbox_armature(Object *ob)
float min[3], max[3];
if (ob->bb == NULL) {
ob->bb = MEM_mallocN(sizeof(BoundBox), "Armature boundbox");
ob->bb->flag = 0;
ob->bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox");
}
bb = ob->bb;
@ -2233,6 +2232,8 @@ static void boundbox_armature(Object *ob)
}
BKE_boundbox_init_from_minmax(bb, min, max);
bb->flag &= ~BOUNDBOX_DIRTY;
}
BoundBox *BKE_armature_boundbox_get(Object *ob)

View File

@ -1861,6 +1861,8 @@ static void boundbox_displist_object(Object *ob)
INIT_MINMAX(min, max);
BKE_displist_minmax(&ob->curve_cache->disp, min, max);
BKE_boundbox_init_from_minmax(ob->bb, min, max);
ob->bb->flag &= ~BOUNDBOX_DIRTY;
}
}
}

View File

@ -1152,8 +1152,9 @@ static void boundbox_lattice(Object *ob)
Lattice *lt;
float min[3], max[3];
if (ob->bb == NULL)
ob->bb = MEM_mallocN(sizeof(BoundBox), "Lattice boundbox");
if (ob->bb == NULL) {
ob->bb = MEM_callocN(sizeof(BoundBox), "Lattice boundbox");
}
bb = ob->bb;
lt = ob->data;
@ -1161,6 +1162,8 @@ static void boundbox_lattice(Object *ob)
INIT_MINMAX(min, max);
BKE_lattice_minmax_dl(ob, lt, min, max);
BKE_boundbox_init_from_minmax(bb, min, max);
bb->flag &= ~BOUNDBOX_DIRTY;
}
BoundBox *BKE_lattice_boundbox_get(Object *ob)

View File

@ -292,6 +292,8 @@ void BKE_mball_texspace_calc(Object *ob)
size[2] = (max[2] - min[2]) / 2.0f;
#endif
BKE_boundbox_init_from_minmax(bb, min, max);
bb->flag &= ~BOUNDBOX_DIRTY;
}
float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)