diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-05-31 23:01:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-05-31 23:01:14 +0400 |
commit | c6528b3cd4d3507c9ae5b9cfa70d832731d95aec (patch) | |
tree | ebbca5843b905037604eed28d7c8ba350b3b8ef7 /source/blender/src | |
parent | 32de0da6df27a0eebd76524d883f8fe80e3b4e56 (diff) |
bufgfix for [#13584] SIGSEV in fluid bake with large amount of small fluid objects
the maximum number of objects (255) wasnt being checked, added a check before baking.
also changed bakeing to use G.scene->base rather then G.main->objects since these can be in other scenes, from linked
groups, or used only by python so they should not be used for baking. it also meant having a domain in 2 scenes would fail with an error.
Nils, could be good to have a dynamic number of bakeable objects.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/fluidsim.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c index a7361a9ffca..8b9c89656fb 100644 --- a/source/blender/src/fluidsim.c +++ b/source/blender/src/fluidsim.c @@ -481,6 +481,7 @@ void fluidsimBake(struct Object *ob) struct Object *fsDomain = NULL; FluidsimSettings *domainSettings; struct Object *obit = NULL; /* object iterator */ + Base *base; int origFrame = G.scene->r.cfra; char debugStrBuffer[256]; int dirExist = 0; @@ -522,7 +523,7 @@ void fluidsimBake(struct Object *ob) float *channelObjMove[256][3]; // object movments , 0=trans, 1=rot, 2=scale float *channelObjInivel[256]; // initial velocities float *channelObjActive[256]; // obj active channel - + if(getenv(strEnvName)) { int dlevel = atoi(getenv(strEnvName)); elbeemSetDebugLevel(dlevel); @@ -545,7 +546,6 @@ void fluidsimBake(struct Object *ob) /* no object pointer, find in selected ones.. */ if(!ob) { - Base *base; for(base=G.scene->base.first; base; base= base->next) { if ( ((base)->flag & SELECT) // ignore layer setting for now? && ((base)->lay & G.vd->lay) @@ -561,8 +561,26 @@ void fluidsimBake(struct Object *ob) if(!ob) return; } + channelObjCount = 0; + for(base=G.scene->base.first; base; base= base->next) { + obit = base->object; + //{ snprintf(debugStrBuffer,256,"DEBUG object name=%s, type=%d ...\n", obit->id.name, obit->type); elbeemDebugOut(debugStrBuffer); } // DEBUG + if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) && + (obit->type==OB_MESH) && + (obit->fluidsimSettings->type != OB_FLUIDSIM_DOMAIN) && // if has to match 3 places! // CHECKMATCH + (obit->fluidsimSettings->type != OB_FLUIDSIM_PARTICLE) ) { + channelObjCount++; + } + } + + if (channelObjCount>=255) { + pupmenu("Fluidsim Bake Error%t|Cannot bake with more then 256 objects"); + return; + } + /* check if there's another domain... */ - for(obit= G.main->object.first; obit; obit= obit->id.next) { + for(base=G.scene->base.first; base; base= base->next) { + obit = base->object; if((obit->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(obit->type==OB_MESH)) { if(obit->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) { if(obit != ob) { @@ -605,7 +623,8 @@ void fluidsimBake(struct Object *ob) // check if theres any fluid // abort baking if not... - for(obit= G.main->object.first; obit; obit= obit->id.next) { + for(base=G.scene->base.first; base; base= base->next) { + obit = base->object; if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (obit->type==OB_MESH) && ( (obit->fluidsimSettings->type == OB_FLUIDSIM_FLUID) || @@ -749,7 +768,8 @@ void fluidsimBake(struct Object *ob) // init obj movement channels channelObjCount=0; - for(obit= G.main->object.first; obit; obit= obit->id.next) { + for(base=G.scene->base.first; base; base= base->next) { + obit = base->object; //{ snprintf(debugStrBuffer,256,"DEBUG object name=%s, type=%d ...\n", obit->id.name, obit->type); elbeemDebugOut(debugStrBuffer); } // DEBUG if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (obit->type==OB_MESH) && @@ -952,7 +972,8 @@ void fluidsimBake(struct Object *ob) // init objects channelObjCount = 0; - for(obit= G.main->object.first; obit; obit= obit->id.next) { + for(base=G.scene->base.first; base; base= base->next) { + obit = base->object; //{ snprintf(debugStrBuffer,256,"DEBUG object name=%s, type=%d ...\n", obit->id.name, obit->type); elbeemDebugOut(debugStrBuffer); } // DEBUG if( (obit->fluidsimFlag & OB_FLUIDSIM_ENABLE) && // if has to match 3 places! // CHECKMATCH (obit->type==OB_MESH) && |