diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-20 20:05:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-20 20:05:51 +0400 |
commit | 8eb41f0fdb77062d5828dd2c3e18ffeab5fd428c (patch) | |
tree | 1b81bf423db957bf39dc01521533f8a0872842d0 /source/blender/modifiers/intern/MOD_fluidsim_util.c | |
parent | 3c8d86e117b54914524cbc49a8678ecaad8671cf (diff) | |
parent | f1eb66aa68105ac27f371f4f708d8abf3b7da38b (diff) |
svn merge ^/trunk/blender -r41998:42009
Diffstat (limited to 'source/blender/modifiers/intern/MOD_fluidsim_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 236351a5e29..fa699e449db 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -69,8 +69,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) if(fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); - int surfdataPathMax = FILE_MAX; - + fluidmd->fss = fss; if(!fss) @@ -103,24 +102,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) // fluid/inflow settings // fss->iniVel --> automatically set to 0 - /* elubie: changed this to default to the same dir as the render output - to prevent saving to C:\ on Windows */ - if (G.relbase_valid) { /* is the .blend saved? */ - /* subfolder next to saved file */ - BLI_strncpy(fss->surfdataPath, "//fluid_cache", surfdataPathMax); - BLI_add_slash(fss->surfdataPath); - } - else { - /* subfolder in temp. directory */ - BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), surfdataPathMax); - surfdataPathMax -= strlen(fss->surfdataPath); - if (surfdataPathMax > 1) { - BLI_strncpy(fss->surfdataPath+strlen(fss->surfdataPath), "fluid_cache", surfdataPathMax); - surfdataPathMax -= strlen("fluid_cache"); - if (surfdataPathMax > 1) - BLI_add_slash(fss->surfdataPath); - } - } + modifier_path_init(fss->surfdataPath, sizeof(fss->surfdataPath), "fluid_cache"); // first init of bounding box // no bounding box needed @@ -461,11 +443,11 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * gzclose(gzf); } -static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int displaymode = 0; int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */ - char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; + char targetFile[FILE_MAXFILE+FILE_MAXDIR]; FluidsimSettings *fss = fluidmd->fss; DerivedMesh *dm = NULL; MFace *mface; @@ -478,27 +460,22 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData displaymode = fss->renderDisplayMode; } - BLI_strncpy(targetDir, fss->surfdataPath, sizeof(targetDir)); - - // use preview or final mesh? - if(displaymode==1) - { - // just display original object + switch (displaymode) { + case 1: + /* just display original object */ return NULL; + case 2: + /* use preview mesh */ + BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME); + break; + default: /* 3 */ + /* 3. use final mesh */ + BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME); + break; } - else if(displaymode==2) - { - strcat(targetDir,"fluidsurface_preview_####"); - } - else - { // 3 - strcat(targetDir,"fluidsurface_final_####"); - } - - BLI_path_abs(targetDir, G.main->name); - BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no - BLI_snprintf(targetFile, sizeof(targetFile), "%s.bobj.gz", targetDir); + BLI_path_abs(targetFile, modifier_path_relbase(ob)); + BLI_path_frame(targetFile, curFrame, 0); // fixed #frame-no dm = fluidsim_read_obj(targetFile); @@ -554,7 +531,7 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData #endif // WITH_MOD_FLUID DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, - Object *UNUSED(ob), + Object *ob, DerivedMesh *dm, int useRenderParams, int UNUSED(isFinalCalc)) { @@ -587,7 +564,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ - if((result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams))) + if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) return result; return dm; |