Revision: 21901
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21901
Author:   blendix
Date:     2009-07-25 23:31:17 +0200 (Sat, 25 Jul 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_material.py
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
    
branches/blender2.5/blender/source/blender/render/intern/source/convertblender.c
    branches/blender2.5/blender/source/blender/render/intern/source/rayshade.c
    branches/blender2.5/blender/source/blender/render/intern/source/shadbuf.c
    branches/blender2.5/blender/source/blender/render/intern/source/shadeinput.c
    branches/blender2.5/blender/source/blender/render/intern/source/zbuf.c
    
branches/blender2.5/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py  2009-07-25 
20:59:09 UTC (rev 21900)
+++ branches/blender2.5/blender/release/ui/buttons_material.py  2009-07-25 
21:31:17 UTC (rev 21901)
@@ -75,40 +75,23 @@
                if mat:
                        layout.itemR(mat, "type", expand=True)
 
-                       if mat.type == 'SURFACE':
+                       if mat.type in ('SURFACE', 'WIRE', 'VOLUME'):
                                split = layout.split()
        
                                sub = split.column()
-                               sub.itemR(mat, "z_buffer")
                                sub.itemR(mat, "alpha", slider=True)
                                sub.itemR(mat, "ambient", slider=True)
                                sub.itemR(mat, "emit")
+                               sub.itemR(mat, "translucency", slider=True)
                                
                                sub = split.column()
+                               sub.itemR(mat, "z_transparency")
                                sub.itemR(mat, "shadeless")     
-                               sub.itemR(mat, "wireframe")
-                               
                                sub.itemR(mat, "tangent_shading")
                                sub.itemR(mat, "cubic", slider=True)
                                
-                       elif mat.type == 'VOLUME':
-                               split = layout.split()
-       
-                               sub = split.column()
-                               sub.itemR(mat, "z_buffer")
-                               sub.itemR(mat, "alpha", slider=True)
-                               sub.itemR(mat, "ambient", slider=True)
-                               sub.itemR(mat, "emit")
-                               
-                               sub = split.column()
-                               sub.itemR(mat, "shadeless")     
-                               sub.itemR(mat, "wireframe")
-                               
-                               sub.itemR(mat, "tangent_shading")
-                               sub.itemR(mat, "cubic", slider=True)
                        elif mat.type == 'HALO':
                                layout.itemR(mat, "alpha", slider=True)
-
                        
 class MATERIAL_PT_strand(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_strand"
@@ -158,18 +141,24 @@
                sub.itemR(mat, "full_oversampling")
                sub.itemR(mat, "sky")
                sub.itemR(mat, "exclude_mist")
+               sub.itemR(mat, "invert_z")
+
+               col = sub.column(align=True)
+               col.itemL(text="Light Group:")
+               col.itemR(mat, "light_group", text="")
+               row = col.row()
+               row.active = mat.light_group
+               row.itemR(mat, "light_group_exclusive", text="Exclusive")
+
                sub = split.column()
                sub.itemR(mat, "face_texture")
                colsub = sub.column()
                colsub.active = mat.face_texture
                colsub.itemR(mat, "face_texture_alpha")
-               sub.itemR(mat, "invert_z")
-               sub.itemR(mat, "light_group")
-               sub.itemR(mat, "light_group_exclusive")
-               
-               
+               sub.itemR(mat, "vertex_color_paint")
+               sub.itemR(mat, "vertex_color_light")
+               sub.itemR(mat, "object_color")
 
-
 class MATERIAL_PT_shadows(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_shadows"
        __label__ = "Shadows"
@@ -201,7 +190,7 @@
 
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type != "HALO")
+               return (mat and mat.type != 'HALO')
 
        def draw(self, context):
                layout = self.layout
@@ -211,19 +200,15 @@
                
                sub = split.column()
                sub.itemR(mat, "diffuse_color", text="")
-               sub.itemR(mat, "vertex_color_paint")
-               sub.itemR(mat, "vertex_color_light")
+               row = sub.row()
+               row.active = mat.shadeless== False
+               row.itemR(mat, "diffuse_reflection", text="Intensity", 
slider=True)
                
                sub = split.column()
                sub.active = mat.shadeless== False
-               sub.itemR(mat, "diffuse_reflection", text="Intensity", 
slider=True)
-               sub.itemR(mat, "translucency", slider=True)
-               sub.itemR(mat, "object_color")
+               sub.itemR(mat, "diffuse_shader", text="")
+               sub.itemR(mat, "use_diffuse_ramp", text="Ramp")
                
-               row = layout.row()
-               row.active = mat.shadeless== False
-               row.itemR(mat, "diffuse_shader", text="Shader")
-               
                split = layout.split()
                split.active = mat.shadeless== False
                sub = split.column()
@@ -240,16 +225,16 @@
                        sub = split.column()
                        sub.itemR(mat, "diffuse_fresnel_factor", text="Factor")
                
-               layout.template_color_ramp(mat.diffuse_ramp, expand=True)
+               if mat.use_diffuse_ramp:
+                       layout.template_color_ramp(mat.diffuse_ramp, 
expand=True)
                
-               
 class MATERIAL_PT_specular(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_specular"
        __label__ = "Specular"
 
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type != "HALO")
+               return (mat and mat.type != 'HALO')
 
        def draw(self, context):
                layout = self.layout
@@ -261,30 +246,31 @@
                
                sub = split.column()
                sub.itemR(mat, "specular_color", text="")
-               sub = split.column()
                sub.itemR(mat, "specular_reflection", text="Intensity", 
slider=True)
+
+               sub = split.column()
+               sub.itemR(mat, "specular_shader", text="")
+               sub.itemR(mat, "use_specular_ramp", text="Ramp")
                
-               layout.itemR(mat, "spec_shader", text="Shader")
-               
                split = layout.split()
                
                sub = split.column()
-               if mat.spec_shader in ('COOKTORR', 'PHONG'):
+               if mat.specular_shader in ('COOKTORR', 'PHONG'):
                        sub.itemR(mat, "specular_hardness", text="Hardness")
-               if mat.spec_shader == 'BLINN':
+               if mat.specular_shader == 'BLINN':
                        sub.itemR(mat, "specular_hardness", text="Hardness")
                        sub = split.column()
                        sub.itemR(mat, "specular_ior", text="IOR")
-               if mat.spec_shader == 'WARDISO':
+               if mat.specular_shader == 'WARDISO':
                        sub.itemR(mat, "specular_slope", text="Slope")
-               if mat.spec_shader == 'TOON':
+               if mat.specular_shader == 'TOON':
                        sub.itemR(mat, "specular_toon_size", text="Size")
                        sub = split.column()
                        sub.itemR(mat, "specular_toon_smooth", text="Smooth")
                
-               layout.template_color_ramp(mat.specular_ramp, expand=True)
+               if mat.use_specular_ramp:
+                       layout.template_color_ramp(mat.specular_ramp, 
expand=True)
                
-               
 class MATERIAL_PT_sss(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_sss"
        __label__ = "Subsurface Scattering"
@@ -292,7 +278,7 @@
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
 
        def draw_header(self, context):
                layout = self.layout
@@ -331,7 +317,7 @@
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
        
        def draw_header(self, context):
                layout = self.layout
@@ -375,7 +361,7 @@
                
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
 
        def draw_header(self, context):
                layout = self.layout
@@ -419,7 +405,7 @@
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "HALO")
+               return (mat and mat.type == 'HALO')
        
        def draw(self, context):
                layout = self.layout

Modified: 
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c     
2009-07-25 20:59:09 UTC (rev 21900)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c     
2009-07-25 21:31:17 UTC (rev 21901)
@@ -9281,6 +9281,10 @@
                }
 
                for(ma = main->mat.first; ma; ma = ma->id.next) {
+                       if(ma->mode & MA_WIRE) {
+                               ma->material_type= MA_TYPE_WIRE;
+                               ma->mode &= ~MA_WIRE;
+                       }
                        if(ma->mode & MA_HALO) {
                                ma->material_type= MA_TYPE_HALO;
                                ma->mode &= ~MA_HALO;

Modified: 
branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h    
2009-07-25 20:59:09 UTC (rev 21900)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h    
2009-07-25 21:31:17 UTC (rev 21901)
@@ -148,6 +148,7 @@
 #define MA_TYPE_SURFACE        0
 #define MA_TYPE_HALO   1
 #define MA_TYPE_VOLUME 2
+#define MA_TYPE_WIRE   3
 
 /* flag */
                /* for render */
@@ -159,7 +160,7 @@
 #define MA_TRACEBLE            1
 #define MA_SHADOW              2
 #define MA_SHLESS              4
-#define MA_WIRE                        8
+#define MA_WIRE                        8                       /* deprecated */
 #define MA_VERTEXCOL   16
 #define MA_HALO_SOFT   16
 #define MA_HALO                        32                      /* deprecated */

Modified: 
branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c   
2009-07-25 20:59:09 UTC (rev 21900)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c   
2009-07-25 21:31:17 UTC (rev 21901)
@@ -166,6 +166,28 @@
        }
 }
 
+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 @@
        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 @@
 {
        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 @@

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to