diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-16 16:43:12 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-16 16:43:12 +0400 |
commit | 391f40e8c9647c2c436ef8681061d57300d2f287 (patch) | |
tree | 844890e663a98857d9668f2a1f467fb3a303b99a /source/blender/modifiers/intern/MOD_fluidsim_util.c | |
parent | eff7e18dc50587a853093d2ddf27e551786e05a1 (diff) |
Default cache file paths for ocean and fluidsim modifiers are now "<temp folder>/ocean_cache/" and "<temp_folder>/fluid_cache/" when the file is not saved yet at the time the modifiers are created.
If it has been saved, the file paths are relative to the .blend: "//ocean_cache/" and "//fluid_cache/".
This should at least partially fix bug #29273. Particle external point caches are not changed.
http://projects.blender.org/tracker/?func=detail&atid=498&aid=29273&group_id=9
Diffstat (limited to 'source/blender/modifiers/intern/MOD_fluidsim_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 1baa03d2063..15e1cdfcb62 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -69,6 +69,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) if(fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); + int surfdataPathMax = FILE_MAX; fluidmd->fss = fss; @@ -104,7 +105,22 @@ void fluidsim_init(FluidsimModifierData *fluidmd) /* elubie: changed this to default to the same dir as the render output to prevent saving to C:\ on Windows */ - BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), FILE_MAX); + 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); + } + } // first init of bounding box // no bounding box needed |