Boundbox code for display lists lacked a check for empty Curve/Surface
objects, causing a boundbox to be giant (initialized huge values). That
frustrates code like 'view3d home', or 'centered object view'.

(Commit in view.c is only a little bit code cleanup)
This commit is contained in:
Ton Roosendaal 2006-08-15 11:33:00 +00:00
parent 8e7095a464
commit 605e0230bf
2 changed files with 10 additions and 4 deletions

@ -1517,6 +1517,7 @@ void imagestodisplist(void)
/* removed */
}
/* this is confusing, there's also min_max_object, appplying the obmat... */
static void boundbox_displist(Object *ob)
{
BoundBox *bb=0;
@ -1529,6 +1530,7 @@ static void boundbox_displist(Object *ob)
if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
Curve *cu= ob->data;
int doit= 0;
if(cu->bb==0) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
bb= cu->bb;
@ -1541,11 +1543,18 @@ static void boundbox_displist(Object *ob)
vert= dl->verts;
for(a=0; a<tot; a++, vert+=3) {
doit= 1;
DO_MINMAX(vert, min, max);
}
dl= dl->next;
}
if(!doit) {
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}
}
if(bb) {

@ -1410,14 +1410,11 @@ void view3d_home(int centre)
max[0]= max[1]= max[2]= -1.0e10;
}
base= FIRSTBASE;
if(base==0) return;
while(base) {
for(base= FIRSTBASE; base; base= base->next) {
if(base->lay & G.vd->lay) {
onedone= 1;
minmax_object(base->object, min, max);
}
base= base->next;
}
if(!onedone) return;