[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40082] trunk/blender/release/scripts/ startup/bl_ui: Fixing bugs after Recast & Detour branch merge!!

Thomas Dinges blender at dingto.org
Sat Sep 10 00:47:27 CEST 2011


Revision: 40082
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40082
Author:   dingto
Date:     2011-09-09 22:47:26 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Fixing bugs after Recast & Detour branch merge!!
* The new NAVMESH Modifier did not show any buttons, console printed errors instead! 
* Poll of "PHYSICS_PT_game_obstacles" panel caused errors as well, self instead of cls was used as argument.
* Check to show/hide buttons in "WORLD_PT_game_physics_obstacles" panel did not worked due to wrong ENUM identifier ('None' instead if 'NONE')
* Moved "SCENE_PT_navmesh" panel out of properties_scene.py into the properties_game.py where it belongs and renamed it. Also, don't use abreviations in Panel Headers (Navmesh > Navigaion Mesh)
* Code cleanup, removed unnescecary code. 
* bpy.types.Panel > Panel

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
    trunk/blender/release/scripts/startup/bl_ui/properties_game.py
    trunk/blender/release/scripts/startup/bl_ui/properties_scene.py

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py	2011-09-09 22:02:12 UTC (rev 40081)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py	2011-09-09 22:47:26 UTC (rev 40082)
@@ -380,12 +380,9 @@
         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")
+        row = layout.row()
+        row.operator("object.assign_navpolygon", text="Assign poly idx")
+        row.operator("object.assign_new_navpolygon", text="Assign new poly idx")
 
     def MULTIRES(self, layout, ob, md):
         layout.row().prop(md, "subdivision_type", expand=True)

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_game.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_game.py	2011-09-09 22:02:12 UTC (rev 40081)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_game.py	2011-09-09 22:47:26 UTC (rev 40082)
@@ -195,12 +195,12 @@
         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"
+class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel):
+    bl_label = "Create Obstacle"
     COMPAT_ENGINES = {'BLENDER_GAME'}
  
     @classmethod
-    def poll(self, context):
+    def poll(cls, 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)
@@ -217,9 +217,9 @@
 
         layout.active = game.create_obstacle
 
-        split = layout.split()
-        col = split.column()
-        col.prop(game, "obstacle_radius", text="Radius")		
+        row = layout.row()
+        row.prop(game, "obstacle_radius", text="Radius")
+        row.label()
 
 class RenderButtonsPanel():
     bl_space_type = 'PROPERTIES'
@@ -387,8 +387,65 @@
         flow.prop(gs, "show_physics_visualization", text="Physics Visualization")
         flow.prop(gs, "use_deprecation_warnings")
         flow.prop(gs, "show_mouse", text="Mouse Cursor")
+        
+class SceneButtonsPanel():
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "scene"
+        
+class SCENE_PT_game_navmesh(SceneButtonsPanel, bpy.types.Panel):
+    bl_label = "Navigation mesh"
+    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')
+
+        col = layout.column()
+        col.label(text="Rasterization:")
+        row = col.row()
+        row.prop(rd, "cell_size")
+        row.prop(rd, "cell_height")
+
+        col = layout.column()
+        col.label(text="Agent:")
+        split = col.split()
+
+        col = split.column()
+        col.prop(rd, "agent_height", text="Height")
+        col.prop(rd, "agent_radius", text="Radius")
+
+        col = split.column()
+        col.prop(rd, "max_slope")
+        col.prop(rd, "max_climb")
+
+        col = layout.column()
+        col.label(text="Region:")
+        row = col.row()
+        row.prop(rd, "region_min_size")
+        row.prop(rd, "region_merge_size")
+
+        col = layout.column()
+        col.label(text="Polygonization:")
+        split = col.split()
+        
+        col = split.column()
+        col.prop(rd, "edge_max_len")
+        col.prop(rd, "edge_max_error")
+
+        split.prop(rd, "verts_per_poly")
+        
+        col = layout.column()
+        col.label(text="Detail Mesh:")
+        row = col.row()
+        row.prop(rd, "sample_dist")
+        row.prop(rd, "sample_max_error")
+
+
 class WorldButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -512,7 +569,7 @@
             col.label(text="Logic Steps:")
             col.prop(gs, "logic_step_max", text="Max")
 
-class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, bpy.types.Panel):
+class WORLD_PT_game_physics_obstacles(WorldButtonsPanel, Panel):
     bl_label = "Obstacle simulation"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
@@ -522,7 +579,7 @@
         gs = context.scene.game_settings
 
         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, "show_obstacle_simulation")
 

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_scene.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_scene.py	2011-09-09 22:02:12 UTC (rev 40081)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_scene.py	2011-09-09 22:47:26 UTC (rev 40082)
@@ -331,76 +331,5 @@
         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__)




More information about the Bf-blender-cvs mailing list