Revision: 15848
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15848
Author:   genscher
Date:     2008-07-28 18:55:48 +0200 (Mon, 28 Jul 2008)

Log Message:
-----------
WIP commit, completely untested (should introduce: 1. copy of modifier settings 
work, 2. reverse domain, 3. reverse control)

Modified Paths:
--------------
    branches/fluidcontrol/intern/elbeem/intern/controlparticles.cpp
    branches/fluidcontrol/intern/elbeem/intern/elbeem.cpp
    branches/fluidcontrol/source/blender/blenkernel/intern/fluidsim.c
    branches/fluidcontrol/source/blender/blenkernel/intern/modifier.c
    branches/fluidcontrol/source/blender/makesdna/DNA_object_fluidsim.h
    branches/fluidcontrol/source/blender/src/buttons_object.c
    branches/fluidcontrol/source/blender/src/fluidsim.c

Modified: branches/fluidcontrol/intern/elbeem/intern/controlparticles.cpp
===================================================================
--- branches/fluidcontrol/intern/elbeem/intern/controlparticles.cpp     
2008-07-28 15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/intern/elbeem/intern/controlparticles.cpp     
2008-07-28 16:55:48 UTC (rev 15848)
@@ -184,6 +184,12 @@
        delete genscene;
        delete glob;
        
+       // do reverse here
+       if(model->getGeoPartSlipValue())
+       {
+               mirrorTime();
+       }
+       
        return 1;
 }
 

Modified: branches/fluidcontrol/intern/elbeem/intern/elbeem.cpp
===================================================================
--- branches/fluidcontrol/intern/elbeem/intern/elbeem.cpp       2008-07-28 
15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/intern/elbeem/intern/elbeem.cpp       2008-07-28 
16:55:48 UTC (rev 15848)
@@ -217,7 +217,13 @@
        obj->setGeoInitId( mesh->parentDomainId+1 );
        obj->setGeoInitIntersect(true);
        obj->setGeoInitType(initType);
-       obj->setGeoPartSlipValue(mesh->obstaclePartslip);
+       
+       // abuse partslip value for control fluid: reverse control keys or not
+       if(initType == FGI_CONTROL)
+               obj->setGeoPartSlipValue(mesh->obstacleType);
+       else
+               obj->setGeoPartSlipValue(mesh->obstaclePartslip);
+       
        obj->setGeoImpactFactor(mesh->obstacleImpactFactor);
        
        /* fluid control features */

Modified: branches/fluidcontrol/source/blender/blenkernel/intern/fluidsim.c
===================================================================
--- branches/fluidcontrol/source/blender/blenkernel/intern/fluidsim.c   
2008-07-28 15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/source/blender/blenkernel/intern/fluidsim.c   
2008-07-28 16:55:48 UTC (rev 15848)
@@ -178,6 +178,13 @@
        // timescale not supported yet
        // clmd->sim_parms->timescale= timescale;
        
+       // support reversing of baked fluid frames here
+       if((fss->show_advancedoptions & OB_FLUIDSIM_REVERSE) && 
(fss->lastgoodframe >= 0))
+       {
+               framenr = fss->lastgoodframe - framenr + 1;
+               CLAMP(framenr, 1, fss->lastgoodframe);
+       }
+       
        /* try to read from cache */
        if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && 
