Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_game.py
| Show All 28 Lines | |||||
| class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel): | class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel): | ||||
| bl_label = "Physics" | bl_label = "Physics" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| ob = context.active_object | ob = context.active_object | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES) | return ob and ob.game and (view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.active_object | ob = context.active_object | ||||
| game = ob.game | game = ob.game | ||||
| soft = ob.game.soft_body | soft = ob.game.soft_body | ||||
| ▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
| class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel): | class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel): | ||||
| bl_label = "Collision Bounds" | bl_label = "Collision Bounds" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| game = context.object.game | game = context.object.game | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| return (rd.engine in cls.COMPAT_ENGINES) \ | return (view_render.engine in cls.COMPAT_ENGINES) \ | ||||
| and (game.physics_type in {'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID_BODY', 'CHARACTER', 'SOFT_BODY'}) | and (game.physics_type in {'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID_BODY', 'CHARACTER', 'SOFT_BODY'}) | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| game = context.active_object.game | game = context.active_object.game | ||||
| self.layout.prop(game, "use_collision_bounds", text="") | self.layout.prop(game, "use_collision_bounds", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| Show All 23 Lines | |||||
| class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel): | class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel): | ||||
| bl_label = "Create Obstacle" | bl_label = "Create Obstacle" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| game = context.object.game | game = context.object.game | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| return (rd.engine in cls.COMPAT_ENGINES) \ | return (view_render.engine in cls.COMPAT_ENGINES) \ | ||||
| and (game.physics_type in {'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID_BODY', 'SOFT_BODY', 'CHARACTER', 'NO_COLLISION'}) | and (game.physics_type in {'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID_BODY', 'SOFT_BODY', 'CHARACTER', 'NO_COLLISION'}) | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| game = context.active_object.game | game = context.active_object.game | ||||
| self.layout.prop(game, "use_obstacle_create", text="") | self.layout.prop(game, "use_obstacle_create", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| Show All 10 Lines | |||||
| class RenderButtonsPanel: | class RenderButtonsPanel: | ||||
| bl_space_type = 'PROPERTIES' | bl_space_type = 'PROPERTIES' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_context = "render" | bl_context = "render" | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| return (rd.engine in cls.COMPAT_ENGINES) | return (view_render.engine in cls.COMPAT_ENGINES) | ||||
| class RENDER_PT_embedded(RenderButtonsPanel, Panel): | class RENDER_PT_embedded(RenderButtonsPanel, Panel): | ||||
| bl_label = "Embedded Player" | bl_label = "Embedded Player" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| row = layout.row() | row = layout.row() | ||||
| row.operator("view3d.game_start", text="Start") | row.operator("view3d.game_start", text="Start") | ||||
| row = layout.row() | row = layout.row() | ||||
| row.label(text="Resolution:") | row.label(text="Resolution:") | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.prop(rd, "resolution_x", slider=False, text="X") | row.prop(rd, "resolution_x", slider=False, text="X") | ||||
| row.prop(rd, "resolution_y", slider=False, text="Y") | row.prop(rd, "resolution_y", slider=False, text="Y") | ||||
| ▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | |||||
| class SCENE_PT_game_physics(SceneButtonsPanel, Panel): | class SCENE_PT_game_physics(SceneButtonsPanel, Panel): | ||||
| bl_label = "Physics" | bl_label = "Physics" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene.render.engine in cls.COMPAT_ENGINES) | return (scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| gs = context.scene.game_settings | gs = context.scene.game_settings | ||||
| layout.prop(gs, "physics_engine", text="Engine") | layout.prop(gs, "physics_engine", text="Engine") | ||||
| if gs.physics_engine != 'NONE': | if gs.physics_engine != 'NONE': | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
| class SCENE_PT_game_physics_obstacles(SceneButtonsPanel, Panel): | class SCENE_PT_game_physics_obstacles(SceneButtonsPanel, Panel): | ||||
| bl_label = "Obstacle Simulation" | bl_label = "Obstacle Simulation" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene.render.engine in cls.COMPAT_ENGINES) | return (scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| gs = context.scene.game_settings | gs = context.scene.game_settings | ||||
| layout.prop(gs, "obstacle_simulation", text="Type") | layout.prop(gs, "obstacle_simulation", text="Type") | ||||
| if gs.obstacle_simulation != 'NONE': | if gs.obstacle_simulation != 'NONE': | ||||
| layout.prop(gs, "level_height") | layout.prop(gs, "level_height") | ||||
| layout.prop(gs, "show_obstacle_simulation") | layout.prop(gs, "show_obstacle_simulation") | ||||
| class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel): | class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel): | ||||
| bl_label = "Navigation Mesh" | bl_label = "Navigation Mesh" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene and scene.render.engine in cls.COMPAT_ENGINES) | return (scene and scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| rd = context.scene.game_settings.recast_data | rd = context.scene.game_settings.recast_data | ||||
| layout.operator("mesh.navmesh_make", text="Build Navigation Mesh") | layout.operator("mesh.navmesh_make", text="Build Navigation Mesh") | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| class SCENE_PT_game_hysteresis(SceneButtonsPanel, Panel): | class SCENE_PT_game_hysteresis(SceneButtonsPanel, Panel): | ||||
| bl_label = "Level of Detail" | bl_label = "Level of Detail" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene and scene.render.engine in cls.COMPAT_ENGINES) | return (scene and scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| gs = context.scene.game_settings | gs = context.scene.game_settings | ||||
| row = layout.row() | row = layout.row() | ||||
| row.prop(gs, "use_scene_hysteresis", text="Hysteresis") | row.prop(gs, "use_scene_hysteresis", text="Hysteresis") | ||||
| row = layout.row() | row = layout.row() | ||||
| Show All 9 Lines | |||||
| class WORLD_PT_game_context_world(WorldButtonsPanel, Panel): | class WORLD_PT_game_context_world(WorldButtonsPanel, Panel): | ||||
| bl_label = "" | bl_label = "" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| rd = context.scene.render | view_render = context.scene.view_render | ||||
| return (context.scene) and (rd.engine in cls.COMPAT_ENGINES) | return (context.scene) and (view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| scene = context.scene | scene = context.scene | ||||
| world = context.world | world = context.world | ||||
| space = context.space_data | space = context.space_data | ||||
| split = layout.split(percentage=0.65) | split = layout.split(percentage=0.65) | ||||
| if scene: | if scene: | ||||
| split.template_ID(scene, "world", new="world.new") | split.template_ID(scene, "world", new="world.new") | ||||
| elif world: | elif world: | ||||
| split.template_ID(space, "pin_id") | split.template_ID(space, "pin_id") | ||||
| class WORLD_PT_game_world(WorldButtonsPanel, Panel): | class WORLD_PT_game_world(WorldButtonsPanel, Panel): | ||||
| bl_label = "World" | bl_label = "World" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene.world and scene.render.engine in cls.COMPAT_ENGINES) | return (scene.world and scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| world = context.world | world = context.world | ||||
| row = layout.row() | row = layout.row() | ||||
| row.column().prop(world, "horizon_color") | row.column().prop(world, "horizon_color") | ||||
| row.column().prop(world, "zenith_color") | row.column().prop(world, "zenith_color") | ||||
| row.column().prop(world, "ambient_color") | row.column().prop(world, "ambient_color") | ||||
| class WORLD_PT_game_environment_lighting(WorldButtonsPanel, Panel): | class WORLD_PT_game_environment_lighting(WorldButtonsPanel, Panel): | ||||
| bl_label = "Environment Lighting" | bl_label = "Environment Lighting" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene.world and scene.render.engine in cls.COMPAT_ENGINES) | return (scene.world and scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| light = context.world.light_settings | light = context.world.light_settings | ||||
| self.layout.prop(light, "use_environment_light", text="") | self.layout.prop(light, "use_environment_light", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| light = context.world.light_settings | light = context.world.light_settings | ||||
| layout.active = light.use_environment_light | layout.active = light.use_environment_light | ||||
| split = layout.split() | split = layout.split() | ||||
| split.prop(light, "environment_energy", text="Energy") | split.prop(light, "environment_energy", text="Energy") | ||||
| split.prop(light, "environment_color", text="") | split.prop(light, "environment_color", text="") | ||||
| class WORLD_PT_game_mist(WorldButtonsPanel, Panel): | class WORLD_PT_game_mist(WorldButtonsPanel, Panel): | ||||
| bl_label = "Mist" | bl_label = "Mist" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (scene.world and scene.render.engine in cls.COMPAT_ENGINES) | return (scene.world and scene.view_render.engine in cls.COMPAT_ENGINES) | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| world = context.world | world = context.world | ||||
| self.layout.prop(world.mist_settings, "use_mist", text="") | self.layout.prop(world.mist_settings, "use_mist", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Show All 20 Lines | |||||
| class DATA_PT_shadow_game(DataButtonsPanel, Panel): | class DATA_PT_shadow_game(DataButtonsPanel, Panel): | ||||
| bl_label = "Shadow" | bl_label = "Shadow" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| COMPAT_LIGHTS = {'SPOT', 'SUN'} | COMPAT_LIGHTS = {'SPOT', 'SUN'} | ||||
| lamp = context.lamp | lamp = context.lamp | ||||
| engine = context.scene.render.engine | engine = context.engine | ||||
| return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES) | return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES) | ||||
| def draw_header(self, context): | def draw_header(self, context): | ||||
| lamp = context.lamp | lamp = context.lamp | ||||
| self.layout.prop(lamp, "use_shadow", text="") | self.layout.prop(lamp, "use_shadow", text="") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| class OBJECT_PT_levels_of_detail(ObjectButtonsPanel, Panel): | class OBJECT_PT_levels_of_detail(ObjectButtonsPanel, Panel): | ||||
| bl_label = "Levels of Detail" | bl_label = "Levels of Detail" | ||||
| COMPAT_ENGINES = {'BLENDER_GAME'} | COMPAT_ENGINES = {'BLENDER_GAME'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| return context.scene.render.engine in cls.COMPAT_ENGINES | return context.engine in cls.COMPAT_ENGINES | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.object | ob = context.object | ||||
| gs = context.scene.game_settings | gs = context.scene.game_settings | ||||
| col = layout.column() | col = layout.column() | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||