[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17601] branches/blender2.5/blender/source /blender: * add diffuse shader properties for material

Nathan Letwory jesterking at letwory.net
Fri Nov 28 17:00:51 CET 2008


Revision: 17601
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17601
Author:   jesterking
Date:     2008-11-28 17:00:50 +0100 (Fri, 28 Nov 2008)

Log Message:
-----------
* add diffuse shader properties for material

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h	2008-11-28 07:12:32 UTC (rev 17600)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h	2008-11-28 16:00:50 UTC (rev 17601)
@@ -96,7 +96,9 @@
 	/* shaders */
 	short diff_shader, spec_shader;
 	float roughness, refrac;
-	float param[4];		/* size, smooth, size, smooth, for toonshader */
+	/* XXX param[4] needs review and improvement (shader system as whole anyway)
+	   This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */
+	float param[4];		/* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */
 	float rms;
 	float darkness;
 	short texco, mapto;

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2008-11-28 07:12:32 UTC (rev 17600)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2008-11-28 16:00:50 UTC (rev 17601)
@@ -42,15 +42,23 @@
 	
 	static EnumPropertyItem prop_type_items[] = {
 		{MA_RGB, "RGB", "RGB", ""},
-		{MA_CMYK, "CMYK", "CMYK", ""},
-		{MA_YUV, "YUV", "YUV", ""},
+		/*{MA_CMYK, "CMYK", "CMYK", ""}, 
+		{MA_YUV, "YUV", "YUV", ""},  XXX: blender code doesn't support this yet. Commented out */
 		{MA_HSV, "HSV", "HSV", ""},
 		{0, NULL, NULL, NULL}};
 	static EnumPropertyItem prop_fadeto_mir_items[] = {
 		{MA_RAYMIR_FADETOSKY, "RAYMIR_FADETOSKY", "Fade to sky color", ""},
 		{MA_RAYMIR_FADETOMAT, "RAYMIR_FADETOMAT", "Fade to material color", ""},
 		{0, NULL, NULL, NULL}};
+	static EnumPropertyItem prop_diff_shader_items[] = {
+		{MA_DIFF_LAMBERT, "DIFF_LAMBERT", "Lambert", ""},
+		{MA_DIFF_ORENNAYAR, "DIFF_ORENNAYAR", "Orennayar", ""},
+		{MA_DIFF_TOON, "DIFF_TOON", "Toon", ""},
+		{MA_DIFF_MINNAERT, "DIFF_MINNAERT", "Minnaert", ""},
+		{MA_DIFF_FRESNEL, "DIFF_FRESNEL", "Fresnel", ""},
+		{0, NULL, NULL, NULL}};
 	
+	
 	srna= RNA_def_struct(brna, "Material", "ID", "Material");
 		
 	prop= RNA_def_property(srna, "colormodel", PROP_ENUM, PROP_NONE);
@@ -82,6 +90,34 @@
 	RNA_def_property_ui_text(prop, "Ambient Color", "Ambient color.");
 	RNA_def_property_ui_range(prop, 0.0f , 1.0f, 10.0f, 3.0f);
 	
+	prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Alpha", "Alpha");
+	
+	/* diffuse shaders */
+	
+	prop= RNA_def_property(srna, "diff_shader", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_diff_shader_items);
+	RNA_def_property_ui_text(prop, "Diffuse Shader Model", "Diffuse shader model.");
+	
+	prop= RNA_def_property(srna, "ref", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Reflection", "Sets the amount of reflection.");
+	
+	prop= RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0f, 3.14f);
+	RNA_def_property_ui_text(prop, "Roughness", "Sets Oren Nayar Roughness");
+	
+	prop= RNA_def_property(srna, "params1_4", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "param");
+	RNA_def_property_array(prop, 4);
+	RNA_def_property_range(prop, 0.0f, 5.0f);
+	RNA_def_property_ui_text(prop, "Params 1-4", "Parameters used for diffuse and specular Toon, and diffuse Fresnel shaders. Check documentation for details.");
+	
+	prop= RNA_def_property(srna, "darkness", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0f, 2.0f);
+	RNA_def_property_ui_text(prop, "Darkness", "Sets Minnaert darkness.");
+	
 	/* raytrace mirror */
 	prop= RNA_def_property(srna, "mode_ray_mirror", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYMIRROR); /* use bitflags */





More information about the Bf-blender-cvs mailing list