(result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
        {

Modified: branches/fluidcontrol/source/blender/blenkernel/intern/modifier.c
===================================================================
--- branches/fluidcontrol/source/blender/blenkernel/intern/modifier.c   
2008-07-28 15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/source/blender/blenkernel/intern/modifier.c   
2008-07-28 16:55:48 UTC (rev 15848)
@@ -6906,6 +6906,17 @@
        fluidsim_free(fluidmd);
 }
 
+static void fluidsimModifier_copyData(ModifierData *md, ModifierData *target)
+{
+       FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
+       FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target;
+       
+       if(tfluidmd->fss)
+               MEM_freeN(tfluidmd->fss);
+       
+       tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
+}
+
 static DerivedMesh * fluidsimModifier_applyModifier(
                ModifierData *md, Object *ob, DerivedMesh *derivedData,
   int useRenderParams, int isFinalCalc)
@@ -7605,6 +7616,7 @@
                mti->flags = eModifierTypeFlag_AcceptsMesh;
                mti->initData = fluidsimModifier_initData;
                mti->freeData = fluidsimModifier_freeData;
+               mti->copyData = fluidsimModifier_copyData;
                mti->dependsOnTime = fluidsimModifier_dependsOnTime;
                mti->applyModifier = fluidsimModifier_applyModifier;
                mti->updateDepgraph = fluidsimModifier_updateDepgraph;

Modified: branches/fluidcontrol/source/blender/makesdna/DNA_object_fluidsim.h
===================================================================
--- branches/fluidcontrol/source/blender/makesdna/DNA_object_fluidsim.h 
2008-07-28 15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/source/blender/makesdna/DNA_object_fluidsim.h 
2008-07-28 16:55:48 UTC (rev 15848)
@@ -158,6 +158,9 @@
 #define OB_FSPART_NEWPART (1<<3)
 #define OB_FSPART_FLOAT   (1<<4)
 
+// new fluid bit flags for show_advancedoptions (min 8 - 1,2,4 reserved) - dg
+#define OB_FLUIDSIM_REVERSE 8
+
 #ifdef __cplusplus
 }
 #endif

Modified: branches/fluidcontrol/source/blender/src/buttons_object.c
===================================================================
--- branches/fluidcontrol/source/blender/src/buttons_object.c   2008-07-28 
15:47:46 UTC (rev 15847)
+++ branches/fluidcontrol/source/blender/src/buttons_object.c   2008-07-28 
16:55:48 UTC (rev 15848)
@@ -2406,6 +2406,7 @@
        case B_FLUIDSIM_CHANGETYPE:
        {
                FluidsimModifierData *fluidmd = (FluidsimModifierData 
*)modifiers_findByType(ob, eModifierType_Fluidsim);
+               fluidmd->fss->show_advancedoptions &= ~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) {
@@ -5050,54 +5051,18 @@
                                               
fss->bbSize[0],fss->bbSize[1],fss->bbSize[2], fss->maxRefine, memString );
                
                        uiBlockBeginAlign ( block );
