diff options
Diffstat (limited to 'release/scripts/ui/properties_data_lamp.py')
-rw-r--r-- | release/scripts/ui/properties_data_lamp.py | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py index e72739f5ec7..a67d7c8fc87 100644 --- a/release/scripts/ui/properties_data_lamp.py +++ b/release/scripts/ui/properties_data_lamp.py @@ -36,14 +36,16 @@ class DataButtonsPanel(): bl_region_type = 'WINDOW' bl_context = "data" - def poll(self, context): - engine = context.scene.render.engine - return context.lamp and (engine in self.COMPAT_ENGINES) class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel): bl_label = "Preview" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.lamp and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): self.layout.template_preview(context.lamp) @@ -52,6 +54,11 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel): bl_show_header = False COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.lamp and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -79,11 +86,21 @@ class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel _context_path = "object.data" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.lamp and (engine in __class__.COMPAT_ENGINES) + class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel): bl_label = "Lamp" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + @staticmethod + def poll(context): + engine = context.scene.render.engine + return context.lamp and (engine in __class__.COMPAT_ENGINES) + def draw(self, context): layout = self.layout @@ -131,10 +148,11 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel): bl_label = "Sky & Atmosphere" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @staticmethod + def poll(context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type == 'SUN') and (engine in self.COMPAT_ENGINES) + return (lamp and lamp.type == 'SUN') and (engine in __class__.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -204,10 +222,11 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel): bl_label = "Shadow" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @staticmethod + def poll(context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in self.COMPAT_ENGINES) + return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in __class__.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -329,10 +348,11 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel): bl_label = "Area Shape" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @staticmethod + def poll(context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type == 'AREA') and (engine in self.COMPAT_ENGINES) + return (lamp and lamp.type == 'AREA') and (engine in __class__.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -356,10 +376,11 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel): bl_label = "Spot Shape" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @staticmethod + def poll(context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type == 'SPOT') and (engine in self.COMPAT_ENGINES) + return (lamp and lamp.type == 'SPOT') and (engine in __class__.COMPAT_ENGINES) def draw(self, context): layout = self.layout @@ -393,11 +414,12 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel): bl_default_closed = True COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - def poll(self, context): + @staticmethod + def poll(context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in self.COMPAT_ENGINES) + return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in __class__.COMPAT_ENGINES) def draw(self, context): lamp = context.lamp |