diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2011-09-10 01:28:56 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2011-09-10 01:28:56 +0400 |
commit | 5d4a5b47a0a39b550e58bda9c4fbb0073e8abf3c (patch) | |
tree | 43c6cef472a102161f423070637f3a1a8051b9a8 /release/scripts | |
parent | 4b1a8d62e1b8f575bec87d12afc4d367468c1002 (diff) | |
parent | 673552502bb2af1d78653bd7ce5a91e08403f41f (diff) |
BGE: merge Recast & Detour branch (sock-2010-nicks).
Add navigation mesh capability to the BGE, both by logic bricks and python.
Add tools to creation navigation mesh in the creator:
- manualy
- automatically from existing mesh with "object.create_navmesh" operator
- automatically from existing mesh with "Navigation mesh" modifier
Editing navigation mesh is possible via special modifier edit mode.
Creation and modification of Navigation mesh is also possible at runtime in the BGE.
Documentation at http://wiki.blender.org/index.php/User:Nicks/Gsoc2010/Docs
Warning: No upgrade is provided for blend files created under the branch.
If you load a blend with navigation data created with a branch
build, it will likely crash blender or behave incorrectly.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_modifier.py | 8 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_game.py | 39 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_scene.py | 71 |
3 files changed, 118 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 8d4e3f153b1..510cab879ec 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -379,6 +379,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.label(text="Mirror Object:") col.prop(md, "mirror_object", text="") + def NAVMESH(self, layout, ob, md): + split = layout.split() + if ob.mode == 'EDIT': + col = split.column() + col.operator("object.assign_navpolygon", text="Assign poly idx") + col = split.column() + col.operator("object.assign_new_navpolygon", text="Assign new poly idx") + def MULTIRES(self, layout, ob, md): layout.row().prop(md, "subdivision_type", expand=True) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 5ea55d82471..51f2ece72b8 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -195,6 +195,31 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel): row.prop(game, "collision_margin", text="Margin", slider=True) row.prop(game, "use_collision_compound", text="Compound") +class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, bpy.types.Panel): + bl_label = "Create obstacle" + COMPAT_ENGINES = {'BLENDER_GAME'} + + @classmethod + def poll(self, context): + game = context.object.game + rd = context.scene.render + return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES) + + def draw_header(self, context): + game = context.active_object.game + + self.layout.prop(game, "create_obstacle", text="") + + def draw(self, context): + layout = self.layout + + game = context.active_object.game + + layout.active = game.create_obstacle + + split = layout.split() + col = split.column() + col.prop(game, "obstacle_radius", text="Radius") class RenderButtonsPanel(): bl_space_type = 'PROPERTIES' @@ -487,5 +512,19 @@ class WORLD_PT_game_physics(WorldButtonsPanel, Panel): col.label(text="Logic Steps:") col.prop(gs, "logic_step_max", text="Max") +class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, bpy.types.Panel): + bl_label = "Obstacle simulation" + COMPAT_ENGINES = {'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + + gs = context.scene.game_settings + + layout.prop(gs, "obstacle_simulation", text = "Type") + if gs.obstacle_simulation != 'None': + layout.prop(gs, "level_height") + layout.prop(gs, "show_obstacle_simulation") + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 66f967bb6e1..001897c222f 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -331,5 +331,76 @@ class ANIM_OT_keying_set_export(Operator): wm.fileselect_add(self) return {'RUNNING_MODAL'} +class SCENE_PT_navmesh(SceneButtonsPanel, bpy.types.Panel): + bl_label = "Navmesh" + bl_default_closed = True + COMPAT_ENGINES = {'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + + rd = context.scene.game_settings.recast_data + + layout.operator("object.create_navmesh", text='Build navigation mesh') + + layout.label(text="Rasterization:") + split = layout.split() + + col = split.column() + col.prop(rd, "cell_size") + col = split.column() + col.prop(rd, "cell_height") + + layout.separator() + + layout.label(text="Agent:") + split = layout.split() + + col = split.column() + row = col.row() + row.prop(rd, "agent_height") + row = col.row() + row.prop(rd, "agent_radius") + + col = split.column() + row = col.row() + row.prop(rd, "max_slope") + row = col.row() + row.prop(rd, "max_climb") + + layout.separator() + + layout.label(text="Region:") + split = layout.split() + col = split.column() + col.prop(rd, "region_min_size") + + col = split.column() + col.prop(rd, "region_merge_size") + + layout.separator() + + layout.label(text="Polygonization:") + split = layout.split() + col = split.column() + row = col.row() + row.prop(rd, "edge_max_len") + row = col.row() + row.prop(rd, "edge_max_error") + + col = split.column() + row = col.row() + row.prop(rd, "verts_per_poly") + + layout.separator() + + layout.label(text="Detail Mesh:") + split = layout.split() + col = split.column() + col.prop(rd, "sample_dist") + + col = split.column() + col.prop(rd, "sample_max_error") + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) |