-                       uiDefButS ( block, ROW, REDRAWBUTSOBJECT, "Std",        
 0,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 0, 20.0, 0, "Show 
standard domain options." );
-                       uiDefButS ( block, ROW, REDRAWBUTSOBJECT, "Adv",        
25,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 1, 20.0, 1, "Show 
advanced domain options." );
-                       uiDefButS ( block, ROW, REDRAWBUTSOBJECT, "Bnd",        
50,yline, 25,objHeight, &fss->show_advancedoptions, 16.0, 2, 20.0, 2, "Show 
domain boundary options." );
+                       uiDefButBitS ( block, TOG, 4, REDRAWBUTSOBJECT, "Std",  
   0, yline,25,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Show 
standard domain options." );
+                       uiDefButBitS ( block, TOG, 1, REDRAWBUTSOBJECT, "Adv",  
   25, yline,25,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Show 
advanced domain options." );
+                       uiDefButBitS ( block, TOG, 2, REDRAWBUTSOBJECT, "Bnd",  
   50, yline,25,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Show domain 
boundary options." );
                        uiBlockEndAlign ( block );
                
                        uiDefBut ( block, BUT, B_FLUIDSIM_BAKE, "BAKE",90, 
yline,210,objHeight, NULL, 0.0, 0.0, 10, 0, "Perform simulation and output and 
surface&preview meshes for each frame." );
+                       
                        yline -= lineHeight;
                        yline -= 2*separateHeight;
                
-                       if ( fss->show_advancedoptions == 0 )
+                       if ( fss->show_advancedoptions & 1 )
                        {
-                               uiDefBut ( block, LABEL,   0, "Req. BAKE 
Memory:",  0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "" );
-                               uiDefBut ( block, LABEL,   0, memString,  
200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "" );
-                               yline -= lineHeight;
-               
-                               uiBlockBeginAlign ( block );
-                               uiDefButS ( block, NUM, REDRAWBUTSOBJECT, 
"Resolution:", 0, yline,150,objHeight, &fss->resolutionxyz, 1, maxRes, 10, 0, 
"Domain resolution in X, Y and Z direction" );
-                               uiDefButS ( block, NUM, B_DIFF,           
"Preview-Res.:", 150, yline,150,objHeight, &fss->previewresxyz, 1, 100, 10, 0, 
"Resolution of the preview meshes to generate, also in X, Y and Z direction" );
-                               uiBlockEndAlign ( block );
-                               yline -= lineHeight;
-                               yline -= 1*separateHeight;
-               
-                               uiBlockBeginAlign ( block );
-                               uiDefButF ( block, NUM, B_DIFF, "Start time:",  
 0, yline,150,objHeight, &fss->animStart, 0.0, 100.0, 10, 0, "Simulation time 
of the first blender frame." );
-                               uiDefButF ( block, NUM, B_DIFF, "End time:",   
150, yline,150,objHeight, &fss->animEnd  , 0.0, 100.0, 10, 0, "Simulation time 
of the last blender frame." );
-                               uiBlockEndAlign ( block );
-                               yline -= lineHeight;
-                               yline -= 2*separateHeight;
-               
-                               if ( ( fss->guiDisplayMode<1 ) || ( 
fss->guiDisplayMode>3 ) ) { fss->guiDisplayMode=2; } // can be changed by 
particle setting
-                               uiDefBut ( block, LABEL,   0, "Disp.-Qual.:",   
         0,yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "" );
-                               uiBlockBeginAlign ( block );
-                               uiDefButS ( block, MENU, B_BAKE_CACHE_CHANGE, 
"GuiDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
-                                               90,yline,105,objHeight, 
&fss->guiDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh in the Blender 
GUI." );
-                               uiDefButS ( block, MENU, B_DIFF, 
"RenderDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
-                                               195,yline,105,objHeight, 
&fss->renderDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh for 
rendering." );
-                               uiBlockEndAlign ( block );
-                               yline -= lineHeight;
-                               yline -= 1*separateHeight;
-               
-                               uiBlockBeginAlign ( block );
-                               uiDefIconBut ( block, BUT, B_FLUIDSIM_SELDIR, 
ICON_FILESEL,  0, 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,"",            20, yline, 280, objHeight, 
fss->surfdataPath, 0.0,79.0, 0, 0,  "Enter Directory (and/or filename prefix) 
to store baked fluid simulation files in" );
-                               uiBlockEndAlign ( block );
-                               // FIXME what is the 79.0 above?
-                       }
-                       else if ( fss->show_advancedoptions == 1 )
-                       {
                                // advanced options
                                uiDefBut ( block, LABEL, 0, "Gravity:",         
0, yline,  90,objHeight, NULL, 0.0, 0, 0, 0, "" );
                                uiBlockBeginAlign ( block );
@@ -5141,7 +5106,7 @@
                                yline -= lineHeight;
                
                        }
-                       else if ( fss->show_advancedoptions == 2 )
+                       else if ( fss->show_advancedoptions & 2 )
                        {
                                // copied from obstacle...
                                //yline -= lineHeight + 5;
@@ -5185,7 +5150,47 @@
                                uiDefBut ( block, LABEL, 0, "Generate&Use 
SpeedVecs:",          0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "" );
                                uiDefButBitC ( block, TOG, 1, REDRAWBUTSOBJECT, 
"Disable",     200, yline,100,objHeight, &fss->domainNovecgen, 0, 0, 0, 0, 
"Default is to generate and use fluidsim vertex speed vectors, this option 
switches calculation off during bake, and disables loading." );
                                yline -= lineHeight;
-                       } // domain 3
+                       }
+                       else
+                       {
+                               uiDefBut ( block, LABEL,   0, "Req. BAKE 
Memory:",  0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "" );
+                               uiDefBut ( block, LABEL,   0, memString,  
200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "" );
+                               yline -= lineHeight;
+               
+                               uiBlockBeginAlign ( block );
+                               uiDefButS ( block, NUM, REDRAWBUTSOBJECT, 
"Resolution:", 0, yline,150,objHeight, &fss->resolutionxyz, 1, maxRes, 10, 0, 
"Domain resolution in X, Y and Z direction" );
+                               uiDefButS ( block, NUM, B_DIFF,           
"Preview-Res.:", 150, yline,150,objHeight, &fss->previewresxyz, 1, 100, 10, 0, 
"Resolution of the preview meshes to generate, also in X, Y and Z direction" );
+                               uiBlockEndAlign ( block );
+                               yline -= lineHeight;
+                               yline -= 1*separateHeight;
+               

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to