2.5 Lamps:
authorThomas Dinges <blender@dingto.org>
Mon, 20 Jul 2009 20:34:14 +0000 (20:34 +0000)
committerThomas Dinges <blender@dingto.org>
Mon, 20 Jul 2009 20:34:14 +0000 (20:34 +0000)
* Replaced RNA ENUM hacks for "shadow method" and "shadow_ray_sampling_method" with modifications in the layout file.

release/ui/buttons_data_lamp.py
source/blender/makesrna/intern/rna_lamp.c

index b70734d..aa1b9db 100644 (file)
@@ -124,10 +124,7 @@ class DATA_PT_sky(DataButtonsPanel):
                col.itemR(lamp, "sun_brightness", text="Brightness")
                col.itemR(lamp, "sun_size", text="Size")
                col.itemR(lamp, "backscattered_light", text="Back Light")
-                               
 
-               
-               
 class DATA_PT_atmosphere(DataButtonsPanel):
        __idname__ = "DATA_PT_atmosphere"
        __label__ = "Atmosphere"
@@ -168,10 +165,15 @@ class DATA_PT_shadow(DataButtonsPanel):
        def draw(self, context):
                layout = self.layout
                lamp = context.lamp
-
-               layout.itemR(lamp, "shadow_method", expand=True)
                
-               if lamp.shadow_method in ('BUFFER_SHADOW', 'RAY_SHADOW'):
+               row = layout.row(align=True)
+               row.item_enumR(lamp, "shadow_method", 'NOSHADOW')
+               row.item_enumR(lamp, "shadow_method", 'RAY_SHADOW')
+               if lamp.type == 'SPOT':
+                       row.item_enumR(lamp, "shadow_method", 'BUFFER_SHADOW')
+                       
+               
+               if lamp.shadow_method != 'NOSHADOW':
                
                        split = layout.split()
                        
@@ -184,9 +186,12 @@ class DATA_PT_shadow(DataButtonsPanel):
                
                if lamp.shadow_method == 'RAY_SHADOW':
                
-                       col = layout.column()
-                       col.itemL(text="Sampling:")
-                       col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
+                       row = layout.row(align=True)
+                       layout.itemL(text="Sampling:")
+                       row.item_enumR(lamp, "shadow_ray_sampling_method", 'ADAPTIVE_QMC')
+                       row.item_enumR(lamp, "shadow_ray_sampling_method", 'CONSTANT_QMC')
+                       if lamp.type == 'AREA':
+                               row.item_enumR(lamp, "shadow_ray_sampling_method", 'CONSTANT_JITTERED')
                                
                        if lamp.type in ('POINT', 'SUN', 'SPOT'):
                                flow = layout.column_flow()
@@ -206,10 +211,10 @@ class DATA_PT_shadow(DataButtonsPanel):
                                        flow.itemR(lamp, "jitter")      
        
                if lamp.shadow_method == 'BUFFER_SHADOW':
-                       col = layout.column()
-                       col.itemL(text="Buffer Type:")
-                       col.row().itemR(lamp, "shadow_buffer_type", expand=True)
-
+                       row = layout.row(align=True)
+                       row.itemL(text="Buffer Type:")
+                       layout.itemR(lamp, "shadow_buffer_type", expand=True)
+                       
                        if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
                                flow = layout.column_flow()
                                flow.itemL(text="Sample Buffers:")
index b83036b..dd2681c 100644 (file)
@@ -389,31 +389,20 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
        PropertyRNA *prop;
 
        static EnumPropertyItem prop_shadow_items[] = {
-               {0, "NOSHADOW", 0, "No Shadow", ""},
-               {LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow."},
-               {0, NULL, 0, NULL, NULL}};
-
-       static EnumPropertyItem prop_spot_shadow_items[] = {
                {0, "NOSHADOW", 0, "No Shadow", ""},
                {LA_SHAD_BUF, "BUFFER_SHADOW", 0, "Buffer Shadow", "Lets spotlight produce shadows using shadow buffer."},
                {LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow."},
                {0, NULL, 0, NULL, NULL}};
-
-       static EnumPropertyItem prop_ray_sampling_method_items[] = {
-               {LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""},
-               {LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""},
-               {0, NULL, 0, NULL, NULL}};
        
-       static EnumPropertyItem prop_spot_ray_sampling_method_items[] = {
+       static EnumPropertyItem prop_ray_sampling_method_items[] = {
                {LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""},
                {LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""},
-               {LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""},
+               {LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", "For Area lamps only."},
                {0, NULL, 0, NULL, NULL}};
 
-
        prop= RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
-       RNA_def_property_enum_items(prop, (spot)? prop_spot_shadow_items: prop_shadow_items);
+       RNA_def_property_enum_items(prop, prop_shadow_items);
        RNA_def_property_ui_text(prop, "Shadow Method", "Method to compute lamp shadow with.");
        RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
 
@@ -430,7 +419,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
 
        prop= RNA_def_property(srna, "shadow_ray_sampling_method", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
-       RNA_def_property_enum_items(prop, (area)? prop_spot_ray_sampling_method_items: prop_ray_sampling_method_items);
+       RNA_def_property_enum_items(prop, prop_ray_sampling_method_items);
        RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method", "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower.");
        RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);