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:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-08-03 18:06:47 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-08-03 18:06:47 +0400
commit2065c5cf605ea6147cb4097cf4aca7ac003a1ba1 (patch)
tree19d0ff6a5eada1458c86390fe10e20c322a8c2fd /source/blender/makesrna/intern/rna_material.c
parent4086ca58e275816a49950f6ac0cbffa6cb36a8ad (diff)
parent28909178d96ff04c22091ccd992314617352e1f0 (diff)
Merge with 2.5 -r 21756:22173.
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r--source/blender/makesrna/intern/rna_material.c277
1 files changed, 226 insertions, 51 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 133a3f50567..fb79ec88c4c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -85,28 +85,31 @@ static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA
static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr)
{
Material *ma= (Material*)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, ma->mtex[(int)ma->texact]);
+ Tex *tex;
+
+ tex= (ma->mtex[(int)ma->texact])? ma->mtex[(int)ma->texact]->tex: NULL;
+ return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
}
-static void rna_Material_active_texture_index_set(PointerRNA *ptr, int value)
+static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value)
{
Material *ma= (Material*)ptr->data;
int act= ma->texact;
- if(value == act || value < 0 || value >= MAX_MTEX)
- return;
+ if(ma->mtex[act] && ma->mtex[act]->tex)
+ id_us_min(&ma->mtex[act]->tex->id);
- /* auto create/free mtex on activate/deactive, so we can edit
- * the texture pointer in the buttons UI. */
- if(ma->mtex[act] && !ma->mtex[act]->tex) {
+ if(value.data) {
+ if(!ma->mtex[act])
+ ma->mtex[act]= add_mtex();
+
+ ma->mtex[act]->tex= value.data;
+ id_us_plus(&ma->mtex[act]->tex->id);
+ }
+ else if(ma->mtex[act]) {
MEM_freeN(ma->mtex[act]);
ma->mtex[act]= NULL;
}
-
- ma->texact= value;
-
- if(!ma->mtex[value])
- ma->mtex[value]= add_mtex();
}
static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max)
@@ -166,6 +169,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)
@@ -231,99 +256,122 @@ static void rna_def_material_mtex(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "texco");
RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
RNA_def_property_ui_text(prop, "Texture Coordinates", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "object");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "uvname");
RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "from_dupli", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
- RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent (only for UV and Orco texture coordinates).");
+ RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "from_original", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG);
RNA_def_property_ui_text(prop, "From Original", "Dupli's derive their object coordinates from the original objects transformation.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "map_colordiff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
- RNA_def_property_ui_text(prop, "Color", "Causes the texture to affect basic color of the material");
+ RNA_def_property_ui_text(prop, "Diffuse Color", "Causes the texture to affect basic color of the material");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_NORM);
RNA_def_property_ui_text(prop, "Normal", "Causes the texture to affect the rendered normal");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_colorspec", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLSPEC);
- RNA_def_property_ui_text(prop, "Specularity Color", "Causes the texture to affect the specularity color");
+ RNA_def_property_ui_text(prop, "Specular Color", "Causes the texture to affect the specularity color");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_mirror", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLMIR);
RNA_def_property_ui_text(prop, "Mirror", "Causes the texture to affect the mirror color");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "map_reflection", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "map_diffuse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REF);
- RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the value of the materials reflectivity");
+ RNA_def_property_ui_text(prop, "Diffuse", "Causes the texture to affect the value of the materials diffuse reflectivity");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "map_specularity", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "map_specular", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SPEC);
- RNA_def_property_ui_text(prop, "Specularity", "Causes the texture to affect the value of specularity");
+ RNA_def_property_ui_text(prop, "Specular", "Causes the texture to affect the value of specular reflectivity");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_ambient", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB);
RNA_def_property_ui_text(prop, "Ambient", "Causes the texture to affect the value of ambient");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_hardness", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_HAR);
RNA_def_property_ui_text(prop, "Hardness", "Causes the texture to affect the hardness value");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_raymir", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_RAYMIRR);
RNA_def_property_ui_text(prop, "Ray-Mirror", "Causes the texture to affect the ray-mirror value");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_alpha", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
RNA_def_property_ui_text(prop, "Alpha", "Causes the texture to affect the alpha value");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_emit", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMIT);
RNA_def_property_ui_text(prop, "Emit", "Causes the texture to affect the emit value");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_translucency", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSLU);
RNA_def_property_ui_text(prop, "Translucency", "Causes the texture to affect the translucency value");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_displacement", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DISPLACE);
RNA_def_property_ui_text(prop, "Displacement", "Let the texture displace the surface");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "map_warp", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_WARP);
RNA_def_property_ui_text(prop, "Warp", "Let the texture warp texture coordinates of next channels");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "x_mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "projx");
RNA_def_property_enum_items(prop, prop_x_mapping_items);
RNA_def_property_ui_text(prop, "X Mapping", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "y_mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "projy");
RNA_def_property_enum_items(prop, prop_y_mapping_items);
RNA_def_property_ui_text(prop, "Y Mapping", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "z_mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "projz");
RNA_def_property_enum_items(prop, prop_z_mapping_items);
RNA_def_property_ui_text(prop, "Z Mapping", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mapping_items);
RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
/* XXX: pmapto, pmaptoneg */
@@ -331,31 +379,130 @@ static void rna_def_material_mtex(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "normapspace");
RNA_def_property_enum_items(prop, prop_normal_map_space_items);
RNA_def_property_ui_text(prop, "Normal Map Space", "");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
/* XXX: MTex.which_output */
/* XXX: MTex.k */
- prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_VECTOR);
+ prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dispfac");
- RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_VECTOR);
+ prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "warpfac");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects color values.");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects texture coordinates of next channels.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "colorspec_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "colfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Specular Color Factor", "Amount texture affects specular color.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "colordiff_factor", PROP_FLOAT, PROP_VECTOR);
+ RNA_def_property_float_sdna(prop, NULL, "colfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "colfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Mirror Factor", "Amount texture affects mirror color.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "varfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient.");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_enabled_get", "rna_MaterialTextureSlot_enabled_set");
RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
+ prop= RNA_def_property(srna, "new_bump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEW_BUMP);
+ RNA_def_property_ui_text(prop, "New Bump", "Use new, corrected bump mapping code (backwards compatibility option).");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
}
static void rna_def_material_colors(StructRNA *srna)
{
PropertyRNA *prop;
+
+ static EnumPropertyItem prop_ramp_blend_diffuse_items[] = {
+ {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
+ {MA_RAMP_ADD, "ADD", 0, "Add", ""},
+ {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
+ {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
+ {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
+ {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
+ {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
+ {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
+ {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""},
+ {MA_RAMP_BURN, "BURN", 0, "Burn", ""},
+ {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
+ {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
+ {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
+ {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_ramp_input_items[] = {
+ {MA_RAMP_IN_SHADER, "SHADER", 0, "Shader", ""},
+ {MA_RAMP_IN_ENERGY, "ENERGY", 0, "Energy", ""},
+ {MA_RAMP_IN_NOR, "NORMAL", 0, "Normal", ""},
+ {MA_RAMP_IN_RESULT, "RESULT", 0, "Result", ""},
+ {0, NULL, 0, NULL, NULL}};
prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "r");
@@ -381,15 +528,52 @@ 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");
RNA_def_property_ui_text(prop, "Specular Ramp", "Color ramp used to affect specular shading.");
+
+ prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rampblend_col");
+ RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items);
+ RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
+ prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec");
+ RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items);
+ RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
+ prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rampin_col");
+ RNA_def_property_enum_items(prop, prop_ramp_input_items);
+ RNA_def_property_ui_text(prop, "Diffuse Ramp Input", "");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
+
+ prop= RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rampin_spec");
+ RNA_def_property_enum_items(prop, prop_ramp_input_items);
+ RNA_def_property_ui_text(prop, "Specular Ramp Input", "");
+ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
+
}
static void rna_def_material_diffuse(StructRNA *srna)
@@ -457,8 +641,8 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_fadeto_mir_items[] = {
- {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Fade to Sky Color", ""},
- {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Fade to Material Color", ""},
+ {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Sky", ""},
+ {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Material", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "MaterialRaytraceMirror", NULL);
@@ -784,13 +968,13 @@ static void rna_def_material_sss(BlenderRNA *brna)
prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sss_colfac");
- RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sss_texfac");
- RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor.");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
@@ -816,7 +1000,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", ""},
@@ -824,9 +1008,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);
@@ -946,7 +1130,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}};
@@ -1032,9 +1217,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).");
+ 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 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);
@@ -1111,11 +1296,6 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_V);
RNA_def_property_ui_text(prop, "Tangent Shading", "Use the material's tangent vector instead of the normal for shading - for anisotropic shading effects");
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-
- 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, "ZTransp", "Z-buffer transparency");
- RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
/* nested structs */
prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NEVER_NULL);
@@ -1150,12 +1330,8 @@ void RNA_def_material(BlenderRNA *brna)
/* common */
rna_def_animdata_common(srna);
- rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", "rna_Material_active_texture_index_set", "MaterialTextureSlot");
-
- prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "scriptlink");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this material.");
+ rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
+ "rna_Material_active_texture_set", "MaterialTextureSlot");
rna_def_material_colors(srna);
rna_def_material_diffuse(srna);
@@ -1183,14 +1359,13 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures.");
prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, structname);
- RNA_def_property_pointer_funcs(prop, activeget, NULL, NULL);
+ RNA_def_property_struct_type(prop, "Texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL);
RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed.");
prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "texact");
- RNA_def_property_int_funcs(prop, NULL, activeset, NULL);
RNA_def_property_range(prop, 0, MAX_MTEX-1);
RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot.");
}