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:
authorCampbell Barton <ideasman42@gmail.com>2011-11-16 23:06:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-16 23:06:38 +0400
commit9d05ccf9e84510ca7e3fe140f6e20991a931b8ce (patch)
treef8f7241b779c9049d853a5e824db2dd150228ebe /source/blender/modifiers/intern/MOD_ocean.c
parent707fcc42a390e91aedd858588c30d04fea43f0e6 (diff)
parent1af839081b7adcc3ceb13e5e7cc579b309e90915 (diff)
svn merge -r41899:41926 ^/trunk/blender. also sync mempool with trunk and move BLI_mempool_alloc out of mempools header where it was inlined
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ocean.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 7f20b4c7bc1..d609ffc23c4 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -34,10 +34,12 @@
#include "DNA_scene_types.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_global.h"
#include "BKE_modifier.h"
#include "BKE_ocean.h"
#include "BKE_utildefines.h"
+#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_math_inline.h"
#include "BLI_utildefines.h"
@@ -95,6 +97,7 @@ static void initData(ModifierData *md)
{
#ifdef WITH_OCEANSIM
OceanModifierData *omd = (OceanModifierData*) md;
+ int cachepathmax = sizeof(omd->cachepath);
omd->resolution = 7;
omd->spatial_size = 50;
@@ -122,7 +125,22 @@ static void initData(ModifierData *md)
omd->repeat_x = 1;
omd->repeat_y = 1;
- BLI_strncpy(omd->cachepath, "//ocean_cache", sizeof(omd->cachepath));
+ if (G.relbase_valid) { /* is the .blend saved? */
+ /* subfolder next to saved file */
+ BLI_strncpy(omd->cachepath, "//ocean_cache", cachepathmax);
+ BLI_add_slash(omd->cachepath);
+ }
+ else {
+ /* subfolder in temp. directory */
+ BLI_strncpy(omd->cachepath, BLI_temporary_dir(), cachepathmax);
+ cachepathmax -= strlen(omd->cachepath);
+ if (cachepathmax > 1) {
+ BLI_strncpy(omd->cachepath+strlen(omd->cachepath), "ocean_cache", cachepathmax);
+ cachepathmax -= strlen("ocean_cache");
+ if (cachepathmax > 1)
+ BLI_add_slash(omd->cachepath);
+ }
+ }
omd->cached = 0;
omd->bakestart = 1;