[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27398] trunk/blender/release/scripts/ui/ properties_data_lamp.py: Add COMPAT_ENGINES mechanism to lamp panels so other render engines can show

Brecht Van Lommel brecht at blender.org
Wed Mar 10 21:24:06 CET 2010


Revision: 27398
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27398
Author:   blendix
Date:     2010-03-10 21:24:06 +0100 (Wed, 10 Mar 2010)

Log Message:
-----------
Add COMPAT_ENGINES mechanism to lamp panels so other render engines can show
different panels here.

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-03-10 20:21:09 UTC (rev 27397)
+++ trunk/blender/release/scripts/ui/properties_data_lamp.py	2010-03-10 20:24:06 UTC (rev 27398)
@@ -27,6 +27,7 @@
     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 @@
     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_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_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_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_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_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_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





More information about the Bf-blender-cvs mailing list