create COMPAT_ENGINE in game panels to allow external game engines - patch from Xavier Thomas(xat)

This commit is contained in:
Dalai Felinto 2010-06-10 23:53:13 +00:00
parent 8480b21d4a
commit b45b0512c8

@ -30,11 +30,12 @@ class PhysicsButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
ob = context.active_object ob = context.active_object
rd = context.scene.render rd = context.scene.render
return ob and ob.game and (rd.engine == 'BLENDER_GAME') return ob and ob.game and (rd.engine in self.COMPAT_ENGINES)
class PHYSICS_PT_game_physics(PhysicsButtonsPanel): class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
bl_label = "Physics" bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -163,11 +164,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel): class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
bl_label = "Collision Bounds" bl_label = "Collision Bounds"
COMPAT_ENGINES = {'BLENDER_GAME'}
def poll(self, context): def poll(self, context):
game = context.object.game game = context.object.game
rd = context.scene.render rd = context.scene.render
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME') return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in self.COMPAT_ENGINES)
def draw_header(self, context): def draw_header(self, context):
game = context.active_object.game game = context.active_object.game
@ -203,11 +205,12 @@ class RenderButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
rd = context.scene.render rd = context.scene.render
return (rd.engine == 'BLENDER_GAME') return (rd.engine in self.COMPAT_ENGINES)
class RENDER_PT_game(RenderButtonsPanel): class RENDER_PT_game(RenderButtonsPanel):
bl_label = "Game" bl_label = "Game"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -219,6 +222,7 @@ class RENDER_PT_game(RenderButtonsPanel):
class RENDER_PT_game_player(RenderButtonsPanel): class RENDER_PT_game_player(RenderButtonsPanel):
bl_label = "Standalone Player" bl_label = "Standalone Player"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -256,6 +260,7 @@ class RENDER_PT_game_player(RenderButtonsPanel):
class RENDER_PT_game_stereo(RenderButtonsPanel): class RENDER_PT_game_stereo(RenderButtonsPanel):
bl_label = "Stereo" bl_label = "Stereo"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -315,6 +320,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel):
class RENDER_PT_game_shading(RenderButtonsPanel): class RENDER_PT_game_shading(RenderButtonsPanel):
bl_label = "Shading" bl_label = "Shading"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -343,6 +349,7 @@ class RENDER_PT_game_shading(RenderButtonsPanel):
class RENDER_PT_game_performance(RenderButtonsPanel): class RENDER_PT_game_performance(RenderButtonsPanel):
bl_label = "Performance" bl_label = "Performance"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -368,6 +375,7 @@ class RENDER_PT_game_performance(RenderButtonsPanel):
class RENDER_PT_game_sound(RenderButtonsPanel): class RENDER_PT_game_sound(RenderButtonsPanel):
bl_label = "Sound" bl_label = "Sound"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -390,12 +398,13 @@ class WorldButtonsPanel(bpy.types.Panel):
def poll(self, context): def poll(self, context):
scene = context.scene scene = context.scene
return (scene.render.engine == 'BLENDER_GAME') and (scene.world is not None) return (scene.render.engine in self.COMPAT_ENGINES) and (scene.world is not None)
class WORLD_PT_game_context_world(WorldButtonsPanel): class WORLD_PT_game_context_world(WorldButtonsPanel):
bl_label = "" bl_label = ""
bl_show_header = False bl_show_header = False
COMPAT_ENGINES = {'BLENDER_GAME'}
def poll(self, context): def poll(self, context):
rd = context.scene.render rd = context.scene.render
@ -424,6 +433,7 @@ class WORLD_PT_game_context_world(WorldButtonsPanel):
class WORLD_PT_game_world(WorldButtonsPanel): class WORLD_PT_game_world(WorldButtonsPanel):
bl_label = "World" bl_label = "World"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
@ -443,6 +453,7 @@ class WORLD_PT_game_world(WorldButtonsPanel):
class WORLD_PT_game_mist(WorldButtonsPanel): class WORLD_PT_game_mist(WorldButtonsPanel):
bl_label = "Mist" bl_label = "Mist"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw_header(self, context): def draw_header(self, context):
world = context.world world = context.world
@ -468,6 +479,7 @@ class WORLD_PT_game_mist(WorldButtonsPanel):
class WORLD_PT_game_physics(WorldButtonsPanel): class WORLD_PT_game_physics(WorldButtonsPanel):
bl_label = "Physics" bl_label = "Physics"
COMPAT_ENGINES = {'BLENDER_GAME'}
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout