[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22128] branches/blender2.5/blender: Added ramp input and blend settings in RNA and layouts.

William Reynish william at reynish.com
Sun Aug 2 03:00:16 CEST 2009


Revision: 22128
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22128
Author:   billrey
Date:     2009-08-02 03:00:15 +0200 (Sun, 02 Aug 2009)

Log Message:
-----------
Added ramp input and blend settings in RNA and layouts.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_material.py
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c

Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py	2009-08-01 23:37:51 UTC (rev 22127)
+++ branches/blender2.5/blender/release/ui/buttons_material.py	2009-08-02 01:00:15 UTC (rev 22128)
@@ -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 @@
 			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 @@
 			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"

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2009-08-01 23:37:51 UTC (rev 22127)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2009-08-02 01:00:15 UTC (rev 22128)
@@ -477,7 +477,33 @@
 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");
 	RNA_def_property_array(prop, 3);
@@ -523,6 +549,31 @@
 	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)





More information about the Bf-blender-cvs mailing list