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-20 18:38:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-20 18:38:11 +0400
commitf1eb66aa68105ac27f371f4f708d8abf3b7da38b (patch)
tree77ce3c813f25702880e330740e06ae60a0aadca8 /source/blender/modifiers/intern/MOD_ocean.c
parentbe701c7336a3f967a3a2807f8a7a0c511cb76815 (diff)
share code for fluidsim, ocean & dynamic paint file paths.
- use BLI_join_dirfile for joining all paths (no need to ensure slash is appended). - paths from linked library files now supported.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ocean.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 726c37811fb..3ba49f26449 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -48,10 +48,13 @@
#include "MOD_util.h"
#ifdef WITH_OCEANSIM
-static void init_cache_data(struct OceanModifierData *omd)
+static void init_cache_data(Object *ob, struct OceanModifierData *omd)
{
- omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale,
- omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
+ const char *relbase= modifier_path_relbase(ob);
+
+ omd->oceancache = BKE_init_ocean_cache(omd->cachepath, relbase,
+ omd->bakestart, omd->bakeend, omd->wave_scale,
+ omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
}
static void clear_cache_data(struct OceanModifierData *omd)
@@ -97,7 +100,6 @@ static void initData(ModifierData *md)
{
#ifdef WITH_OCEANSIM
OceanModifierData *omd = (OceanModifierData*) md;
- int cachepathmax = sizeof(omd->cachepath);
omd->resolution = 7;
omd->spatial_size = 50;
@@ -125,22 +127,7 @@ static void initData(ModifierData *md)
omd->repeat_x = 1;
omd->repeat_y = 1;
- 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);
- }
- }
+ modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "ocean_cache");
omd->cached = 0;
omd->bakestart = 1;
@@ -377,9 +364,9 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
return result;
}
-static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
- DerivedMesh *derivedData,
- int UNUSED(useRenderParams))
+static DerivedMesh *doOcean(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams))
{
OceanModifierData *omd = (OceanModifierData*) md;
@@ -410,7 +397,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
/* do ocean simulation */
if (omd->cached == TRUE) {
- if (!omd->oceancache) init_cache_data(omd);
+ if (!omd->oceancache) init_cache_data(ob, omd);
BKE_simulate_ocean_cache(omd->oceancache, md->scene->r.cfra);
} else {
simulate_ocean_modifier(omd);