Playback of sequencer sound crashed in combination with dupliverted
Objects. (confirmed in osx only btw).

Found out there's old not-needed code in the update_for_newframe() call,
that was intended to do updates for Manipulators (calling countall()).
In countall(), the entire duplilists were generated over, just for
counting the totals.

First step was removing the countall from update_for_newframe, and added
a count_duplilist() call which doesn't generate the full duplilist. That
made Blender not crashing anymore, but gives "Error totblock", without
printing the block names even...

The weird thing also was that the crash showed severe memory corruption in
the malloc library, when combining audio scrubbing (SDL) and duplilists.

I now suspect there's a remaining issue with DerivedMesh, but for that I
need help from Daniel.
This commit is contained in:
Ton Roosendaal 2005-09-24 09:05:48 +00:00
parent 4fb0cccc68
commit 6b33e12b90
6 changed files with 54 additions and 36 deletions

@ -48,6 +48,7 @@ void vertex_duplilist(struct Scene *sce, struct Object *par);
void particle_duplilist(struct Scene *sce, struct Object *par, struct PartEff *paf); void particle_duplilist(struct Scene *sce, struct Object *par, struct PartEff *paf);
void free_duplilist(void); void free_duplilist(void);
void make_duplilist(struct Scene *sce, struct Object *ob); void make_duplilist(struct Scene *sce, struct Object *ob);
int count_duplilist(struct Object *ob);
#endif #endif

@ -524,3 +524,28 @@ void make_duplilist(Scene *sce, Object *ob)
} }
} }
int count_duplilist(Object *ob)
{
if(ob->transflag & OB_DUPLI) {
if(ob->transflag & OB_DUPLIVERTS) {
if(ob->type==OB_MESH) {
if(ob->transflag & OB_DUPLIVERTS) {
PartEff *paf;
if( (paf=give_parteff(ob)) ) {
return paf->totpart;
}
else {
Mesh *me= ob->data;
return me->totvert;
}
}
}
}
else if(ob->transflag & OB_DUPLIFRAMES) {
int tot= ob->dupend - ob->dupsta;
tot/= (ob->dupon+ob->dupoff);
return tot*ob->dupon;
}
}
return 1;
}

@ -37,7 +37,6 @@ struct Object;
struct rcti; struct rcti;
int get_border(struct rcti *rect, short col); int get_border(struct rcti *rect, short col);
void count_object(struct Object *ob, int sel);
void countall(void); void countall(void);
void snapmenu(void); void snapmenu(void);
void mergemenu(void); void mergemenu(void);

@ -2162,7 +2162,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
for(base= G.scene->base.first; base; base= base->next) { for(base= G.scene->base.first; base; base= base->next) {
if(v3d->lay & base->lay) { if(v3d->lay & base->lay) {
/* dupli drawing temporal off here */ /* dupli drawing */
if(base->object->transflag & OB_DUPLI) { if(base->object->transflag & OB_DUPLI) {
extern ListBase duplilist; extern ListBase duplilist;
Base tbase; Base tbase;

@ -489,7 +489,7 @@ void circle_selectCB(select_CBfunc callback)
allqueue(REDRAWINFO, 0); allqueue(REDRAWINFO, 0);
} }
void count_object(Object *ob, int sel) static void count_object(Object *ob, int sel, int totob)
{ {
Mesh *me; Mesh *me;
Curve *cu; Curve *cu;
@ -497,13 +497,13 @@ void count_object(Object *ob, int sel)
switch(ob->type) { switch(ob->type) {
case OB_MESH: case OB_MESH:
G.totmesh++; G.totmesh+=totob;
me= get_mesh(ob); me= get_mesh(ob);
if(me) { if(me) {
int totvert, totface; int totvert, totface;
totvert= me->totvert; totvert= me->totvert*totob;
totface= me->totface; totface= me->totface*totob;
G.totvert+= totvert; G.totvert+= totvert;
G.totface+= totface; G.totface+= totface;
@ -515,16 +515,18 @@ void count_object(Object *ob, int sel)
break; break;
case OB_LAMP: case OB_LAMP:
G.totlamp++; G.totlamp+=totob;
break; break;
case OB_SURF: case OB_SURF:
case OB_CURVE: case OB_CURVE:
case OB_FONT: case OB_FONT:
G.totcurve++; G.totcurve+=totob;
tot=totf= 0; tot=totf= 0;
cu= ob->data; cu= ob->data;
if(cu->disp.first) if(cu->disp.first)
count_displist( &cu->disp, &tot, &totf); count_displist( &cu->disp, &tot, &totf);
tot*= totob;
totf*= totob;
G.totvert+= tot; G.totvert+= tot;
G.totface+= totf; G.totface+= totf;
if(sel) { if(sel) {
@ -534,13 +536,14 @@ void count_object(Object *ob, int sel)
break; break;
case OB_MBALL: case OB_MBALL:
count_displist( &ob->disp, &tot, &totf); count_displist( &ob->disp, &tot, &totf);
tot*= totob;
totf*= totob;
G.totvert+= tot; G.totvert+= tot;
G.totface+= totf; G.totface+= totf;
if(sel) { if(sel) {
G.totvertsel+= tot; G.totvertsel+= tot;
G.totfacesel+= totf; G.totfacesel+= totf;
} }
break; break;
} }
@ -695,23 +698,23 @@ void countall()
base= (G.scene->base.first); base= (G.scene->base.first);
while(base) { while(base) {
if(G.scene->lay & base->lay) { if(G.scene->lay & base->lay) {
ob= base->object; /* warning, ob not is obact anymore */
G.totobj++;
if(base->flag & SELECT) G.totobjsel++; if(base->flag & SELECT) G.totobjsel++;
count_object(base->object, base->flag & SELECT); if(ob->parent && (ob->parent->transflag & OB_DUPLIVERTS)) {
int tot= count_duplilist(ob->parent);
if(base->object->transflag & OB_DUPLI) { G.totobj+=tot;
extern ListBase duplilist; count_object(ob, base->flag & SELECT, tot);
make_duplilist(G.scene, base->object);
ob= duplilist.first;
while(ob) {
G.totobj++;
count_object(ob, base->flag & SELECT);
ob= ob->id.next;
} }
free_duplilist(); else if(ob->transflag & OB_DUPLIFRAMES) {
int tot= count_duplilist(ob);
G.totobj+=tot;
count_object(ob, base->flag & SELECT, tot);
}
else {
count_object(ob, base->flag & SELECT, 1);
G.totobj++;
} }
} }
base= base->next; base= base->next;

@ -498,16 +498,6 @@ static void do_update_for_newframe(int mute, int events)
/* this function applies the changes too */ /* this function applies the changes too */
scene_update_for_newframe(G.scene, G.vd?G.vd->lay:G.scene->lay); /* BKE_scene.h */ scene_update_for_newframe(G.scene, G.vd?G.vd->lay:G.scene->lay); /* BKE_scene.h */
/* manipulators like updates too */
for(sa=G.curscreen->areabase.first; sa; sa=sa->next) {
if(sa->spacetype==SPACE_VIEW3D) {
View3D *v3d= sa->spacedata.first;
if(v3d->twflag & V3D_USE_MANIPULATOR) break;
else break; // for now
}
}
if(sa) countall(); // does manipulator centers
if ( (CFRA>1) && (!mute) && (G.scene->audio.flag & AUDIO_SCRUB)) audiostream_scrub( CFRA ); if ( (CFRA>1) && (!mute) && (G.scene->audio.flag & AUDIO_SCRUB)) audiostream_scrub( CFRA );
} }