2.5: Lamp button layout improvements by nudelZ.
[blender.git] / release / ui / buttons_data_lamp.py
index 2155830e56898e17b73eb7b58cd137530cc12d7c..4a6bc11922d551780fcefa58f7eee13456e0eab2 100644 (file)
@@ -51,107 +51,124 @@ class DATA_PT_lamp(DataButtonsPanel):
                layout.itemR(lamp, "type", expand=True)
                
                split = layout.split()
+               col = split.column()
+               #col.itemL(text="Type:")
+               #col.itemR(lamp, "type", text="")
+               colsub = col.column(align=True)
+               colsub.itemR(lamp, "color", text="")
+               colsub.itemR(lamp, "energy")
                
-               sub = split.column()
-               sub.itemR(lamp, "color")
-               sub.itemR(lamp, "energy")
-               sub.itemR(lamp, "distance")
-               sub.itemR(lamp, "negative")
+               col.itemR(lamp, "negative")
+               #col.itemR(lamp, "distance")
        
                sub = split.column()
+               #sub.itemL(text="Influence:")
                sub.itemR(lamp, "layer", text="This Layer Only")
                sub.itemR(lamp, "specular")
                sub.itemR(lamp, "diffuse")
+               #sub.itemR(lamp, "negative")
                
                if lamp.type in ('POINT', 'SPOT'):
-                       split = sub.split(percentage=0.3)
-                       split.itemL(text="Falloff:")
-                       split.itemR(lamp, "falloff_type", text="")
-                       sub.itemR(lamp, "sphere")
+                       split = layout.split()
+                       col = split.column()
+                       col.itemL(text="Falloff:")
+                       col = col.column(align=True)
+                       col.itemR(lamp, "falloff_type", text="")
+                       col.itemR(lamp, "distance")
+                       col.itemR(lamp, "sphere")
+                       
+                       if lamp.falloff_type != 'LINEAR_QUADRATIC_WEIGHTED':
+                               col = split.column()
                        
