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
path: root/source
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2011-11-20 18:16:41 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2011-11-20 18:16:41 +0400
commit17b113c784aa30cf7ea06f0970a4427620fef4dc (patch)
tree737dbb33a1ca3cec098a6e2bae0c27e3a36e2b28 /source
parent9000db36312cdc514f2ffd967148eef13ed2e67f (diff)
Option to rename the vertex color data layer used by Ocean modifier for foam. The modifier outputs foam values to both textures and a (temporary) vertex data layer. This layer was unnamed before, which makes it impossible to access in shader nodes. Now the user can input a custom name in the modifier panel, then use that same name in a shader input node to access foam values.
http://www.pasteall.org/pic/21120
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index c009b9cc5fb..ed3d42a9da7 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -777,6 +777,7 @@ typedef struct OceanModifierData {
int bakeend;
char cachepath[240]; // FILE_MAX
+ char foamlayername[32];
char cached;
char geometry_mode;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index b95224e6703..6885000ce18 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2993,6 +2993,11 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
RNA_def_property_update(prop, 0, NULL);
+ prop= RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "foamlayername");
+ RNA_def_property_ui_text(prop, "Foam Layer Name", "Name of the vertex color layer used for foam");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop= RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "chop_amount");
RNA_def_property_ui_text(prop, "Choppiness", "");
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 55d121737c1..726c37811fb 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -147,6 +147,7 @@ static void initData(ModifierData *md)
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);
@@ -441,7 +442,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);