Revision: 15072
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15072
Author:   campbellbarton
Date:     2008-05-31 21:01:14 +0200 (Sat, 31 May 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/src/fluidsim.c

Modified: trunk/blender/source/blender/src/fluidsim.c
===================================================================
--- trunk/blender/source/blender/src/fluidsim.c 2008-05-31 18:52:23 UTC (rev 
15071)
+++ trunk/blender/source/blender/src/fluidsim.c 2008-05-31 19:01:14 UTC (rev 
15072)
@@ -481,6 +481,7 @@
        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 @@
        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 @@
 
        /* 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 @@
                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 @@
        
        // 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 @@
        
        // 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 @@
                
                // 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) &&


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to