[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31104] trunk/blender/release/scripts/ui/ properties_data_lamp.py: == Area lamp UI ==

Luca Bonavita mindrones at gmail.com
Fri Aug 6 16:36:40 CEST 2010


Revision: 31104
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31104
Author:   mindrones
Date:     2010-08-06 16:36:39 +0200 (Fri, 06 Aug 2010)

Log Message:
-----------
== Area lamp UI ==

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.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_lamp.py

Modified: trunk/blender/release/scripts/ui/properties_data_lamp.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_lamp.py	2010-08-06 14:25:35 UTC (rev 31103)
+++ trunk/blender/release/scripts/ui/properties_data_lamp.py	2010-08-06 14:36:39 UTC (rev 31104)
@@ -239,6 +239,23 @@
         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,52 +268,52 @@
             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="")
+                col.prop(lamp, "shadow_ray_sampling_method", text="")                
 
-            if lamp.type in ('POINT', 'SUN', 'SPOT'):
-                split = layout.split()
-
-                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()
+                col = split.column()
+                col.prop(lamp, "umbra")
+                col.prop(lamp, "dither")
+                col.prop(lamp, "jitter")
 
-                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()
-
-
         elif lamp.shadow_method == 'BUFFER_SHADOW':
             col = layout.column()
             col.label(text="Buffer Type:")
@@ -355,16 +372,21 @@
         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'):





More information about the Bf-blender-cvs mailing list