Several minor fixes:
- Added part of Austin's msvc8 fixes (vector::erase function was "misused"), hopefully compiles better now. - Ctrl-b now also bakes a selected fluidsim domain similar to the softbodies. - Added surface smoothing option for domains: default is 1, higher values result in a smoother surface (and probably slightly higher comupation times), while 0 means the surface is not modified at all. - Added BLENDER_ELBEEMBOBJABORT environment variable in readBobj, if >0 quits blender when a not yet existing fluidsim frame should be loaded. Useful for rendering simulations as far as possible from the command line. - Surface normals pointer is now set to NULL in readfile.c - Fixed win32 error string handling, now uses a function to return the string from the solver. - Fixed fluidsim particle halo scaling problem. - Solver update
This commit is contained in:
@@ -2392,7 +2392,7 @@ void readVelgz(char *filename, Object *srcob)
|
||||
vverts[i].co[j] = 0.;
|
||||
}
|
||||
}
|
||||
if(srcob->fluidsimSettings->typeFlags&OB_FSDOMAIN_NOVECGEN) return;
|
||||
if(srcob->fluidsimSettings->domainNovecgen>0) return;
|
||||
|
||||
if(len<7) {
|
||||
//printf("readVelgz Eror: invalid filename '%s'\n",filename); // DEBUG
|
||||
@@ -2516,6 +2516,18 @@ void loadFluidsimMesh(Object *srcob, int useRenderParams)
|
||||
mesh = readBobjgz(targetFile, srcob->fluidsimSettings->orgMesh, bbSize,bbSize );
|
||||
}
|
||||
if(!mesh) {
|
||||
// switch, abort background rendering when fluidsim mesh is missing
|
||||
const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp
|
||||
if(G.background==1) {
|
||||
if(getenv(strEnvName2)) {
|
||||
int elevel = atoi(getenv(strEnvName2));
|
||||
if(elevel>0) {
|
||||
printf("Env. var %s set, fluid sim mesh not found, aborting render...\n",strEnvName2);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// display org. object upon failure
|
||||
srcob->data = srcob->fluidsimSettings->orgMesh;
|
||||
return;
|
||||
|
||||
@@ -1578,6 +1578,11 @@ static pMatrixCache *cache_object_matrices(Object *ob, int start, int end)
|
||||
return mcache;
|
||||
}
|
||||
|
||||
/* for fluidsim win32 debug messages */
|
||||
#if defined(WIN32) && (!(defined snprintf))
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/* main particle building function
|
||||
one day particles should become dynamic (realtime) with the current method as a 'bake' (ton) */
|
||||
void build_particle_system(Object *ob)
|
||||
@@ -1599,7 +1604,7 @@ void build_particle_system(Object *ob)
|
||||
float *volengths= NULL, *folengths= NULL;
|
||||
int deform=0, a, totpart, paf_sta, paf_end;
|
||||
int waitcursor_set= 0, totvert, totface, curface, curvert;
|
||||
int readMask =0, activeParts;
|
||||
int readMask, activeParts, fileParts;
|
||||
|
||||
/* return conditions */
|
||||
if(ob->type!=OB_MESH) return;
|
||||
@@ -1617,6 +1622,7 @@ void build_particle_system(Object *ob)
|
||||
char *suffix = "fluidsurface_particles_#";
|
||||
char *suffix2 = ".gz";
|
||||
char filename[256];
|
||||
char debugStrBuffer[256];
|
||||
int curFrame = G.scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
|
||||
int j, numFileParts;
|
||||
gzFile gzf;
|
||||
@@ -1635,8 +1641,7 @@ void build_particle_system(Object *ob)
|
||||
|
||||
gzf = gzopen(filename, "rb");
|
||||
if (!gzf) {
|
||||
//char debugStrBuffer[256];
|
||||
//define win32... snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s'\n", filename);
|
||||
snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
|
||||
//elbeemDebugOut(debugStrBuffer);
|
||||
paf->totpart = 1;
|
||||
return;
|
||||
@@ -1648,28 +1653,24 @@ void build_particle_system(Object *ob)
|
||||
paf->totpart= totpart;
|
||||
paf->totkey= 1;
|
||||
/* initialize particles */
|
||||
new_particle(paf);// ?
|
||||
ftime = 0.0;
|
||||
dtime= 0.0f;
|
||||
new_particle(paf);
|
||||
ftime = 0.0; // unused...
|
||||
|
||||
// set up reading mask
|
||||
//for(j=1; j<=4; j++ ){ if(ob->fluidsimSettings->guiDisplayMode&j) readMask |= (1<<j); }
|
||||
readMask = ob->fluidsimSettings->guiDisplayMode;
|
||||
readMask = ob->fluidsimSettings->typeFlags;
|
||||
activeParts=0;
|
||||
// FIXME only allocate needed ones?
|
||||
fileParts=0;
|
||||
|
||||
//fprintf(stderr,"FSPARTICLE debug set %s , tot%d mask=%d \n", filename, totpart, readMask );
|
||||
for(a=0; a<totpart; a++, ftime+=dtime) {
|
||||
for(a=0; a<totpart; a++) {
|
||||
int ptype=0;
|
||||
short shsize=0;
|
||||
float convertSize=0.0;
|
||||
gzread(gzf, &ptype, sizeof( ptype ));
|
||||
//if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d t=%d , mask=%d , active%d\n", filename, a, ptype, readMask, activeParts );
|
||||
if(ptype&readMask) {
|
||||
activeParts++;
|
||||
pa= new_particle(paf);
|
||||
pa->time= ftime;
|
||||
pa->lifetime= ftime + G.scene->r.efra +1.0;
|
||||
pa->lifetime= ftime + 10000.; // add large number to make sure they are displayed, G.scene->r.efra +1.0;
|
||||
pa->co[0] = 0.0;
|
||||
pa->co[1] =
|
||||
pa->co[2] = 1.0*(float)a / (float)totpart;
|
||||
@@ -1692,18 +1693,20 @@ void build_particle_system(Object *ob)
|
||||
gzread(gzf, &wrf, sizeof( wrf ));
|
||||
vel[j] = wrf;
|
||||
}
|
||||
//if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
|
||||
} else {
|
||||
// skip...
|
||||
for(j=0; j<2*3+1; j++) {
|
||||
float wrf; gzread(gzf, &wrf, sizeof( wrf ));
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
|
||||
fileParts++;
|
||||
}
|
||||
gzclose( gzf );
|
||||
|
||||
totpart = paf->totpart = activeParts;
|
||||
//fprintf(stderr,"PARTOBH debug %s %d \n", ob->id.name, totpart); // DEBUG
|
||||
snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", paf->totpart,activeParts,fileParts,readMask);
|
||||
elbeemDebugOut(debugStrBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2531,6 +2531,7 @@ static void direct_link_object(FileData *fd, Object *ob)
|
||||
ob->fluidsimSettings->orgMesh = NULL; //ob->data;
|
||||
ob->fluidsimSettings->meshSurface = NULL;
|
||||
ob->fluidsimSettings->meshBB = NULL;
|
||||
ob->fluidsimSettings->meshSurfNormals = NULL;
|
||||
}
|
||||
|
||||
link_list(fd, &ob->prop);
|
||||
|
||||
@@ -96,14 +96,19 @@ typedef struct FluidsimSettings {
|
||||
|
||||
/* additional flags depending on the type, lower short contains flags
|
||||
* to check validity, higher short additional flags */
|
||||
int typeFlags;
|
||||
short typeFlags;
|
||||
char domainNovecgen,dummyc;
|
||||
|
||||
/* boundary "stickiness" for part slip values */
|
||||
float partSlipValue;
|
||||
/* particle generation - on if >0, then determines amount */
|
||||
float generateParticles, dummy;
|
||||
float generateParticles;
|
||||
/* smooth fluid surface? */
|
||||
float surfaceSmoothing;
|
||||
/* particle display - size scaling, and alpha influence */
|
||||
float particleInfSize, particleInfAlpha;
|
||||
/* testing vars */
|
||||
float farFieldSize,dummyf;
|
||||
|
||||
/* save fluidsurface normals in mvert.no, and surface vertex velocities (if available) in mvert.co */
|
||||
struct MVert *meshSurfNormals;
|
||||
@@ -119,13 +124,12 @@ typedef struct FluidsimSettings {
|
||||
#define OB_FLUIDSIM_OUTFLOW 32
|
||||
#define OB_FLUIDSIM_PARTICLE 64
|
||||
|
||||
#define OB_TYPEFLAG_START 16
|
||||
#define OB_TYPEFLAG_START 0
|
||||
#define OB_FSGEO_THIN (1<<(OB_TYPEFLAG_START+1))
|
||||
#define OB_FSBND_NOSLIP (1<<(OB_TYPEFLAG_START+2))
|
||||
#define OB_FSBND_PARTSLIP (1<<(OB_TYPEFLAG_START+3))
|
||||
#define OB_FSBND_FREESLIP (1<<(OB_TYPEFLAG_START+4))
|
||||
#define OB_FSINFLOW_LOCALCOORD (1<<(OB_TYPEFLAG_START+5))
|
||||
#define OB_FSDOMAIN_NOVECGEN (1<<(OB_TYPEFLAG_START+6))
|
||||
|
||||
// guiDisplayMode particle flags
|
||||
#define OB_FSDOM_GEOM 1
|
||||
|
||||
@@ -927,7 +927,7 @@ static void render_particle_system(Render *re, Object *ob, PartEff *paf)
|
||||
if(useFluidsimParticles) {
|
||||
// rescale to 1.0-10.0, then div by 5 afterwards, gives values in range 0.2-2.0
|
||||
double fspsize = ((double)pa->rt / 1000.0f) / 5.0 ;
|
||||
haloScale = (float)pow(fspsize, (double)ob->fluidsimSettings->particleInfSize);
|
||||
haloScale = 1.0/(float)pow(fspsize, (double)ob->fluidsimSettings->particleInfSize);
|
||||
ma->alpha = iniAlpha / (float)pow( fspsize, (double)ob->fluidsimSettings->particleInfAlpha);
|
||||
if(ma->alpha>1.) ma->alpha = 1.;
|
||||
}
|
||||
|
||||
@@ -2454,25 +2454,31 @@ static void object_panel_fluidsim(Object *ob)
|
||||
uiDefBut(block, LABEL, 0, "Domain boundary type settings:", 0,yline,300,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
yline -= lineHeight;
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 00, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 0, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
|
||||
uiBlockEndAlign(block);
|
||||
yline -= lineHeight;
|
||||
|
||||
uiDefBut(block, LABEL, 0, "PartSlipValue:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
if(fss->typeFlags&OB_FSBND_PARTSLIP) {
|
||||
uiDefBut(block, LABEL, 0, "PartSlipValue:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->partSlipValue, 0.0, 0.1, 10,0, ".");
|
||||
yline -= lineHeight;
|
||||
}
|
||||
} else { uiDefBut(block, LABEL, 0, "-", 150,yline,150,objHeight, NULL, 0.0, 0, 0, 0, ""); }
|
||||
yline -= lineHeight;
|
||||
// copied from obstacle...
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Generate Particles:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->generateParticles, 0.0, 10.0, 10,0, "Amount of particles to generate (0=off, 1=normal, >1=more).");
|
||||
yline -= lineHeight;
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Generate&Use SpeedVecs:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButBitI(block, TOG, OB_FSDOMAIN_NOVECGEN, REDRAWBUTSOBJECT, "Disable", 200, yline,100,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Default is to generate and use fluidsim vertex speed vectors, this option switches calculation off during bake, and disables loading.");
|
||||
uiDefBut(block, LABEL, 0, "Surface Smoothing:", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_DIFF, "", 200, yline,100,objHeight, &fss->surfaceSmoothing, 0.0, 5.0, 10,0, "Amount of surface smoothing (0=off, 1=normal, >1=stronger smoothing).");
|
||||
yline -= lineHeight;
|
||||
|
||||
// use new variable...
|
||||
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;
|
||||
// copied from obstacle...
|
||||
}
|
||||
}
|
||||
else if(
|
||||
@@ -2492,7 +2498,7 @@ static void object_panel_fluidsim(Object *ob)
|
||||
|
||||
if(fss->type == OB_FLUIDSIM_INFLOW) {
|
||||
uiDefBut(block, LABEL, 0, "Local Inflow Coords", 0,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButBitI(block, TOG, OB_FSINFLOW_LOCALCOORD, REDRAWBUTSOBJECT, "Enable", 200, yline,100,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Use local coordinates for inflow (e.g. for rotating objects).");
|
||||
uiDefButBitS(block, TOG, OB_FSINFLOW_LOCALCOORD, REDRAWBUTSOBJECT, "Enable", 200, yline,100,objHeight, &fss->typeFlags, 0, 0, 0, 0, "Use local coordinates for inflow (e.g. for rotating objects).");
|
||||
yline -= lineHeight;
|
||||
}
|
||||
}
|
||||
@@ -2504,31 +2510,26 @@ static void object_panel_fluidsim(Object *ob)
|
||||
yline -= lineHeight + 5;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 00, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
|
||||
uiDefButI(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Noslip", 00, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_NOSLIP, 20.0, 1.0, "Obstacle causes zero normal and tangential velocity (=sticky). Default for all. Only option for moving objects.");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Part", 100, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_PARTSLIP, 20.0, 2.0, "Mix between no-slip and free-slip. Non moving objects only!");
|
||||
uiDefButS(block, ROW, REDRAWBUTSOBJECT ,"Free", 200, yline,100,objHeight, &fss->typeFlags, 15.0, OB_FSBND_FREESLIP, 20.0, 3.0, "Obstacle only causes zero normal velocity (=not sticky). Non moving objects only!");
|
||||
uiBlockEndAlign(block);
|
||||
yline -= lineHeight;
|
||||
|
||||
uiDefBut(block, LABEL, 0, "PartSlipValue:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
if(fss->typeFlags&OB_FSBND_PARTSLIP) {
|
||||
uiDefBut(block, LABEL, 0, "PartSlipValue:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefButF(block, NUM, B_DIFF, "", 150, yline,150,objHeight, &fss->partSlipValue, 0.0, 0.1, 10,0, ".");
|
||||
yline -= lineHeight;
|
||||
}
|
||||
} else { uiDefBut(block, LABEL, 0, "-", 150,yline,150,objHeight, NULL, 0.0, 0, 0, 0, ""); }
|
||||
yline -= lineHeight;
|
||||
|
||||
yline -= lineHeight;
|
||||
}
|
||||
else if(fss->type == OB_FLUIDSIM_PARTICLE) {
|
||||
|
||||
if(fss->guiDisplayMode==0) fss->guiDisplayMode=2; // default drops
|
||||
uiDefBut(block, LABEL, 0, "Part.-Type:", 0,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
// TODO make toggle buttons
|
||||
//uiDefButS(block, MENU, B_FLUIDSIM_FORCEREDRAW, "Gui%t|Bubble %x2|Drop %x4|Newparts %x8|Float %x16",
|
||||
//100,yline,200,objHeight, &fss->guiDisplayMode, 0, 0, 0, 0, "Which type of particles to display.");
|
||||
//uiDefButS(block, MENU, B_DIFF, "Render%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.");
|
||||
uiDefBut(block, LABEL, 0, "Drops", 100,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
fss->guiDisplayMode = 4; // fix to drops for now
|
||||
if(fss->typeFlags==0) fss->typeFlags=4; // default drops
|
||||
fss->typeFlags = 4; // fix to drops for now
|
||||
uiDefBut(block, LABEL, 0, "Part.-Type:", 0,yline,100,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Drops", 100,yline,200,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
yline -= lineHeight;
|
||||
|
||||
uiDefBut(block, LABEL, 0, "Size Influence:", 0,yline,150,objHeight, NULL, 0.0, 0, 0, 0, "");
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
#include "blendef.h"
|
||||
#include "SDL.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_mutex.h"
|
||||
@@ -109,9 +110,6 @@ void initElbeemMesh(struct Object *ob, int *numVertices, float **vertices, int *
|
||||
extern int start_progress_bar(void);
|
||||
extern void end_progress_bar(void);
|
||||
extern int progress_bar(float done, char *busy_info);
|
||||
// global solver state
|
||||
extern int gElbeemState;
|
||||
extern char gElbeemErrorString[];
|
||||
|
||||
double fluidsimViscosityPreset[6] = {
|
||||
-1.0, /* unused */
|
||||
@@ -197,9 +195,11 @@ FluidsimSettings *fluidsimSettingsNew(struct Object *srcob)
|
||||
fluidsimGetAxisAlignedBB(srcob->data, srcob->obmat, fss->bbStart, fss->bbSize, &fss->meshBB);
|
||||
|
||||
fss->typeFlags = 0;
|
||||
fss->domainNovecgen = 0;
|
||||
fss->partSlipValue = 0.0;
|
||||
|
||||
fss->generateParticles = 0.0;
|
||||
fss->surfaceSmoothing = 1.0;
|
||||
fss->particleInfSize = 0.0;
|
||||
fss->particleInfAlpha = 0.0;
|
||||
|
||||
@@ -445,6 +445,24 @@ void fluidsimBake(struct Object *ob)
|
||||
return;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
) {
|
||||
if((!ob)&&(base->object->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(base->object->type==OB_MESH)) {
|
||||
if(base->object->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) {
|
||||
ob = base->object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// no domains found?
|
||||
if(!ob) return;
|
||||
}
|
||||
|
||||
/* check if there's another domain... */
|
||||
for(obit= G.main->object.first; obit; obit= obit->id.next) {
|
||||
if((obit->fluidsimFlag & OB_FLUIDSIM_ENABLE)&&(obit->type==OB_MESH)) {
|
||||
@@ -764,6 +782,8 @@ void fluidsimBake(struct Object *ob)
|
||||
fsset.gstar = domainSettings->gstar;
|
||||
fsset.maxRefine = domainSettings->maxRefine; // check <-> gridlevels
|
||||
fsset.generateParticles = domainSettings->generateParticles;
|
||||
fsset.surfaceSmoothing = domainSettings->surfaceSmoothing;
|
||||
fsset.farFieldSize = domainSettings->farFieldSize;
|
||||
strcpy( fsset.outputPath, targetFile);
|
||||
|
||||
// domain channels
|
||||
@@ -778,8 +798,7 @@ void fluidsimBake(struct Object *ob)
|
||||
else if((domainSettings->typeFlags&OB_FSBND_PARTSLIP)) fsset.obstacleType = FLUIDSIM_OBSTACLE_PARTSLIP;
|
||||
else if((domainSettings->typeFlags&OB_FSBND_FREESLIP)) fsset.obstacleType = FLUIDSIM_OBSTACLE_FREESLIP;
|
||||
fsset.obstaclePartslip = domainSettings->partSlipValue;
|
||||
fsset.generateVertexVectors = (int)(!(domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN));
|
||||
// fprintf(stderr," VVV %d %d \n",fsset.generateVertexVectors , (domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN)); // DEBUG
|
||||
fsset.generateVertexVectors = (domainSettings->domainNovecgen==0);
|
||||
|
||||
// init blender trafo matrix
|
||||
// fprintf(stderr,"elbeemInit - mpTrafo:\n");
|
||||
@@ -950,8 +969,8 @@ void fluidsimBake(struct Object *ob)
|
||||
" size = " "%d" /* gridSize*/ "; \n"
|
||||
" surfacepreview = " "%d" /* previewSize*/ "; \n"
|
||||
" dump_velocities = " "%d" /* vector dump */ "; \n"
|
||||
" smoothsurface = 1.0; \n"
|
||||
" smoothnormals = 1.0; \n"
|
||||
" smoothsurface = %f; \n" /* smoothing */
|
||||
" smoothnormals = %f; \n"
|
||||
" geoinitid = 1; \n" "\n"
|
||||
" isovalue = 0.4900; \n"
|
||||
" isoweightmethod = 1; \n" "\n" ;
|
||||
@@ -959,7 +978,7 @@ void fluidsimBake(struct Object *ob)
|
||||
fprintf(fileCfg, simString,
|
||||
(double)domainSettings->realsize, (double)domainSettings->animStart, (double)domainSettings->gstar,
|
||||
gridlevels, (int)domainSettings->resolutionxyz, (int)domainSettings->previewresxyz ,
|
||||
(int)(!(domainSettings->typeFlags&OB_FSDOMAIN_NOVECGEN))
|
||||
(int)(domainSettings->domainNovecgen==0), domainSettings->surfaceSmoothing
|
||||
);
|
||||
|
||||
if((domainSettings->typeFlags&OB_FSBND_NOSLIP)) bi=0;
|
||||
@@ -972,6 +991,7 @@ void fluidsimBake(struct Object *ob)
|
||||
fluidsimPrintChannel(fileCfg, channelDomainViscosity,allchannelSize,"p_viscosity",CHANNEL_FLOAT);
|
||||
fluidsimPrintChannel(fileCfg, channelDomainGravity, allchannelSize,"p_gravity",CHANNEL_VEC);
|
||||
|
||||
fprintf(fileCfg, " partgenprob = %f; \n", domainSettings->generateParticles); // debug test
|
||||
fprintf(fileCfg, "\n} \n" );
|
||||
}
|
||||
|
||||
@@ -1199,17 +1219,16 @@ void fluidsimBake(struct Object *ob)
|
||||
|
||||
if(!simAborted) {
|
||||
char fsmessage[512];
|
||||
char elbeemerr[256];
|
||||
strcpy(fsmessage,"Fluidsim Bake Error: ");
|
||||
// check if some error occurred
|
||||
if(globalBakeState==-2) {
|
||||
strcat(fsmessage,"Failed to initialize [Msg: ");
|
||||
#ifndef WIN32
|
||||
// msvc seems to have problem accessing the gElbeemErrorString var
|
||||
strcat(fsmessage,"[Msg: ");
|
||||
strcat(fsmessage,gElbeemErrorString);
|
||||
strcat(fsmessage,"]");
|
||||
#endif // WIN32
|
||||
strcat(fsmessage,"|OK%x0");
|
||||
|
||||
elbeemGetErrorString(elbeemerr);
|
||||
strcat(fsmessage,elbeemerr);
|
||||
|
||||
strcat(fsmessage,"] |OK%x0");
|
||||
pupmenu(fsmessage);
|
||||
} // init error
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
else if(G.qual==LR_CTRLKEY) {
|
||||
if(okee("Bake all selected")) {
|
||||
extern void softbody_bake(Object *ob);
|
||||
extern void fluidsimBake(Object *ob);
|
||||
softbody_bake(NULL);
|
||||
// also bake first domain of selected objects...
|
||||
fluidsimBake(NULL);
|
||||
}
|
||||
}
|
||||
else if(G.qual==0)
|
||||
|
||||
Reference in New Issue
Block a user