Merge branch 'master' into blender2.8
[blender.git] / release / scripts / startup / bl_ui / properties_data_lamp.py
index 4ae6ad2a7c1b5eee0b7783ae763a985f897370a0..30cd39d2e2f8e597c02b5bceaed9ab2c75de01a0 100644 (file)
 import bpy
 from bpy.types import Menu, Panel
 from rna_prop_ui import PropertyPanel
-from blf import gettext as _
+
 
 class LAMP_MT_sunsky_presets(Menu):
-    bl_label = _("Sun & Sky Presets")
+    bl_label = "Sun & Sky Presets"
     preset_subdir = "sunsky"
     preset_operator = "script.execute_preset"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     draw = Menu.draw_preset
 
 
-class DataButtonsPanel():
+class DataButtonsPanel:
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "data"
@@ -67,7 +67,7 @@ class DATA_PT_context_lamp(DataButtonsPanel, Panel):
 
 
 class DATA_PT_preview(DataButtonsPanel, Panel):
-    bl_label = _("Preview")
+    bl_label = "Preview"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
@@ -75,7 +75,7 @@ class DATA_PT_preview(DataButtonsPanel, Panel):
 
 
 class DATA_PT_lamp(DataButtonsPanel, Panel):
-    bl_label = _("Lamp")
+    bl_label = "Lamp"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
@@ -93,15 +93,22 @@ class DATA_PT_lamp(DataButtonsPanel, Panel):
         sub.prop(lamp, "energy")
 
         if lamp.type in {'POINT', 'SPOT'}:
-            sub.label(text=_("Falloff:"))
+            sub.label(text="Falloff:")
             sub.prop(lamp, "falloff_type", text="")
             sub.prop(lamp, "distance")
 
             if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
