== Area lamp UI ==
authorLuca Bonavita <mindrones@gmail.com>
Fri, 6 Aug 2010 14:36:39 +0000 (14:36 +0000)
committerLuca Bonavita <mindrones@gmail.com>
Fri, 6 Aug 2010 14:36:39 +0000 (14:36 +0000)
Fixes [#23152] Area light with noshadow is affected by rayshadow sampling setup (Kino Bug Reporting Sprint)
https://projects.blender.org/tracker/index.php?func=detail&aid=23152&group_id=9&atid=498

This moves the samples field so that it is visible in area lamps when noshadow is clicked, because acording to Brecht: "area lights also use the
samples for sampling the form factor, but they are in the shadow panel, probably for area lights that button should be moved"

Also modified the sampling buttons so that only those depending on the sampling method are below the sampling method selector, while the general
ones come first so it's immediate to see which ones are depending on the sampling method.

Also, formatted so that options for constant jitter appear below that button, so it's faster to setup.
Same for QMC which has the threshold field just below the QMC selector, and not wide as the column.

This still uses "if wide_ui else", in IRC there has been discussion about removing it but this will be done but who is in charge of it at due
time.

release/scripts/ui/properties_data_lamp.py

index a67d7c8fc87e94b3476870c8619649b8152d4c7e..69b22c555ab6cb316baf96682e1459607e5ba161 100644 (file)
@@ -239,6 +239,23 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
         else:
             layout.prop(lamp, "shadow_method", text="")
 
+        if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
+            split = layout.split()
+
+            col= split.column()
+            col.label(text="Form factor sampling:")
+            
+            if wide_ui:
+                sub=col.row(align=True)
+            else:
+                sub=col.column(align=True)
+
+            if lamp.shape == 'SQUARE':
+                sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+            elif lamp.shape == 'RECTANGLE':
+                sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+                sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
+
         if lamp.shadow_method != 'NOSHADOW':
             split = layout.split()
 
@@ -251,51 +268,51 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
             col.prop(lamp, "only_shadow")
 
         if lamp.shadow_method == 'RAY_SHADOW':
-            col = layout.column()
+            split = layout.split()
+            
+            col = split.column()
             col.label(text="Sampling:")
+            
+            if lamp.type in ('POINT', 'SUN', 'SPOT'):
+                if wide_ui:
+                    sub=col.row()
+                else:
+                    sub=col.column()
+                
+                sub.prop(lamp, "shadow_ray_samples", text="Samples")
+                sub.prop(lamp, "shadow_soft_size", text="Soft Size")
+                
+            elif lamp.type == 'AREA':
+                if wide_ui:
+                    sub=col.row(align=True)
+                else:
+                    sub=col.column(align=True)
+                
+                if lamp.shape == 'SQUARE':
+                    sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+                elif lamp.shape == 'RECTANGLE':
+                    sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+                    sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
+
             if wide_ui:
                 col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
             else:
-                col.prop(lamp, "shadow_ray_sampling_method", text="")
-
-            if lamp.type in ('POINT', 'SUN', 'SPOT'):
-                split = layout.split()
+                col.prop(lamp, "shadow_ray_sampling_method", text="")                
 
-                col = split.column()
-                col.prop(lamp, "shadow_soft_size", text="Soft Size")
-
-                col.prop(lamp, "shadow_ray_samples", text="Samples")
-                if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
-                    col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
+            split = layout.split()
+            col = split.column()
+            
+            if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
+                col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
                 if wide_ui:
                     col = split.column()
-
-            elif lamp.type == 'AREA':
-                split = layout.split()
-
+            
+            if lamp.type == 'AREA' and lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
                 col = split.column()
-
-                if lamp.shape == 'SQUARE':
-                    col.prop(lamp, "shadow_ray_samples_x", text="Samples")
-                elif lamp.shape == 'RECTANGLE':
-                    col.prop(lamp, "shadow_ray_samples_x", text="Samples X")
-                    col.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
-
-                if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
-                    col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
-                    if wide_ui:
-                        col = split.column()
-
-                elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
-                    if wide_ui:
-                        col = split.column()
-                    col.prop(lamp, "umbra")
-                    col.prop(lamp, "dither")
-                    col.prop(lamp, "jitter")
-                else:
-                    if wide_ui:
-                        col = split.column()
-
+                col = split.column()
+                col.prop(lamp, "umbra")
+                col.prop(lamp, "dither")
+                col.prop(lamp, "jitter")
 
         elif lamp.shadow_method == 'BUFFER_SHADOW':
             col = layout.column()
@@ -355,16 +372,21 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
         return (lamp and lamp.type == 'AREA') and (engine in __class__.COMPAT_ENGINES)
 
     def draw(self, context):
-        layout = self.layout
-
         lamp = context.lamp
+        wide_ui = context.region.width > narrowui
 
+        layout = self.layout
         split = layout.split()
 
         col = split.column()
-        col.row().prop(lamp, "shape", expand=True)
+        
+        if wide_ui:
+            col.row().prop(lamp, "shape", expand=True)
+            sub = col.row(align=True)
+        else:
+            col.prop(lamp, "shape", text="")
+            sub = col.column(align=True)
 
-        sub = col.column(align=True)
         if (lamp.shape == 'SQUARE'):
             sub.prop(lamp, "size")
         elif (lamp.shape == 'RECTANGLE'):