-                       if (lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED'):
-                               sub.itemR(lamp, "linear_attenuation")
-                               sub.itemR(lamp, "quadratic_attenuation")
+                       else:
+                               sub = split.column()
+                               sub.itemL(text="Attenuation Distance:")
+                               sub = sub.column(align=True)
+                               sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear")
+                               sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
                        
                if lamp.type == 'AREA':
-                       sub.column()
-                       sub.itemR(lamp, "gamma")
-                       sub.itemR(lamp, "shape")
+                       split = layout.split()
+                       col = split.column()
+                       col.itemL(text="Shape:")
+                       col = col.column(align=True)
+                       col.itemR(lamp, "shape", text="")
                        if (lamp.shape == 'SQUARE'):
-                               sub.itemR(lamp, "size")
+                               col.itemR(lamp, "size")
                        if (lamp.shape == 'RECTANGLE'):
-                               sub.itemR(lamp, "size", text="Size X")
-                               sub.itemR(lamp, "size_y")
+                               col.itemR(lamp, "size", text="Size X")
+                               col.itemR(lamp, "size_y", text="Size Y")
+                       
+                       sub = split.column()
+                       sub.itemL(text="Gamma:")
+                       sub.itemR(lamp, "gamma", text="Value")
                                
-class DATA_PT_sky(DataButtonsPanel):
-       __idname__ = "DATA_PT_sky"
-       __label__ = "Sky"
+class DATA_PT_sunsky(DataButtonsPanel):
+       __idname__ = "DATA_PT_sunsky"
+       __label__ = "Sun/Sky"
        
        def poll(self, context):
                lamp = context.lamp
                return (lamp and lamp.type == 'SUN')
-               
-       def draw_header(self, context):
-               layout = self.layout
-               lamp = context.lamp.sky
-
-               layout.itemR(lamp, "sky", text="")
 
        def draw(self, context):
                layout = self.layout
                lamp = context.lamp.sky
 
-               layout.active = lamp.sky
+               row = layout.row()
+               row.itemR(lamp, "sky")
+               row.itemR(lamp, "atmosphere")
                
+               row = layout.row()
+               row.active = lamp.sky or lamp.atmosphere
+               row.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
+                       
                split = layout.split()
+               
                col = split.column()
-
-               col.itemL(text="Colors:")
-               col.itemR(lamp, "sky_blend_type", text="Blend Type")
-               col.itemR(lamp, "sky_blend")
-               col.itemR(lamp, "sky_color_space", text="Color Space")
-               col.itemR(lamp, "sky_exposure", text="Exposure")
-               col.itemS()
-               col.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
+               col.active = lamp.sky
+               col.itemL(text="Blend Mode:")
+               colsub = col.column(align=True)
+               colsub.itemR(lamp, "sky_blend_type", text="")
+               colsub.itemR(lamp, "sky_blend", text="Factor")
                
+               col.itemL(text="Color Space:")
+               colsub = col.column(align=True)
+               colsub.itemR(lamp, "sky_color_space", text="")
+               colsub.itemR(lamp, "sky_exposure", text="Exposure")
+                       
                col = split.column()
+               col.active = lamp.sky
                col.itemL(text="Horizon:")
-               col.itemR(lamp, "horizon_brightness", text="Brightness")
-               col.itemR(lamp, "spread", text="Spread")
+               colsub = col.column(align=True)
+               colsub.itemR(lamp, "horizon_brightness", text="Brightness")
+               colsub.itemR(lamp, "spread", text="Spread")
+               
                col.itemL(text="Sun:")
-               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"
-       
-       def poll(self, context):
-               lamp = context.lamp
-               return (lamp and lamp.type == 'SUN')
-
-       def draw_header(self, context):
-               layout = self.layout
-               lamp = context.lamp.sky
-
-               layout.itemR(lamp, "atmosphere", text="")
-
-       def draw(self, context):
-               layout = self.layout
-               lamp = context.lamp.sky
-       
-               layout.active = lamp.atmosphere
+               colsub = col.column(align=True)
+               colsub.itemR(lamp, "sun_brightness", text="Brightness")
+               colsub.itemR(lamp, "sun_size", text="Size")
+               colsub.itemR(lamp, "backscattered_light", slider=True,text="Back Light")
+               
+               row = layout.row()
+               row.itemS()
                
                split = layout.split()
-               sub = split.column()
-               sub.itemR(lamp, "atmosphere_turbidity", text="Turbidity")
-               sub.itemR(lamp, "sun_intensity", text="Sun Intensity")
-               sub = split.column()
-               sub.itemR(lamp, "atmosphere_inscattering", text="Inscattering", slider=True)
-               sub.itemR(lamp, "atmosphere_extinction", text="Extinction", slider=True)
-               sub.itemR(lamp, "atmosphere_distance_factor", text="Distance")          
-                               
+               
+               col = split.column()
+               col.active = lamp.atmosphere
+               col.itemL(text="Sun:")
+               col.itemR(lamp, "sun_intensity", text="Intensity")
+               col.itemL(text="Scale Distance:")
+               col.itemR(lamp, "atmosphere_distance_factor", text="Distance")
+                       
+               col = split.column()
+               col.active = lamp.atmosphere
+               col.itemL(text="Scattering:")
+               sub = col.column(align=True)
+               sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
+               sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction")
+               
 class DATA_PT_shadow(DataButtonsPanel):
        __idname__ = "DATA_PT_shadow"
        __label__ = "Shadow"
@@ -170,8 +187,8 @@ class DATA_PT_shadow(DataButtonsPanel):
                
                        split = layout.split()
                        
-                       sub = split.column()
-                       sub.itemR(lamp, "shadow_color")
+                       col = split.column()
+                       col.itemR(lamp, "shadow_color")
                        
                        sub = split.column()
                        sub.itemR(lamp, "shadow_layer", text="This Layer Only")
@@ -184,39 +201,53 @@ class DATA_PT_shadow(DataButtonsPanel):
                        col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True)
                                
                        if lamp.type in ('POINT', 'SUN', 'SPOT'):
-                               flow = layout.column_flow()
-                               flow.itemR(lamp, "shadow_soft_size", text="Soft Size")
-                               flow.itemR(lamp, "shadow_ray_samples", text="Samples")
+                               split = layout.split()
+                               col = split.column(align=True)
+                               col.itemR(lamp, "shadow_soft_size", text="Soft Size")
+                               col = split.column(align=True)
+                               col.itemR(lamp, "shadow_ray_samples", text="Samples")
                                if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
-                                       flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
+                                       col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
                                                
                        if lamp.type == 'AREA':
