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:
authorJanne Karhu <jhkarh@gmail.com>2010-11-24 13:56:15 +0300
committerJanne Karhu <jhkarh@gmail.com>2010-11-24 13:56:15 +0300
commit2512c6ce881e11b7cdc96d12a1de2f712237d7c3 (patch)
tree338811c78235548d64dfc459956bc5d36df549bf /source/blender/modifiers/intern/MOD_fluidsim_util.c
parent05f2e47ff091de670e6f871daea60276b8171724 (diff)
Fixes for [#24862] Fluid Simulator issues
* Fluid baking (using the job system) didn't update the "lastgoodframe" anymore, so reversing the frames didn't work. Now the last valid frame is checked by going through all fluid bake files when "reverse frames" is selected. * There was all kinds of fancy checks done in the fluid modifier for reading a different frame in different cases, but as the "lastgoodframe" was really not working I don't see the point of this whole code, so removed it for now. The new functionality is: if the fluid data for current frame exists use it, otherwise just return unmodified domain mesh without any fancy backup plans. * There were also some errors on reading uncompleted files (scrubbing timeline while bake was running), so I made the fluid file reader just return null if the number of faces didn't correspond to to actually read data. Previously this just printed an error to the console.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_fluidsim_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 6e6b9f43c54..07de73766f4 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -275,8 +275,13 @@ DerivedMesh *fluidsim_read_obj(char *filename)
/* read no. of triangles */
gotBytes = gzread(gzf, &wri, sizeof(wri));
- if(wri!=numfaces)
+ if(wri!=numfaces) {
printf("Fluidsim: error in reading data from file.\n");
+ if(dm)
+ dm->release(dm);
+ gzclose( gzf );
+ return NULL;
+ }
// read triangles from file
mface = CDDM_get_faces(dm);
@@ -540,7 +545,6 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid
return dm;
}
-
#endif // DISABLE_ELBEEM
DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
@@ -567,7 +571,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
// timescale not supported yet
// clmd->sim_parms->timescale= timescale;
-
+
// support reversing of baked fluid frames here
if((fss->flag & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0))
{
@@ -576,39 +580,9 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
}
/* try to read from cache */
- if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams)))
- {
- // fss->lastgoodframe = framenr; // set also in src/fluidsim.c
+ /* if the frame is there, fine, otherwise don't do anything */
+ if((result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams)))
return result;
- }
- else
- {
- // display last known good frame
- if(fss->lastgoodframe >= 0)
- {
- if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams)))
- {
- return result;
- }
-
- // it was supposed to be a valid frame but it isn't!
- fss->lastgoodframe = framenr - 1;
-
-
- // this could be likely the case when you load an old fluidsim
- if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams)))
- {
- return result;
- }
- }
-
- result = CDDM_copy(dm);
-
- if(result)
- {
- return result;
- }
- }
return dm;
#else