Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/elbeem/intern/controlparticles.cpp6
-rw-r--r--intern/elbeem/intern/elbeem.cpp8
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c7
-rw-r--r--source/blender/blenkernel/intern/modifier.c12
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim.h3
-rw-r--r--source/blender/src/buttons_object.c92
-rw-r--r--source/blender/src/fluidsim.c3
7 files changed, 86 insertions, 45 deletions
diff --git a/intern/elbeem/intern/controlparticles.cpp b/intern/elbeem/intern/controlparticles.cpp
index 90bc99cada7..c08501d5847 100644
--- a/intern/elbeem/intern/controlparticles.cpp
+++ b/intern/elbeem/intern/controlparticles.cpp
@@ -184,6 +184,12 @@ int ControlParticles::initFromObject(ntlGeometryObjModel *model) {
delete genscene;
delete glob;
+ // do reverse here
+ if(model->getGeoPartSlipValue())
+ {
+ mirrorTime();
+ }
+
return 1;
}
diff --git a/intern/elbeem/intern/elbeem.cpp b/intern/elbeem/intern/elbeem.cpp
index c9e6bc7989b..f7923322d5b 100644
--- a/intern/elbeem/intern/elbeem.cpp
+++ b/intern/elbeem/intern/elbeem.cpp
@@ -217,7 +217,13 @@ int elbeemAddMesh(elbeemMesh *mesh) {
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 */
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index fb0f3975529..29c7fff24f9 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -178,6 +178,13 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Object *ob, Deri
// 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)))
{
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index d970b064a44..e8dfab7988d 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -6906,6 +6906,17 @@ static void fluidsimModifier_freeData(ModifierData *md)
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 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
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;
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index 30257bb9b17..19e65855c54 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -158,6 +158,9 @@ typedef struct FluidsimSettings {
#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
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 4fc665c9643..18bc483f03e 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -2406,6 +2406,7 @@ void do_object_panels(unsigned short event)
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,53 +5051,17 @@ static void object_panel_fluidsim(Object *ob)
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 )
- {
- 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 )
+ if ( fss->show_advancedoptions & 1 )
{
// advanced options
uiDefBut ( block, LABEL, 0, "Gravity:", 0, yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "" );
@@ -5141,7 +5106,7 @@ static void object_panel_fluidsim(Object *ob)
yline -= lineHeight;
}
- else if ( fss->show_advancedoptions == 2 )
+ else if ( fss->show_advancedoptions & 2 )
{
// copied from obstacle...
//yline -= lineHeight + 5;
@@ -5185,7 +5150,47 @@ static void object_panel_fluidsim(Object *ob)
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;
+
+ 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;
+
+ uiDefButBitS ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse", 0, yline,50,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Reverse fluidsim frames" );
+ uiDefBut ( block, LABEL, 0, "", 50,yline,25,objHeight, NULL, 0.0, 0, 0, 0, "" );
+ uiBlockBeginAlign ( block );
+ 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" );
+
+ uiBlockEndAlign ( block );
+ // FIXME what is the 79.0 above?
+ }
}
else if (
( fss->type == OB_FLUIDSIM_FLUID )
@@ -5335,6 +5340,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)." );
+ uiDefButBitS ( block, TOG, OB_FLUIDSIM_REVERSE, REDRAWBUTSOBJECT, "Reverse", 150, yline,150,20, &fss->show_advancedoptions, 0, 0, 0, 0, "Reverse control object movement." );
}
else
{
diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c
index d2ad4bed625..7d5939ce94b 100644
--- a/source/blender/src/fluidsim.c
+++ b/source/blender/src/fluidsim.c
@@ -911,7 +911,7 @@ void fluidsimBake(struct Object *ob)
int o = channelObjCount;
int deform = (fluidmdtmp->fss->domainNovecgen); // misused value
// todo - use blenderInitElbeemMesh
- int modifierIndex = modifiers_indexInObject(obit, fluidmdtmp);
+ int modifierIndex = modifiers_indexInObject(obit, (ModifierData *)fluidmdtmp);
elbeemMesh fsmesh;
elbeemResetMesh( &fsmesh );
@@ -956,6 +956,7 @@ void fluidsimBake(struct Object *ob)
fsmesh.cpsTimeStart = fluidmdtmp->fss->cpsTimeStart;
fsmesh.cpsTimeEnd = fluidmdtmp->fss->cpsTimeEnd;
fsmesh.cpsQuality = fluidmdtmp->fss->cpsQuality;
+ fsmesh.obstacleType = (fluidmdtmp->fss->show_advancedoptions & OB_FLUIDSIM_REVERSE);
fsmesh.channelSizeAttractforceRadius =
fsmesh.channelSizeVelocityforceStrength =