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 20:05:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-20 20:05:51 +0400
commit8eb41f0fdb77062d5828dd2c3e18ffeab5fd428c (patch)
tree1b81bf423db957bf39dc01521533f8a0872842d0 /source/blender/modifiers/intern/MOD_ocean.c
parent3c8d86e117b54914524cbc49a8678ecaad8671cf (diff)
parentf1eb66aa68105ac27f371f4f708d8abf3b7da38b (diff)
svn merge ^/trunk/blender -r41998:42009
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ocean.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index d609ffc23c4..d5c36f25a32 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,28 +127,14 @@ 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;
omd->bakeend = 250;
omd->oceancache = NULL;
omd->foam_fade = 0.98;
+ omd->foamlayername[0] = '\0'; /* layer name empty by default */
omd->ocean = BKE_add_ocean();
init_ocean_modifier(omd);
@@ -376,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;
@@ -409,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);
@@ -441,7 +429,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
if(cdlayer >= MAX_MCOL)
return dm;
- CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces);
+ CustomData_add_layer_named(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces, omd->foamlayername);
mc = dm->getFaceDataArray(dm, CD_MCOL);
mv = dm->getVertArray(dm);