2.5 Buttons:
authorThomas Dinges <blender@dingto.org>
Sun, 10 May 2009 12:12:05 +0000 (12:12 +0000)
committerThomas Dinges <blender@dingto.org>
Sun, 10 May 2009 12:12:05 +0000 (12:12 +0000)
*Added initial material buttons (Material Color, Ray Transparency, Ray Mirror, Subsurface Scattering)
Only works for default material atm.

*some layout tweaks to the lamp panels.

release/ui/buttons_data_lamp.py
release/ui/buttons_material.py [new file with mode: 0644]

index f71e0f8868f2e6d6a0518bf2db28eebf10f33d4e..6cec1a0d09d8fa73bbd7e7eba4f3fa1ac63e121f 100644 (file)
@@ -32,6 +32,20 @@ class DATA_PT_lamp(DataButtonsPanel):
                sub.itemR(lamp, "energy")
                sub.itemR(lamp, "distance")
        
+               sub = layout.sub(1)
+               sub.column()
+               sub.itemR(lamp, "color")
+               
+               layout.split(number=2)  
+               
+               sub = layout.sub(0)
+               sub.column()
+               sub.itemL(text="Illumination:")
+               sub.itemR(lamp, "layer")
+               sub.itemR(lamp, "negative")
+               sub.itemR(lamp, "specular")
+               sub.itemR(lamp, "diffuse")
+               
                sub = layout.sub(1)
                if (lamp.type in ('LOCAL', 'SPOT')):
                        sub.column()
@@ -51,20 +65,6 @@ class DATA_PT_lamp(DataButtonsPanel):
                        if (lamp.shape == 'RECTANGLE'):
                                sub.itemR(lamp, "size", text="Size X")
                                sub.itemR(lamp, "size_y")
-               
-               layout.split(number=2)  
-               
-               sub = layout.sub(0)
-               sub.column()
-               sub.itemL(text="Illumination:")
-               sub.itemR(lamp, "layer")
-               sub.itemR(lamp, "negative")
-               sub.itemR(lamp, "specular")
-               sub.itemR(lamp, "diffuse")
-               
-               sub = layout.sub(1)
-               sub.column()
-               sub.itemR(lamp, "color")
                                
 class DATA_PT_sunsky(DataButtonsPanel):
        __idname__ = "DATA_PT_sunsky"
@@ -95,17 +95,17 @@ class DATA_PT_sunsky(DataButtonsPanel):
                        if (lamp.sky):
                                sub = layout.sub(0)
                                sub.column()
+                               sub.itemR(lamp, "sky_blend_type", text="Blend Type")
+                               sub.itemR(lamp, "sky_blend")
+                               sub.itemR(lamp, "sky_color_space", text="Color Space")
+                               sub.itemR(lamp, "sky_exposure")
+                               sub.column()
                                sub.itemR(lamp, "horizon_brightness", text="Hor Bright")
                                sub.itemR(lamp, "spread", text="Hor Spread")
                                sub.itemR(lamp, "sun_brightness", text="Sun Bright")
                                sub.itemR(lamp, "sun_size")
                                sub.itemR(lamp, "backscattered_light", text="Back Light")
-                               sub.column()
-                               sub.itemR(lamp, "sky_blend_type", text="Blend Type")
-                               sub.itemR(lamp, "sky_blend")
-                               sub.itemR(lamp, "sky_color_space", text="Color Space")
-                               sub.itemR(lamp, "sky_exposure")
-                       
+                               
                        if (lamp.atmosphere):
                                sub = layout.sub(1)
                                sub.column()
@@ -133,6 +133,20 @@ class DATA_PT_shadow(DataButtonsPanel):
                layout.row()
                layout.itemR(lamp, "shadow_method", expand=True)
                
