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--SConstruct11
-rw-r--r--intern/elbeem/SConscript76
-rw-r--r--intern/elbeem/intern/blenderdummy.cpp19
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim.h7
-rw-r--r--source/blender/src/buttons_object.c153
-rw-r--r--source/blender/src/fluidsim.c48
6 files changed, 207 insertions, 107 deletions
diff --git a/SConstruct b/SConstruct
index 2be80761ab1..6c6ee8b20d0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -807,6 +807,9 @@ else:
# End of platform specific section
#-----------------------------------------------------------------------------
+# NT test new: enable elbeem compilation be default
+use_fluidsim = 'true'
+
#-----------------------------------------------------------------------------
# User configurable options to be saved in a config file.
#-----------------------------------------------------------------------------
@@ -849,6 +852,7 @@ else:
config.write ("USE_OPENAL = %r\n"%(use_openal))
config.write ("USE_FMOD = %r\n"%(use_fmod))
config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
+ config.write ("USE_FLUIDSIM = %r\n"%(use_fluidsim))
config.write ("\n# Compiler information.\n")
config.write ("HOST_CC = %r\n"%(env_dict['CC']))
config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
@@ -957,6 +961,9 @@ user_options.AddOptions (
(BoolOption ('USE_QUICKTIME',
'Set to 1 to add support for QuickTime.',
'false')),
+ (BoolOption ('USE_FLUIDSIM', # NT test new
+ 'Set to 0 to disable compilation of fluid simulation library El\'Beem.',
+ 'true')),
('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.'),
('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.'),
('TARGET_CC', 'C compiler for the target platform.'),
@@ -1058,6 +1065,9 @@ platform_linkflags += user_options_dict['LDFLAGS']
user_options_dict['PLATFORM_LINKFLAGS'] = platform_linkflags
+if user_options_dict['USE_FLUIDSIM'] == 0: # NT test new
+ use_fluidsim='false';
+
#-----------------------------------------------------------------------------
# Generic library generation environment. This one is the basis for each
# library.
@@ -1084,6 +1094,7 @@ if bs_globals.enable_clean==0: # only read SConscripts when not cleaning, this t
Export ('user_options_dict')
Export ('library_env')
Export ('sdl_env')
+ Export ('use_fluidsim') # NT test
BuildDir (bs_globals.root_build_dir+'/extern', 'extern', duplicate=0)
SConscript (bs_globals.root_build_dir+'extern/SConscript')
diff --git a/intern/elbeem/SConscript b/intern/elbeem/SConscript
index c882f5186e3..7d6cba24f2c 100644
--- a/intern/elbeem/SConscript
+++ b/intern/elbeem/SConscript
@@ -1,44 +1,52 @@
#!/usr/bin/python
Import ('library_env')
Import('user_options_dict');
+Import('use_fluidsim');
-# print "Including El'Beem Fluid Simulation..." # debug
elbeem_env = library_env.Copy();
elbeem_env.Append(CPPDEFINES= 'NOGUI');
elbeem_env.Append(CPPDEFINES= [('ELBEEM_BLENDER',1)] );
-
-elbeem_env.Append (CPPPATH = user_options_dict['PNG_INCLUDE'])
-elbeem_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
-elbeem_env.Append (CPPPATH = user_options_dict['SDL_INCLUDE'])
-
-
-# main build----------------------------------------
-
-Sources = [
-
- "intern/cfgparser.cpp",
- "intern/cfglexer.cpp",
-
- "intern/attributes.cpp",
- "intern/elbeem.cpp",
- "intern/factory_fsgr.cpp",
- "intern/isosurface.cpp",
- "intern/lbminterface.cpp",
- "intern/ntl_blenderdumper.cpp",
- "intern/ntl_bsptree.cpp",
- "intern/ntl_geometrymodel.cpp",
- "intern/ntl_geometryobject.cpp",
- "intern/ntl_lightobject.cpp",
- "intern/ntl_ray.cpp",
- "intern/ntl_raytracer.cpp",
- "intern/ntl_scene.cpp",
- "intern/parametrizer.cpp",
- "intern/particletracer.cpp",
- "intern/simulation_object.cpp",
- "intern/utilities.cpp",
- "intern/blendercall.cpp"
-
- ]; # sources
+
+if use_fluidsim=='false':
+ # print "El'Beem Fluid Simulation Disabled..." # debug
+ elbeem_env.Append (CPPPATH = user_options_dict['PNG_INCLUDE'])
+ # dummy interface build
+ Sources = [
+ "intern/utilities.cpp",
+ "intern/blenderdummy.cpp"
+ ]; # sources
+else:
+ # print "Including El'Beem Fluid Simulation..." # debug
+ elbeem_env.Append (CPPPATH = user_options_dict['PNG_INCLUDE'])
+ elbeem_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
+ elbeem_env.Append (CPPPATH = user_options_dict['SDL_INCLUDE'])
+
+ # main build----------------------------------------
+ Sources = [
+
+ "intern/cfgparser.cpp",
+ "intern/cfglexer.cpp",
+
+ "intern/attributes.cpp",
+ "intern/elbeem.cpp",
+ "intern/factory_fsgr.cpp",
+ "intern/isosurface.cpp",
+ "intern/lbminterface.cpp",
+ "intern/ntl_blenderdumper.cpp",
+ "intern/ntl_bsptree.cpp",
+ "intern/ntl_geometrymodel.cpp",
+ "intern/ntl_geometryobject.cpp",
+ "intern/ntl_lightobject.cpp",
+ "intern/ntl_ray.cpp",
+ "intern/ntl_raytracer.cpp",
+ "intern/ntl_scene.cpp",
+ "intern/parametrizer.cpp",
+ "intern/particletracer.cpp",
+ "intern/simulation_object.cpp",
+ "intern/utilities.cpp",
+ "intern/blendercall.cpp"
+
+ ]; # sources
elbeem_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_elbeem', source=Sources)
diff --git a/intern/elbeem/intern/blenderdummy.cpp b/intern/elbeem/intern/blenderdummy.cpp
new file mode 100644
index 00000000000..4d672dee528
--- /dev/null
+++ b/intern/elbeem/intern/blenderdummy.cpp
@@ -0,0 +1,19 @@
+/******************************************************************************
+ *
+ * El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method
+ * All code distributed as part of El'Beem is covered by the version 2 of the
+ * GNU General Public License. See the file COPYING for details.
+ * Copyright 2003-2005 Nils Thuerey
+ *
+ * Blender call for disabled fluidsim
+ *
+ *****************************************************************************/
+
+#include <stdlib.h>
+
+extern "C"
+int performElbeemSimulation(char *cfgfilename) {
+ return 1;
+};
+
+
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index 7ec19917c7e..e98f0b8a8e9 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -43,7 +43,8 @@ struct Mesh;
typedef struct FluidsimSettings {
/* domain,fluid or obstacle */
short type;
- short dummy1;
+ /* display advanced options in fluid sim tab (on=1,off=0)*/
+ short show_advancedoptions;
/* domain object settings */
/* resolutions */
@@ -54,7 +55,6 @@ typedef struct FluidsimSettings {
/* show original meshes, preview or final sim */
short guiDisplayMode;
short renderDisplayMode;
- //short dummy2,dummy3;
/* fluid properties */
float viscosityValue;
@@ -78,7 +78,6 @@ typedef struct FluidsimSettings {
/* store pointer to original mesh (for replacing the current one) */
struct Mesh *orgMesh;
- //void *dummyPtr;
} FluidsimSettings;
/* ob->fluidsimSettings defines */
@@ -86,6 +85,8 @@ typedef struct FluidsimSettings {
#define OB_FLUIDSIM_DOMAIN 2
#define OB_FLUIDSIM_FLUID 4
#define OB_FLUIDSIM_OBSTACLE 8
+#define OB_FLUIDSIM_INFLOW 16
+#define OB_FLUIDSIM_OUTFLOW 32
#ifdef __cplusplus
}
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 8ea5a7163fb..be5b64d86b9 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -1231,12 +1231,9 @@ void fluidsimFilesel(char *selection)
}
// TODO check srcDir for file path from sce?
-
-
- strcpy(ob->fluidsimSettings->surfdataDir, srcDir);
- strcpy(ob->fluidsimSettings->surfdataPrefix, prefix);
- //fprintf(stderr,"fluidsimFilesel: Using surfdata path '%s', prefix '%s' \n", ob->fluidsimSettings->surfdataDir,ob->fluidsimSettings->surfdataPrefix); // DEBUG
-
+ strcpy(ob->fluidsimSettings->surfdataDir, srcDir);
+ strcpy(ob->fluidsimSettings->surfdataPrefix, prefix);
+ //fprintf(stderr,"fluidsimFilesel: Using surfdata path '%s', prefix '%s' \n", ob->fluidsimSettings->surfdataDir,ob->fluidsimSettings->surfdataPrefix); // DEBUG
}
void do_object_panels(unsigned short event)
@@ -1333,6 +1330,8 @@ void do_object_panels(unsigned short event)
/* chosse dir for surface files */
areawinset(sa->win);
activate_fileselect(FILE_SPECIAL, "Select Directory", str, fluidsimFilesel);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWVIEW3D, 0);
}
break;
@@ -1875,6 +1874,7 @@ static void object_panel_fluidsim(Object *ob)
uiBlock *block;
int yline = 160;
const int lineHeight = 20;
+ const int separateHeight = 3;
const int objHeight = 20;
block= uiNewBlock(&curarea->uiblocks, "object_fluidsim", UI_EMBOSS, UI_HELV, curarea->win);
@@ -1887,76 +1887,118 @@ static void object_panel_fluidsim(Object *ob)
FluidsimSettings *fss= ob->fluidsimSettings;
if(fss==NULL) {
- fss = ob->fluidsimSettings = fluidsimSettingsNew(ob); // sbNew();
+ fss = ob->fluidsimSettings = fluidsimSettingsNew(ob);
}
if(ob->type==OB_MESH) {
uiBlockBeginAlign(block);
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Domain", 90, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_DOMAIN, 0.0, 0.0, "Bounding box of this object represents the computational domain of the fluid simulation.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Fluid", 160, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_FLUID, 0.0, 0.0, "Object represents a volume of fluid in the simulation.");
- uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Obstacle", 230, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_OBSTACLE, 0.0, 0.0, "Object is a fixed obstacle.");
+ uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Domain", 90, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_DOMAIN, 20.0, 1.0, "Bounding box of this object represents the computational domain of the fluid simulation.");
+ uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Fluid", 160, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_FLUID, 20.0, 2.0, "Object represents a volume of fluid in the simulation.");
+ uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Obstacle", 230, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_OBSTACLE,20.0, 3.0, "Object is a fixed obstacle.");
+ yline -= lineHeight;
+
+ uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Inflow", 90, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_INFLOW, 20.0, 4.0, "Object adds fluid to the simulation.");
+ uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Outflow", 160, yline, 70,objHeight, &fss->type, 15.0, OB_FLUIDSIM_OUTFLOW, 20.0, 5.0, "Object removes fluid from the simulation.");
+ uiBlockEndAlign(block);
yline -= lineHeight;
- yline -= 5;
+ yline -= 2*separateHeight;
/* display specific settings for each type */
if(fss->type == OB_FLUIDSIM_DOMAIN) {
const int maxRes = 200;
- uiDefButS(block, NUM, B_DIFF, "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");
- yline -= lineHeight;
- uiDefButF(block, NUM, B_DIFF, "Real-size:", 0, yline,150,objHeight, &fss->realsize, 0.0, 1.0, 10, 0, "Size of the simulation domain in meters.");
- yline -= lineHeight;
-
- uiDefButF(block, NUM, B_DIFF, "GravX:", 0, yline, 100,objHeight, &fss->gravx, -1000.1, 1000.1, 10, 0, "Gravity in X direction");
- uiDefButF(block, NUM, B_DIFF, "GravY:", 100, yline, 100,objHeight, &fss->gravy, -1000.1, 1000.1, 10, 0, "Gravity in Y direction");
- uiDefButF(block, NUM, B_DIFF, "GravZ:", 200, yline, 100,objHeight, &fss->gravz, -1000.1, 1000.1, 10, 0, "Gravity in Z direction");
- yline -= lineHeight;
- 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.");
+ /* domain "advanced" settings */
+ if(fss->type == OB_FLUIDSIM_DOMAIN) { }
+ uiDefButBitS(block, TOG, 1, REDRAWBUTSOBJECT, "Advanced>>", 0,yline, 75,objHeight, &fss->show_advancedoptions, 0, 0, 0, 0, "Show advanced domain options.");
+ 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;
-
- /* "advanced" settings */
- yline -= 5;
-
- /* could also be char? */
- uiDefButS(block, MENU, REDRAWVIEW3D, "Viscosity%t|Manual %x1|Water %x2|Oil %x3|Honey %x4",
- 0,yline,100,objHeight, &fss->viscosityMode, 0, 0, 0, 0, "Set viscosity of the fluid to a preset value, or use manual input.");
- if(fss->viscosityMode==1) {
- uiDefButF(block, NUM, B_DIFF, "Value:", 100, yline, 100,objHeight, &fss->viscosityValue, 0.0, 1.0, 10, 0, "Viscosity setting, value that is multiplied by 10 to the power of (exponent*-1).");
- uiDefButS(block, NUM, B_DIFF, "Neg-Exp.:", 200, yline, 100,objHeight, &fss->viscosityExponent, 0, 10, 10, 0, "Negative exponent for the viscosity value (to simplify entering small values e.g. 5*10^-6.");
+ yline -= 2*separateHeight;
+
+ if(fss->show_advancedoptions == 0) {
+ uiDefButS(block, NUM, B_DIFF, "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");
+ yline -= lineHeight;
+ yline -= 1*separateHeight;
+
+ 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.");
+ yline -= lineHeight;
+ yline -= 2*separateHeight;
+
+ uiDefBut(block, LABEL, 0, "Disp.-Qual.:", 0,yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "");
+ uiDefButS(block, MENU, REDRAWVIEW3D, "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, REDRAWVIEW3D, "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.");
+ yline -= lineHeight;
+ yline -= 1*separateHeight;
+
+ uiDefIconBut(block, BUT, B_FLUIDSIM_SELDIR, ICON_FILESEL, 0, yline, 20, objHeight, 0, 0, 0, 0, 0, "Select Directory (and/or filenames) to store baked fluid simulation files in");
+ uiDefBut(block, TEX, 0,"", 20, yline, 200, objHeight,fss->surfdataDir, 0.0,79.0, 0, 0, "Enter Directory (and/or filenames) to store baked fluid simulation files in");
+ uiDefBut(block, TEX, 0,"", 220, yline, 80, objHeight,fss->surfdataPrefix, 0.0,79.0, 0, 0, "Enter Filename-Prefix to store baked fluid simulation files with");
+ // FIXME what is the 79.0 above?
} else {
- // display preset values
- uiDefBut(block, LABEL, 0, fluidsimViscosityPresetString[fss->viscosityMode], 100,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
- }
- yline -= lineHeight;
+ // advanced options
+ uiBlockBeginAlign(block);
+ uiDefBut(block, LABEL, 0, "Gravity:", 0, yline, 90,objHeight, NULL, 0.0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_DIFF, "X:", 90, yline, 70,objHeight, &fss->gravx, -1000.1, 1000.1, 10, 0, "Gravity in X direction");
+ uiDefButF(block, NUM, B_DIFF, "Y:", 160, yline, 70,objHeight, &fss->gravy, -1000.1, 1000.1, 10, 0, "Gravity in Y direction");
+ uiDefButF(block, NUM, B_DIFF, "Z:", 230, yline, 70,objHeight, &fss->gravz, -1000.1, 1000.1, 10, 0, "Gravity in Z direction");
+ uiBlockEndAlign(block);
+ //yline -= lineHeight; yline -= separateHeight;
+ yline -= lineHeight;
+ yline -= 1*separateHeight;
+
+ /* viscosity */
+ uiBlockBeginAlign(block);
+ uiDefButS(block, MENU, REDRAWVIEW3D, "Viscosity%t|Manual %x1|Water %x2|Oil %x3|Honey %x4",
+ 0,yline, 90,objHeight, &fss->viscosityMode, 0, 0, 0, 0, "Set viscosity of the fluid to a preset value, or use manual input.");
+ if(fss->viscosityMode==1) {
+ uiDefButF(block, NUM, B_DIFF, "Value:", 90, yline, 105,objHeight, &fss->viscosityValue, 0.0, 1.0, 10, 0, "Viscosity setting, value that is multiplied by 10 to the power of (exponent*-1).");
+ uiDefButS(block, NUM, B_DIFF, "Neg-Exp.:", 195, yline, 105,objHeight, &fss->viscosityExponent, 0, 10, 10, 0, "Negative exponent for the viscosity value (to simplify entering small values e.g. 5*10^-6.");
+ } else {
+ // display preset values
+ uiDefBut(block, LABEL, 0, fluidsimViscosityPresetString[fss->viscosityMode], 90,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
+ }
+ uiBlockEndAlign(block);
+ yline -= lineHeight;
+ yline -= 1*separateHeight;
- uiDefBut(block, LABEL, 0, "Gui:", 0,yline,50,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButS(block, MENU, REDRAWVIEW3D, "GuiDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
- 50,yline,100,objHeight, &fss->guiDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh in the blender gui.");
- uiDefBut(block, LABEL, 0, "Rend:", 150,yline,50,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefButS(block, MENU, REDRAWVIEW3D, "RenderDisplayMode%t|Geometry %x1|Preview %x2|Final %x3",
- 200,yline,100,objHeight, &fss->renderDisplayMode, 0, 0, 0, 0, "How to display the fluid mesh for rendering.");
- yline -= lineHeight;
+ uiDefBut(block, LABEL, 0, "Realworld-size:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->realsize, 0.001, 1.0, 10, 0, "Size of the simulation domain in meters.");
+ yline -= lineHeight;
+ yline -= 2*separateHeight;
- uiDefBut(block, BUT, B_FLUIDSIM_SELDIR, "Select Output Directory", 0, yline,100,objHeight, NULL, 0.0, 0.0, 10, 0, "Select Directory (and/or filenames) to store baked fluid simulation files in");
- uiDefBut(block, LABEL, 0, fss->surfdataDir, 100,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
- uiDefBut(block, LABEL, 0, fss->surfdataPrefix, 200,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
- yline -= lineHeight;
+ uiDefBut(block, LABEL, 0, "Gridlevels:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
+ uiDefButI(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->maxRefine, -1, 4, 10, 0, "Number of coarsened Grids to use (set to -1 for automatic selection).");
+ yline -= lineHeight;
+
+ uiDefBut(block, LABEL, 0, "Compressibility:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
+ uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->gstar, 0.001, 0.10, 10,0, "Allowed compressibility due to gravitational force for standing fluid (directly affects simulation step size).");
+ yline -= lineHeight;
- uiDefBut(block, BUT, B_FLUIDSIM_BAKE, "BAKE", 0, yline,300,objHeight, NULL, 0.0, 0.0, 10, 0, "Perform simulation and output and surface&preview meshes for each frame.");
+ }
}
- else if(fss->type == OB_FLUIDSIM_FLUID) {
+ else if(
+ (fss->type == OB_FLUIDSIM_FLUID)
+ || (fss->type == OB_FLUIDSIM_INFLOW)
+ ) {
yline -= lineHeight + 5;
- uiDefBut(block, LABEL, 0, "Initial velocity:", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
+ if(fss->type == OB_FLUIDSIM_FLUID) uiDefBut(block, LABEL, 0, "Initial velocity:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
+ if(fss->type == OB_FLUIDSIM_INFLOW) uiDefBut(block, LABEL, 0, "Inflow velocity:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
yline -= lineHeight;
- uiDefButF(block, NUM, B_DIFF, "X:", 0, yline, 100,objHeight, &fss->iniVelx, -1000.1, 1000.1, 10, 0, "Initial fluid velocity in X direction");
- uiDefButF(block, NUM, B_DIFF, "Y:", 100, yline, 100,objHeight, &fss->iniVely, -1000.1, 1000.1, 10, 0, "Initial fluid velocity in Y direction");
- uiDefButF(block, NUM, B_DIFF, "Z:", 200, yline, 100,objHeight, &fss->iniVelz, -1000.1, 1000.1, 10, 0, "Initial fluid velocity in Z direction");
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUM, B_DIFF, "X:", 0, yline, 100,objHeight, &fss->iniVelx, -1000.1, 1000.1, 10, 0, "Fluid velocity in X direction");
+ uiDefButF(block, NUM, B_DIFF, "Y:", 100, yline, 100,objHeight, &fss->iniVely, -1000.1, 1000.1, 10, 0, "Fluid velocity in Y direction");
+ uiDefButF(block, NUM, B_DIFF, "Z:", 200, yline, 100,objHeight, &fss->iniVelz, -1000.1, 1000.1, 10, 0, "Fluid velocity in Z direction");
+ uiBlockEndAlign(block);
yline -= lineHeight;
}
- else if(fss->type == OB_FLUIDSIM_OBSTACLE) {
+ else if(
+ (fss->type == OB_FLUIDSIM_OBSTACLE)
+ || (fss->type == OB_FLUIDSIM_OUTFLOW)
+ ) {
yline -= lineHeight + 5;
uiDefBut(block, LABEL, 0, "No additional settings as of now...", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
yline -= lineHeight;
@@ -1978,7 +2020,6 @@ static void object_panel_fluidsim(Object *ob)
uiDefBut(block, LABEL, 0, "Object not enabled for fluid simulation...", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
yline -= lineHeight;
}
- uiBlockEndAlign(block);
}
void object_panels()
diff --git a/source/blender/src/fluidsim.c b/source/blender/src/fluidsim.c
index 047cbc0a4f1..c21e48872a9 100644
--- a/source/blender/src/fluidsim.c
+++ b/source/blender/src/fluidsim.c
@@ -140,7 +140,7 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob)
fss= MEM_callocN( sizeof(FluidsimSettings), "fluidsimsettings memory");
fss->type = 0;
- fss->dummy1 = 0;
+ fss->show_advancedoptions = 0;
fss->resolutionxyz = 50;
fss->previewresxyz = 25;
@@ -156,8 +156,8 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob)
fss->gravz = -9.81;
fss->animStart = 0.0;
fss->animEnd = 0.30;
- fss->gstar = 0.0; // unused FIXME remove? old=0.0005;
- fss->maxRefine = 0;
+ fss->gstar = 0.005; // used as normgstar
+ fss->maxRefine = -1;
// maxRefine is set according to resolutionxyz during bake
// fluid settings
@@ -228,8 +228,14 @@ void fluidsimBake(struct Object *ob)
char debugStrBuffer[256];
int dirExist = 0;
const int maxRes = 200;
+ int gridlevels = 0;
const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
+
+ // test section
+ // int nr= pupmenu("Continue?%t|Yes%x1|No%x0");
+ // if(nr==0) return;
+
if(getenv(strEnvName)) {
int dlevel = atoi(getenv(strEnvName));
elbeemSetDebugLevel(dlevel);
@@ -267,24 +273,29 @@ void fluidsimBake(struct Object *ob)
// this should do as an approximation, with in/outflow
// doing this more accurate would be overkill
// perhaps add manual setting?
- if(fssDomain->resolutionxyz>128) {
- fssDomain->maxRefine = 2;
- } else
- if(fssDomain->resolutionxyz>64) {
- fssDomain->maxRefine = 1;
+ if(fssDomain->maxRefine <0) {
+ if(fssDomain->resolutionxyz>128) {
+ gridlevels = 2;
+ } else
+ if(fssDomain->resolutionxyz>64) {
+ gridlevels = 1;
+ } else {
+ gridlevels = 0;
+ }
} else {
- fssDomain->maxRefine = 0;
+ gridlevels = fssDomain->maxRefine;
}
- snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , fssDomain->maxRefine );
+ snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
elbeemDebugOut(debugStrBuffer);
+
// prepare names...
strcpy(curWd, G.sce);
BLI_splitdirstring(curWd, blendFile);
if(strlen(curWd)<1) {
BLI_getwdN(curWd);
}
- if((strlen(fsDomain->fluidsimSettings->surfdataPrefix)<1) || (strlen(fsDomain->fluidsimSettings->surfdataDir)<1)){
+ if(strlen(fsDomain->fluidsimSettings->surfdataPrefix)<1) {
// make new from current .blend filename , and domain object name
strcpy(blendDir, G.sce);
BLI_splitdirstring(blendDir, blendFile);
@@ -359,7 +370,7 @@ void fluidsimBake(struct Object *ob)
" timeadap = 1; \n"
" p_tadapmaxomega = 2.0; \n"
- " p_normgstar = 0.005; \n" // FIXME param?
+ " p_normgstar = %f; \n" /* 6b use gstar param? */
" p_viscosity = " "%f" /* 7 pViscosity*/ "; #cfgset \n" "\n"
" maxrefine = " "%d" /* 8 maxRefine*/ "; #cfgset \n"
@@ -380,8 +391,9 @@ void fluidsimBake(struct Object *ob)
(double)fssDomain->realsize,
(double)fssDomain->animStart, animFrameTime ,
(double)fssDomain->gravx, (double)fssDomain->gravy, (double)fssDomain->gravz,
+ (double)fssDomain->gstar,
calcViscosity,
- (int)fssDomain->maxRefine, (int)fssDomain->resolutionxyz, (int)fssDomain->previewresxyz
+ gridlevels, (int)fssDomain->resolutionxyz, (int)fssDomain->previewresxyz
);
}
@@ -570,6 +582,14 @@ void fluidsimBake(struct Object *ob)
fprintf(fileCfg, fluidString, "fluid", bobjPath, // do use absolute paths?
(double)obit->fluidsimSettings->iniVelx, (double)obit->fluidsimSettings->iniVely, (double)obit->fluidsimSettings->iniVelz );
}
+ if(obit->fluidsimSettings->type == OB_FLUIDSIM_INFLOW) {
+ fprintf(fileCfg, fluidString, "inflow", bobjPath, // do use absolute paths?
+ (double)obit->fluidsimSettings->iniVelx, (double)obit->fluidsimSettings->iniVely, (double)obit->fluidsimSettings->iniVelz );
+ }
+ if(obit->fluidsimSettings->type == OB_FLUIDSIM_OUTFLOW) {
+ fprintf(fileCfg, fluidString, "outflow", bobjPath, // do use absolute paths?
+ (double)obit->fluidsimSettings->iniVelx, (double)obit->fluidsimSettings->iniVely, (double)obit->fluidsimSettings->iniVelz );
+ }
if(obit->fluidsimSettings->type == OB_FLUIDSIM_OBSTACLE) {
fprintf(fileCfg, obstacleString, "bnd_no" , bobjPath); // abs path
}
@@ -615,7 +635,7 @@ void fluidsimBake(struct Object *ob)
int done = 0;
unsigned short event=0;
short val;
- float noFramesf = G.scene->r.efra - G.scene->r.sfra;
+ float noFramesf = G.scene->r.efra - G.scene->r.sfra +1;
float percentdone = 0.0;
int lastRedraw = -1;