fix for error in world buttons when the world was None
authorCampbell Barton <ideasman42@gmail.com>
Fri, 13 Aug 2010 22:35:13 +0000 (22:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Aug 2010 22:35:13 +0000 (22:35 +0000)
release/scripts/ui/properties_world.py

index 1fa0d15a90b86a782b4e20d62ccc8dad02d8f711..bb5758ff902967cff16f5d6c86532b6399f38d5d 100644 (file)
@@ -29,8 +29,7 @@ class WorldButtonsPanel():
 
     @classmethod
     def poll(cls, context):
-        rd = context.scene.render
-        return (rd.engine in cls.COMPAT_ENGINES)
+        return (context.world and context.scene.render.engine in cls.COMPAT_ENGINES)
 
 
 class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
@@ -70,12 +69,6 @@ class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
         self.layout.template_preview(context.world)
 
 
-
-
-
-
-
-
 class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
     bl_label = "World"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -141,8 +134,8 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
 
     @classmethod
     def poll(cls, context):
-        light = context.world.lighting
-        return light.gather_method == 'APPROXIMATE'
+        light = getattr(context.world, "lighting", None)
+        return light and light.gather_method == 'APPROXIMATE'
 
     def draw_header(self, context):
         light = context.world.lighting