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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 01:31:17 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 01:31:17 +0400
commiteb80ce4d7f24778e1edcc3c88a9b071dd2e25b4c (patch)
tree34a3ce693e362b69d5c01e8404b310ba4eca1304 /source/blender/makesrna/intern/rna_material.c
parent1b142434055e2b56b23991f0c9d695b6d4f33390 (diff)
2.5: Materials
* Diffuse/specular ramps works again. * Wire is now a material type next to Surface and Halo. * Removed Volume material type option until it is actually there. * Some button layout tweaks.
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r--source/blender/makesrna/intern/rna_material.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 2eab89e43b2..f8cead563ff 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -166,6 +166,28 @@ static void rna_MaterialTextureSlot_enabled_set(PointerRNA *ptr, int value)
}
}
+static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
+{
+ Material *ma= (Material*)ptr->data;
+
+ if(value) ma->mode |= MA_RAMP_COL;
+ else ma->mode &= ~MA_RAMP_COL;
+
+ if((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
+ ma->ramp_col= add_colorband(0);
+}
+
+static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
+{
+ Material *ma= (Material*)ptr->data;
+
+ if(value) ma->mode |= MA_RAMP_SPEC;
+ else ma->mode &= ~MA_RAMP_SPEC;
+
+ if((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
+ ma->ramp_spec= add_colorband(0);
+}
+
#else
static void rna_def_material_mtex(BlenderRNA *brna)
@@ -477,11 +499,23 @@ static void rna_def_material_colors(StructRNA *srna)
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
/* Color bands */
+ prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_COL);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_diffuse_ramp_set");
+ RNA_def_property_ui_text(prop, "Use Diffuse Ramp", "Toggle diffuse ramp operations.");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
prop= RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ramp_col");
RNA_def_property_struct_type(prop, "ColorRamp");
RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading.");
+ prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_specular_ramp_set");
+ RNA_def_property_ui_text(prop, "Use Specular Ramp", "Toggle specular ramp operations.");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
prop= RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec");
RNA_def_property_struct_type(prop, "ColorRamp");
@@ -912,7 +946,7 @@ void rna_def_material_specularity(StructRNA *srna)
{
PropertyRNA *prop;
- static EnumPropertyItem prop_spec_shader_items[] = {
+ static EnumPropertyItem prop_specular_shader_items[] = {
{MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", ""},
{MA_SPEC_PHONG, "PHONG", 0, "Phong", ""},
{MA_SPEC_BLINN, "BLINN", 0, "Blinn", ""},
@@ -920,9 +954,9 @@ void rna_def_material_specularity(StructRNA *srna)
{MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", ""},
{0, NULL, 0, NULL, NULL}};
- prop= RNA_def_property(srna, "spec_shader", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spec_shader");
- RNA_def_property_enum_items(prop, prop_spec_shader_items);
+ RNA_def_property_enum_items(prop, prop_specular_shader_items);
RNA_def_property_ui_text(prop, "Specular Shader Model", "");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
@@ -1042,7 +1076,8 @@ void RNA_def_material(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface."},
- {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."},
+ {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)."},
+ // {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."},
{MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles."},
{0, NULL, 0, NULL, NULL}};
@@ -1128,14 +1163,9 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
- prop= RNA_def_property(srna, "wireframe", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_WIRE);
- RNA_def_property_ui_text(prop, "Wireframe", "Render the edges of faces as wires (not supported in ray tracing).");
- RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-
- prop= RNA_def_property(srna, "z_buffer", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "z_transparency", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA);
- RNA_def_property_ui_text(prop, "Z Buffer", "Enable Z-buffering of transparent faces");
+ RNA_def_property_ui_text(prop, "Z Transparency", "Enable alpha buffer for transparent faces.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
prop= RNA_def_property(srna, "vertex_color_light", PROP_BOOLEAN, PROP_NONE);