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:
authorWilliam Reynish <william@reynish.com>2009-08-02 05:00:15 +0400
committerWilliam Reynish <william@reynish.com>2009-08-02 05:00:15 +0400
commit41b72408a96167d2afc53a325e3b9024f1d717e7 (patch)
treea263e49f84e8b562a4c43fb82f0e6090a03b21dc
parenta9da1fc0e8af5371444ba15626fce918d4c15e4d (diff)
Added ramp input and blend settings in RNA and layouts.
-rw-r--r--release/ui/buttons_material.py27
-rw-r--r--source/blender/makesrna/intern/rna_material.c51
2 files changed, 71 insertions, 7 deletions
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py
index c04fbd7e1da..7153dce3074 100644
--- a/release/ui/buttons_material.py
+++ b/release/ui/buttons_material.py
@@ -1,12 +1,6 @@
import bpy
-# If python version is less than 2.4, try to get set stuff from module
-try:
- set
-except:
- from sets import Set as set
-
class MaterialButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
@@ -240,8 +234,18 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
row.itemR(mat, "diffuse_fresnel", text="Fresnel")
row.itemR(mat, "diffuse_fresnel_factor", text="Factor")
- elif mat.use_diffuse_ramp:
+ if mat.use_diffuse_ramp:
+ layout.itemS()
layout.template_color_ramp(mat.diffuse_ramp, expand=True)
+ layout.itemS()
+ row = layout.row()
+ split = row.split(percentage=0.3)
+ split.itemL(text="Input:")
+ split.itemR(mat, "diffuse_ramp_input", text="")
+ split = row.split(percentage=0.3)
+ split.itemL(text="Blend:")
+ split.itemR(mat, "diffuse_ramp_blend", text="")
+
class MATERIAL_PT_specular(MaterialButtonsPanel):
__label__ = "Specular"
@@ -282,7 +286,16 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
row.itemR(mat, "specular_toon_smooth", text="Smooth")
if mat.use_specular_ramp:
+ layout.itemS()
layout.template_color_ramp(mat.specular_ramp, expand=True)
+ layout.itemS()
+ row = layout.row()
+ split = row.split(percentage=0.3)
+ split.itemL(text="Input:")
+ split.itemR(mat, "specular_ramp_input", text="")
+ split = row.split(percentage=0.3)
+ split.itemL(text="Blend:")
+ split.itemR(mat, "specular_ramp_blend", text="")
class MATERIAL_PT_sss(MaterialButtonsPanel):
__label__ = "Subsurface Scattering"
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index d7c677d05f3..eb908bcd2bd 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -477,6 +477,32 @@ static void rna_def_material_mtex(BlenderRNA *brna)
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");
@@ -523,6 +549,31 @@ static void rna_def_material_colors(StructRNA *srna)
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)