Add COMPAT_ENGINES mechanism to lamp panels so other render engines can show

different panels here.
This commit is contained in:
Brecht Van Lommel 2010-03-10 20:24:06 +00:00
parent c0b3ab6ceb
commit 405d7554a0

@ -27,6 +27,7 @@ class LAMP_MT_sunsky_presets(bpy.types.Menu):
bl_label = "Render Presets"
preset_subdir = "sunsky"
preset_operator = "script.python_file_run"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
draw = bpy.types.Menu.draw_preset
@ -36,19 +37,20 @@ class DataButtonsPanel(bpy.types.Panel):
bl_context = "data"
def poll(self, context):
return context.lamp
engine = context.scene.render.engine
return context.lamp and (engine in self.COMPAT_ENGINES)
class DATA_PT_preview(DataButtonsPanel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
self.layout.template_preview(context.lamp)
class DATA_PT_context_lamp(DataButtonsPanel):
bl_label = ""
bl_show_header = False
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
@ -75,10 +77,12 @@ class DATA_PT_context_lamp(DataButtonsPanel):
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel):
_context_path = "object.data"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
class DATA_PT_lamp(DataButtonsPanel):
bl_label = "Lamp"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
@ -125,10 +129,12 @@ class DATA_PT_lamp(DataButtonsPanel):
class DATA_PT_sunsky(DataButtonsPanel):
bl_label = "Sky & Atmosphere"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SUN')
engine = context.scene.render.engine
return (lamp and lamp.type == 'SUN') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -196,10 +202,12 @@ class DATA_PT_sunsky(DataButtonsPanel):
class DATA_PT_shadow(DataButtonsPanel):
bl_label = "Shadow"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA'))
engine = context.scene.render.engine
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -319,10 +327,12 @@ class DATA_PT_shadow(DataButtonsPanel):
class DATA_PT_area(DataButtonsPanel):
bl_label = "Area Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'AREA')
engine = context.scene.render.engine
return (lamp and lamp.type == 'AREA') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -344,10 +354,12 @@ class DATA_PT_area(DataButtonsPanel):
class DATA_PT_spot(DataButtonsPanel):
bl_label = "Spot Shape"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
lamp = context.lamp
return (lamp and lamp.type == 'SPOT')
engine = context.scene.render.engine
return (lamp and lamp.type == 'SPOT') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -379,11 +391,13 @@ class DATA_PT_spot(DataButtonsPanel):
class DATA_PT_falloff_curve(DataButtonsPanel):
bl_label = "Falloff Curve"
bl_default_closed = True
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def poll(self, context):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE')
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in self.COMPAT_ENGINES)
def draw(self, context):
lamp = context.lamp