+               if (lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW')):
+               
+                       layout.split(number=2)
+                       
+                       sub = layout.sub(0)
+                       sub.column()
+                       sub.itemL(text="Options:")
+                       sub.itemR(lamp, "only_shadow")
+                       sub.itemR(lamp, "shadow_layer")
+                       
+                       sub = layout.sub(1)
+                       sub.column()
+                       sub.itemR(lamp, "shadow_color")
+               
                if (lamp.shadow_method == 'RAY_SHADOW'):
                
                        layout.column()
@@ -157,15 +171,16 @@ class DATA_PT_shadow(DataButtonsPanel):
                                        layout.itemR(lamp, "jitter")    
                
                if (lamp.shadow_method == 'BUFFER_SHADOW'):
-                       layout.row()
-                       layout.itemR(lamp, "shadow_buffer_type")
+                       layout.column()
+                       layout.itemL(text="Buffer Type:")
+                       layout.itemR(lamp, "shadow_buffer_type", expand=True)
 
                        if (lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY')):
                                layout.column_flow()
                                layout.itemL(text="Sample Buffers:")
-                               layout.itemR(lamp, "shadow_sample_buffers", text="")
+                               layout.itemR(lamp, "shadow_sample_buffers", expand=True)
                                layout.itemL(text="Filter Type:")
-                               layout.itemR(lamp, "shadow_filter_type", text="")
+                               layout.itemR(lamp, "shadow_filter_type", expand=True)
                                layout.column_flow()
                                layout.itemR(lamp, "shadow_buffer_size", text="Size")
                                layout.itemR(lamp, "shadow_buffer_samples", text="Samples")
@@ -175,7 +190,7 @@ class DATA_PT_shadow(DataButtonsPanel):
                        if (lamp.shadow_buffer_type == 'IRREGULAR'):
                                layout.row()
                                layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
-                               
+                       
                        layout.row()
                        layout.itemR(lamp, "auto_clip_start", text="Autoclip Start")
                        if not (lamp.auto_clip_start):
@@ -184,21 +199,7 @@ class DATA_PT_shadow(DataButtonsPanel):
                        layout.itemR(lamp, "auto_clip_end", text="Autoclip End")
                        if not (lamp.auto_clip_end):
                                layout.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End")
-               
-               if (lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW')):
-               
-                       layout.split(number=2)
-                       
-                       sub = layout.sub(0)
-                       sub.column()
-                       sub.itemL(text="Display:")
-                       sub.itemR(lamp, "only_shadow")
-                       sub.itemR(lamp, "shadow_layer")
-                       
-                       sub = layout.sub(1)
-                       sub.column()
-                       sub.itemR(lamp, "shadow_color")
-               
+
 class DATA_PT_spot(DataButtonsPanel):
        __idname__ = "DATA_PT_spot"
        __label__ = "Spot"
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py
new file mode 100644 (file)
index 0000000..55887cb
--- /dev/null
@@ -0,0 +1,130 @@
+
+import bpy
+
+class MaterialButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "material"
+       
+class MATERIAL_PT_material(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_material"
+       __label__ = "Material"
+       
+       def draw(self, context):
+               mat = context.main.materials[0]
+               layout = self.layout
+               
+               if not mat:
+                       return 
+       
+               layout.row()
+               layout.itemR(mat, "diffuse_color")
+               layout.itemR(mat, "specular_color")
+               layout.itemR(mat, "mirror_color")
+               
+               layout.row()
+               layout.itemR(mat, "color_model")
+               layout.itemR(mat, "alpha")
+               
+class MATERIAL_PT_sss(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_sss"
+       __label__ = "Subsurface Scattering"
+       
+       def draw(self, context):
+               sss = context.main.materials[0].subsurface_scattering 
+               layout = self.layout
+               
+               if not sss:
+                       return 
+               
+               layout.row()
+               layout.itemR(sss, "enabled", text="Enable")
+               
+               layout.column_flow()
+               layout.itemR(sss, "error_tolerance")
+               layout.itemR(sss, "ior")
+               layout.itemR(sss, "scale")
+               
+               layout.row()
+               layout.itemR(sss, "color")
+               layout.itemR(sss, "radius")
+               
+               layout.column_flow()
+               layout.itemR(sss, "color_factor")
+               layout.itemR(sss, "texture_factor")
+               layout.itemR(sss, "front")
+               layout.itemR(sss, "back")
+               
+class MATERIAL_PT_raymir(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_raymir"
+       __label__ = "Ray Mirror"
+       
+       def draw(self, context):
+               raym = context.main.materials[0].raytrace_mirror
+               layout = self.layout
+               
+               if not raym:
+                       return 
+
+               layout.row()
+               layout.itemR(raym, "enabled", text="Enable")
+               
+               layout.split(number=2)
+               
+               sub = layout.sub(0)
+               sub.column_flow()
+               sub.itemR(raym, "reflect", text="RayMir")
+               sub.itemR(raym, "fresnel")
+               sub.itemR(raym, "fresnel_fac", text="Fac")
+               
+               sub = layout.sub(1)
+               sub.column_flow()
+               sub.itemR(raym, "gloss")
+               sub.itemR(raym, "gloss_threshold")
+               sub.itemR(raym, "gloss_samples")
+               sub.itemR(raym, "gloss_anisotropic")
+               
+               layout.column_flow()
+               layout.itemR(raym, "distance", text="Max Dist")
+               layout.itemR(raym, "depth")
+               layout.itemR(raym, "fade_to")
+               
+class MATERIAL_PT_raytransp(MaterialButtonsPanel):
+       __idname__= "MATERIAL_PT_raytransp"
+       __label__= "Ray Transparency"
+
+       def draw(self, context):
+               rayt = context.main.materials[0].raytrace_transparency
+               layout = self.layout
+
+               if not rayt:
+                       return
+
+               layout.row()
+               layout.itemR(rayt, "enabled", text="Enable")
+               
+               layout.split(number=2)
+               
+               sub = layout.sub(0)
+               sub.column()
+               sub.itemR(rayt, "ior")
+               sub.itemR(rayt, "fresnel")
+               sub.itemR(rayt, "fresnel_fac", text="Fac")
+               
+               sub = layout.sub(1)
+               sub.column()
+               sub.itemR(rayt, "gloss")
+               sub.itemR(rayt, "gloss_threshold")
+               sub.itemR(rayt, "gloss_samples")
+               
+               layout.column_flow()
+               layout.itemR(rayt, "filter")
+               layout.itemR(rayt, "limit")
+               layout.itemR(rayt, "falloff")
+               layout.itemR(rayt, "specular_opacity")
+               layout.itemR(rayt, "depth")
+
+bpy.types.register(MATERIAL_PT_material)
+bpy.types.register(MATERIAL_PT_raymir)
+bpy.types.register(MATERIAL_PT_raytransp)
+bpy.types.register(MATERIAL_PT_sss)
\ No newline at end of file