-                col.label(text=_("Attenuation Factors:"))
+                col.label(text="Attenuation Factors:")
+                sub = col.column(align=True)
+                sub.prop(lamp, "linear_attenuation", slider=True, text="Linear")
+                sub.prop(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
+
+            elif lamp.falloff_type == 'INVERSE_COEFFICIENTS':
+                col.label(text="Inverse Coefficients:")
                 sub = col.column(align=True)
-                sub.prop(lamp, "linear_attenuation", slider=True, text=_("Linear"))
-                sub.prop(lamp, "quadratic_attenuation", slider=True, text=_("Quadratic"))
+                sub.prop(lamp, "constant_coefficient", text="Constant")
+                sub.prop(lamp, "linear_coefficient", text="Linear")
+                sub.prop(lamp, "quadratic_coefficient", text="Quadratic")
 
             col.prop(lamp, "use_sphere")
 
@@ -111,14 +118,14 @@ class DATA_PT_lamp(DataButtonsPanel, Panel):
 
         col = split.column()
         col.prop(lamp, "use_negative")
-        col.prop(lamp, "use_own_layer", text=_("This Layer Only"))
+        col.prop(lamp, "use_own_layer", text="This Layer Only")
         col.prop(lamp, "use_specular")
         col.prop(lamp, "use_diffuse")
 
 
 class DATA_PT_sunsky(DataButtonsPanel, Panel):
-    bl_label = _("Sky & Atmosphere")
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    bl_label = "Sky & Atmosphere"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -134,39 +141,39 @@ class DATA_PT_sunsky(DataButtonsPanel, Panel):
         row = layout.row(align=True)
         row.prop(lamp, "use_sky")
         row.menu("LAMP_MT_sunsky_presets", text=bpy.types.LAMP_MT_sunsky_presets.bl_label)
-        row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMIN")
-        row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMOUT").remove_active = True
+        row.operator("lamp.sunsky_preset_add", text="", icon='ZOOMIN')
+        row.operator("lamp.sunsky_preset_add", text="", icon='ZOOMOUT').remove_active = True
 
         row = layout.row()
         row.active = lamp.use_sky or lamp.use_atmosphere
-        row.prop(lamp, "atmosphere_turbidity", text=_("Turbidity"))
+        row.prop(lamp, "atmosphere_turbidity", text="Turbidity")
 
         split = layout.split()
 
         col = split.column()
         col.active = lamp.use_sky
-        col.label(text=_("Blending:"))
+        col.label(text="Blending:")
         sub = col.column()
         sub.prop(lamp, "sky_blend_type", text="")
-        sub.prop(lamp, "sky_blend", text=_("Factor"))
+        sub.prop(lamp, "sky_blend", text="Factor")
 
-        col.label(text=_("Color Space:"))
+        col.label(text="Color Space:")
         sub = col.column()
         sub.row().prop(lamp, "sky_color_space", expand=True)
-        sub.prop(lamp, "sky_exposure", text=_("Exposure"))
+        sub.prop(lamp, "sky_exposure", text="Exposure")
 
         col = split.column()
         col.active = lamp.use_sky
-        col.label(text=_("Horizon:"))
+        col.label(text="Horizon:")
         sub = col.column()
-        sub.prop(lamp, "horizon_brightness", text=_("Brightness"))
-        sub.prop(lamp, "spread", text=_("Spread"))
+        sub.prop(lamp, "horizon_brightness", text="Brightness")
+        sub.prop(lamp, "spread", text="Spread")
 
-        col.label(text=_("Sun:"))
+        col.label(text="Sun:")
         sub = col.column()
-        sub.prop(lamp, "sun_brightness", text=_("Brightness"))
-        sub.prop(lamp, "sun_size", text=_("Size"))
-        sub.prop(lamp, "backscattered_light", slider=True, text=_("Back Light"))
+        sub.prop(lamp, "sun_brightness", text="Brightness")
+        sub.prop(lamp, "sun_size", text="Size")
+        sub.prop(lamp, "backscattered_light", slider=True, text="Back Light")
 
         layout.separator()
 
@@ -176,21 +183,21 @@ class DATA_PT_sunsky(DataButtonsPanel, Panel):
 
         col = split.column()
         col.active = lamp.use_atmosphere
-        col.label(text=_("Intensity:"))
-        col.prop(lamp, "sun_intensity", text=_("Sun"))
-        col.prop(lamp, "atmosphere_distance_factor", text=_("Distance"))
+        col.label(text="Intensity:")
+        col.prop(lamp, "sun_intensity", text="Sun")
+        col.prop(lamp, "atmosphere_distance_factor", text="Distance")
 
         col = split.column()
         col.active = lamp.use_atmosphere
-        col.label(text=_("Scattering:"))
+        col.label(text="Scattering:")
         sub = col.column(align=True)
-        sub.prop(lamp, "atmosphere_inscattering", slider=True, text=_("Inscattering"))
-        sub.prop(lamp, "atmosphere_extinction", slider=True, text=_("Extinction"))
+        sub.prop(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
+        sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction")
 
 
 class DATA_PT_shadow(DataButtonsPanel, Panel):
-    bl_label = _("Shadow")
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    bl_label = "Shadow"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -209,15 +216,15 @@ class DATA_PT_shadow(DataButtonsPanel, Panel):
             split = layout.split()
 
             col = split.column()
-            col.label(text=_("Form factor sampling:"))
+            col.label(text="Form factor sampling:")
 
             sub = col.row(align=True)
 
             if lamp.shape == 'SQUARE':
-                sub.prop(lamp, "shadow_ray_samples_x", text=_("Samples"))
+                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"))
+                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()
@@ -226,34 +233,34 @@ class DATA_PT_shadow(DataButtonsPanel, Panel):
             col.prop(lamp, "shadow_color", text="")
 
             col = split.column()
-            col.prop(lamp, "use_shadow_layer", text=_("This Layer Only"))
+            col.prop(lamp, "use_shadow_layer", text="This Layer Only")
             col.prop(lamp, "use_only_shadow")
 
         if lamp.shadow_method == 'RAY_SHADOW':
             split = layout.split()
 
             col = split.column()
-            col.label(text=_("Sampling:"))
+            col.label(text="Sampling:")
 
             if lamp.type in {'POINT', 'SUN', 'SPOT'}:
                 sub = col.row()
 
-                sub.prop(lamp, "shadow_ray_samples", text=_("Samples"))
-                sub.prop(lamp, "shadow_soft_size", text=_("Soft Size"))
+                sub.prop(lamp, "shadow_ray_samples", text="Samples")
+                sub.prop(lamp, "shadow_soft_size", text="Soft Size")
 
             elif lamp.type == 'AREA':
                 sub = col.row(align=True)
 
                 if lamp.shape == 'SQUARE':
-                    sub.prop(lamp, "shadow_ray_samples_x", text=_("Samples"))
+                    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"))
+                    sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+                    sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
 
             col.row().prop(lamp, "shadow_ray_sample_method", expand=True)
 
             if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC':
-                layout.prop(lamp, "shadow_adaptive_threshold", text=_("Threshold"))
+                layout.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
 
             if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED':
                 row = layout.row()
@@ -263,48 +270,48 @@ class DATA_PT_shadow(DataButtonsPanel, Panel):
 
         elif lamp.shadow_method == 'BUFFER_SHADOW':
             col = layout.column()
-            col.label(text=_("Buffer Type:"))
+            col.label(text="Buffer Type:")
             col.row().prop(lamp, "shadow_buffer_type", expand=True)
 
             if lamp.shadow_buffer_type in {'REGULAR', 'HALFWAY', 'DEEP'}:
                 split = layout.split()
 
                 col = split.column()
-                col.label(text=_("Filter Type:"))
+                col.label(text="Filter Type:")
                 col.prop(lamp, "shadow_filter_type", text="")
                 sub = col.column(align=True)
-                sub.prop(lamp, "shadow_buffer_soft", text=_("Soft"))
-                sub.prop(lamp, "shadow_buffer_bias", text=_("Bias"))
+                sub.prop(lamp, "shadow_buffer_soft", text="Soft")
+                sub.prop(lamp, "shadow_buffer_bias", text="Bias")
 
                 col = split.column()
-                col.label(text=_("Sample Buffers:"))
+                col.label(text="Sample Buffers:")
                 col.prop(lamp, "shadow_sample_buffers", text="")
                 sub = col.column(align=True)
-                sub.prop(lamp, "shadow_buffer_size", text=_("Size"))
-                sub.prop(lamp, "shadow_buffer_samples", text=_("Samples"))
+                sub.prop(lamp, "shadow_buffer_size", text="Size")
+                sub.prop(lamp, "shadow_buffer_samples", text="Samples")
                 if lamp.shadow_buffer_type == 'DEEP':
                     col.prop(lamp, "compression_threshold")
 
             elif lamp.shadow_buffer_type == 'IRREGULAR':
-                layout.prop(lamp, "shadow_buffer_bias", text=_("Bias"))
+                layout.prop(lamp, "shadow_buffer_bias", text="Bias")
 
             split = layout.split()
 
             col = split.column()
-            col.prop(lamp, "use_auto_clip_start", text=_("Autoclip Start"))
+            col.prop(lamp, "use_auto_clip_start", text="Autoclip Start")
             sub = col.column()
             sub.active = not lamp.use_auto_clip_start
-            sub.prop(lamp, "shadow_buffer_clip_start", text=_("Clip Start"))
+            sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
 
             col = split.column()
-            col.prop(lamp, "use_auto_clip_end", text=_("Autoclip End"))
+            col.prop(lamp, "use_auto_clip_end", text="Autoclip End")
             sub = col.column()
             sub.active = not lamp.use_auto_clip_end
-            sub.prop(lamp, "shadow_buffer_clip_end", text=_(" Clip End"))
+            sub.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
 
 
 class DATA_PT_area(DataButtonsPanel, Panel):
-    bl_label = _("Area Shape")
+    bl_label = "Area Shape"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     @classmethod
@@ -322,15 +329,15 @@ class DATA_PT_area(DataButtonsPanel, Panel):
         col.row().prop(lamp, "shape", expand=True)
         sub = col.row(align=True)
 
-        if (lamp.shape == 'SQUARE'):
+        if lamp.shape == 'SQUARE':
             sub.prop(lamp, "size")
-        elif (lamp.shape == 'RECTANGLE'):
-            sub.prop(lamp, "size", text=_("Size X"))
-            sub.prop(lamp, "size_y", text=_("Size Y"))
+        elif lamp.shape == 'RECTANGLE':
+            sub.prop(lamp, "size", text="Size X")
+            sub.prop(lamp, "size_y", text="Size Y")
 
 
 class DATA_PT_spot(DataButtonsPanel, Panel):
-    bl_label = _("Spot Shape")
+    bl_label = "Spot Shape"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     @classmethod
@@ -348,23 +355,24 @@ class DATA_PT_spot(DataButtonsPanel, Panel):
 
         col = split.column()
         sub = col.column()
-        sub.prop(lamp, "spot_size", text=_("Size"))
-        sub.prop(lamp, "spot_blend", text=_("Blend"), slider=True)
+        sub.prop(lamp, "spot_size", text="Size")
+        sub.prop(lamp, "spot_blend", text="Blend", slider=True)
         col.prop(lamp, "use_square")
         col.prop(lamp, "show_cone")
 
         col = split.column()
 
+        col.active = (lamp.shadow_method != 'BUFFER_SHADOW' or lamp.shadow_buffer_type != 'DEEP')
         col.prop(lamp, "use_halo")
         sub = col.column(align=True)
         sub.active = lamp.use_halo
-        sub.prop(lamp, "halo_intensity", text=_("Intensity"))
+        sub.prop(lamp, "halo_intensity", text="Intensity")
         if lamp.shadow_method == 'BUFFER_SHADOW':
-            sub.prop(lamp, "halo_step", text=_("Step"))
+            sub.prop(lamp, "halo_step", text="Step")
 
 
 class DATA_PT_falloff_curve(DataButtonsPanel, Panel):
-    bl_label = _("Falloff Curve")
+    bl_label = "Falloff Curve"
     bl_options = {'DEFAULT_CLOSED'}
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
@@ -378,7 +386,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, Panel):
     def draw(self, context):
         lamp = context.lamp
 
-        self.layout.template_curve_mapping(lamp, "falloff_curve")
+        self.layout.template_curve_mapping(lamp, "falloff_curve", use_negative_slope=True)
 
 
 class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, Panel):