-                               flow = layout.column_flow()
-                               flow.itemR(lamp, "shadow_ray_samples_x", text="Samples")
-                               if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
-                                       flow.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
+                               split = layout.split()
+                               col = split.column()
+
                                if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
-                                       flow.itemR(lamp, "umbra")
-                                       flow.itemR(lamp, "dither")
-                                       flow.itemR(lamp, "jitter")      
+                                       col.itemR(lamp, "umbra")
+                                       col.itemR(lamp, "dither")
+                                       col.itemR(lamp, "jitter")       
+                               else:
+                                       col.itemL()
+
+                               col = split.column(align=True)
+                               col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
+                               if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
+                                       col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
        
                if lamp.shadow_method == 'BUFFER_SHADOW':
-                       row = layout.row(align=True)
-                       row.itemL(text="Buffer Type:")
-                       layout.itemR(lamp, "shadow_buffer_type", expand=True)
-                       
+                       col = layout.column()
+                       col.itemL(text="Buffer Type:")
+                       col.row().itemR(lamp, "shadow_buffer_type", expand=True)
+
                        if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY'):
-                               flow = layout.column_flow()
-                               flow.itemL(text="Sample Buffers:")
-                               flow.itemR(lamp, "shadow_sample_buffers", text="")
-                               flow.itemL(text="Filter Type:")
-                               flow.itemR(lamp, "shadow_filter_type", text="")
                                
-                               flow = layout.column_flow()
-                               flow.itemR(lamp, "shadow_buffer_size", text="Size")
-                               flow.itemR(lamp, "shadow_buffer_samples", text="Samples")
-                               flow.itemR(lamp, "shadow_buffer_bias", text="Bias")
-                               flow.itemR(lamp, "shadow_buffer_soft", text="Soft")
+                               split = layout.split()
+                               col = split.column()
+                               col.itemL(text="Filter Type:")
+                               col.itemR(lamp, "shadow_filter_type", text="")
+                               
+                               colsub = col.column(align=True)
+                               colsub.itemR(lamp, "shadow_buffer_soft", text="Soft")
+                               colsub.itemR(lamp, "shadow_buffer_bias", text="Bias")
+                               
+                               col = split.column()
+                               col.itemL(text="Sample Buffers:")
+                               col.itemR(lamp, "shadow_sample_buffers", text="")
+                               
+                               colsub = col.column(align=True)
+                               colsub.itemR(lamp, "shadow_buffer_size", text="Size")
+                               colsub.itemR(lamp, "shadow_buffer_samples", text="Samples")
                                
                        if (lamp.shadow_buffer_type == 'IRREGULAR'):
                                row = layout.row()
@@ -244,15 +275,15 @@ class DATA_PT_spot(DataButtonsPanel):
                lamp = context.lamp
 
                split = layout.split()
-               
-               sub = split.column()
+               col = split.column()
+               sub = col.column(align=True)
                sub.itemR(lamp, "spot_size", text="Size")
                sub.itemR(lamp, "spot_blend", text="Blend")
-               sub.itemR(lamp, "square")
+               col.itemR(lamp, "square")
                
                col = split.column()
                col.itemR(lamp, "halo")
-               colsub = col.column()
+               colsub = col.column(align=True)
                colsub.active = lamp.halo
                colsub.itemR(lamp, "halo_intensity", text="Intensity")
                if lamp.shadow_method == 'BUFFER_SHADOW':
@@ -261,6 +292,7 @@ class DATA_PT_spot(DataButtonsPanel):
 class DATA_PT_falloff_curve(DataButtonsPanel):
        __idname__ = "DATA_PT_falloff_curve"
        __label__ = "Falloff Curve"
+       __default_closed__ = True
        
        def poll(self, context):
                lamp = context.lamp
@@ -280,9 +312,8 @@ class DATA_PT_falloff_curve(DataButtonsPanel):
 bpy.types.register(DATA_PT_context_lamp)
 bpy.types.register(DATA_PT_preview)
 bpy.types.register(DATA_PT_lamp)
-bpy.types.register(DATA_PT_shadow)
-bpy.types.register(DATA_PT_sky)
-bpy.types.register(DATA_PT_atmosphere)
-bpy.types.register(DATA_PT_spot)
 bpy.types.register(DATA_PT_falloff_curve)
+bpy.types.register(DATA_PT_spot)
+bpy.types.register(DATA_PT_shadow)
+bpy.types.register(DATA_PT_sunsky)