Option to rename the vertex color data layer used by Ocean modifier for foam. The...
authorLukas Toenne <lukas.toenne@googlemail.com>
Sun, 20 Nov 2011 14:16:41 +0000 (14:16 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Sun, 20 Nov 2011 14:16:41 +0000 (14:16 +0000)
http://www.pasteall.org/pic/21120

release/scripts/startup/bl_ui/properties_data_modifier.py
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/modifiers/intern/MOD_ocean.c

index e685de416ed1092616cf7e21bbbf703c837d049d..52b5ed5f36edc6cca90ccb37668de428bfc2624f 100644 (file)
@@ -455,11 +455,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
         layout.prop(md, "use_normals")
 
+        layout.prop(md, "use_foam")
         row = layout.row()
-        row.prop(md, "use_foam")
-        sub = row.row()
-        sub.active = md.use_foam
-        sub.prop(md, "foam_coverage", text="Coverage")
+        row.active = md.use_foam
+        col = row.column()
+        col.prop(md, "foam_coverage", text="Coverage")
+        col = row.column()
+        col.label("Foam Data Layer Name")
+        col.prop(md, "foam_layer_name", text="")
 
         layout.separator()
 
index c009b9cc5fbad4454a1288836168451285d7bdc4..ed3d42a9da702a0c748013e2b56e2edbcf452b96 100644 (file)
@@ -777,6 +777,7 @@ typedef struct OceanModifierData {
        int             bakeend;
        
        char    cachepath[240]; // FILE_MAX
+       char    foamlayername[32];
        char    cached;
        char    geometry_mode;
 
index b95224e6703ebcc6ec7c6953b8a295fc6d8ee06b..6885000ce18f26452d643cdc7a3ca72045007232 100644 (file)
@@ -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", "");
index 55d121737c1ed6e7e86ecc2eee8df04654e9723f..726c37811fb8892aa9be827fc6e37625137dd53b 100644 (file)
@@ -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);