Bugfix for a) Fluid ipos gone after save-load b) changing viscosity causes fluidsim...
authorDaniel Genrich <daniel.genrich@gmx.net>
Thu, 14 Aug 2008 09:19:41 +0000 (09:19 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Thu, 14 Aug 2008 09:19:41 +0000 (09:19 +0000)
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/src/buttons_object.c

index 746e4387b61f8b6cd3569bec8c423bb4c9868dff..4c00dc1e918a774fa040d7b79e407f5d8d8d562d 100644 (file)
@@ -181,7 +181,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Object *ob, Deri
        // clmd->sim_parms->timescale= timescale;
        
        // support reversing of baked fluid frames here
        // clmd->sim_parms->timescale= timescale;
        
        // support reversing of baked fluid frames here
-       if((fss->show_advancedoptions & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0))
+       if((fss->flag & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0))
        {
                framenr = fss->lastgoodframe - framenr + 1;
                CLAMP(framenr, 1, fss->lastgoodframe);
        {
                framenr = fss->lastgoodframe - framenr + 1;
                CLAMP(framenr, 1, fss->lastgoodframe);
index 35d605fefe7acc6a743d8ea5d8ef7157e03e0cf7..8d2fa9036a6140fa2c26dc5e897479dec6a7e98a 100644 (file)
@@ -3045,6 +3045,13 @@ static void lib_link_object(FileData *fd, Main *main)
                                act= act->next;
                        }
                        
                                act= act->next;
                        }
                        
+                       {
+                               FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+                               
+                               if(fluidmd && fluidmd->fss) 
+                                       fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo);
+                       }
+                       
                        /* texture field */
                        if(ob->pd)
                                if(ob->pd->tex)
                        /* texture field */
                        if(ob->pd)
                                if(ob->pd->tex)
@@ -3121,7 +3128,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
                        
                        fluidmd->fss= newdataadr(fd, fluidmd->fss);
                        FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
                        
                        fluidmd->fss= newdataadr(fd, fluidmd->fss);
-                       fluidmd->fss->ipo = newlibadr_us(fd, lb, fluidmd->fss->ipo);
                }
                else if (md->type==eModifierType_Collision) {
                        
                }
                else if (md->type==eModifierType_Collision) {
                        
@@ -7794,6 +7800,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                MEM_freeN(ob->fluidsimSettings);
                                
                                fluidmd->fss->lastgoodframe = INT_MAX;
                                MEM_freeN(ob->fluidsimSettings);
                                
                                fluidmd->fss->lastgoodframe = INT_MAX;
+                               fluidmd->fss->flag = 0;
                        }
                }
        }
                        }
                }
        }
index ac7828b17986234013511f8da7c167f7cc993c9a..fde1ce57875827fc8d9d2e25b272c68179eecffd 100644 (file)
@@ -159,7 +159,7 @@ typedef struct FluidsimSettings {
 #define OB_FSPART_FLOAT   (1<<4)
 
 // new fluid bit flags for fss->flags - dg
 #define OB_FSPART_FLOAT   (1<<4)
 
 // new fluid bit flags for fss->flags - dg
-#define OB_FLUIDSIM_REVERSE 1
+#define OB_FLUIDSIM_REVERSE (1 << 0)
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index 1b4a729f743cf960c8d3430d142ff45781933519..e0e04fef019b3d8dc629e48a48e8481200d12feb 100644 (file)
@@ -2407,7 +2407,7 @@ void do_object_panels(unsigned short event)
        case B_FLUIDSIM_CHANGETYPE:
        {
                FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
        case B_FLUIDSIM_CHANGETYPE:
        {
                FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
-               fluidmd->fss->show_advancedoptions &= ~OB_FLUIDSIM_REVERSE; // clear flag
+               fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; // clear flag
                if(ob && ob->particlesystem.first && fluidmd->fss->type!=OB_FLUIDSIM_PARTICLE){
                        ParticleSystem *psys;
                        for(psys=ob->particlesystem.first; psys; psys=psys->next) {
                if(ob && ob->particlesystem.first && fluidmd->fss->type!=OB_FLUIDSIM_PARTICLE){
                        ParticleSystem *psys;
                        for(psys=ob->particlesystem.first; psys; psys=psys->next) {
@@ -5185,7 +5185,7 @@ static void object_panel_fluidsim(Object *ob)
                                yline -= 1*separateHeight;
                
                                uiBlockBeginAlign ( block );
                                yline -= 1*separateHeight;
                
                                uiBlockBeginAlign ( block );
-                               uiDefButBitS ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse",     0, yline,50,objHeight, &fss->flag, 0, 0, 0, 0, "Reverse fluidsim frames" );
+                               uiDefButBitI ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse",     0, yline,50,objHeight, &fss->flag, 0, 0, 0, 0, "Reverse fluidsim frames" );
                                uiDefBut ( block, LABEL,   0, "",  50,yline,25,objHeight, NULL, 0.0, 0, 0, 0, "" );
                                uiDefIconBut ( block, BUT, B_FLUIDSIM_SELDIR, ICON_FILESEL,  75, yline,  20, objHeight,                   0, 0, 0, 0, 0,  "Select Directory (and/or filename prefix) to store baked fluid simulation files in" );
                                uiDefBut ( block, TEX,     B_BAKE_CACHE_CHANGE,"",            95, yline, 205, objHeight, fss->surfdataPath, 0.0,79.0, 0, 0,  "Enter Directory (and/or filename prefix) to store baked fluid simulation files in" );
                                uiDefBut ( block, LABEL,   0, "",  50,yline,25,objHeight, NULL, 0.0, 0, 0, 0, "" );
                                uiDefIconBut ( block, BUT, B_FLUIDSIM_SELDIR, ICON_FILESEL,  75, yline,  20, objHeight,                   0, 0, 0, 0, 0,  "Select Directory (and/or filename prefix) to store baked fluid simulation files in" );
                                uiDefBut ( block, TEX,     B_BAKE_CACHE_CHANGE,"",            95, yline, 205, objHeight, fss->surfdataPath, 0.0,79.0, 0, 0,  "Enter Directory (and/or filename prefix) to store baked fluid simulation files in" );
@@ -5342,7 +5342,7 @@ static void object_panel_fluidsim(Object *ob)
                
                        yline -= lineHeight;
                        uiDefButF ( block, NUM, B_DIFF, "Quality:", 0, yline,150,20, &fss->cpsQuality, 5.0, 100.0,   10,0, "Specifies the quality which is used for object sampling (higher = better but slower)." );
                
                        yline -= lineHeight;
                        uiDefButF ( block, NUM, B_DIFF, "Quality:", 0, yline,150,20, &fss->cpsQuality, 5.0, 100.0,   10,0, "Specifies the quality which is used for object sampling (higher = better but slower)." );
-                       uiDefButBitS ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse",     150, yline,150,20, &fss->flag, 0, 0, 0, 0, "Reverse control object movement." );
+                       uiDefButBitI ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse",     150, yline,150,20, &fss->flag, 0, 0, 0, 0, "Reverse control object movement." );
                }
                else
                {
                }
                else
                {