From f0a0daf0d1bd9744125c536f2baeecc9228dcb9e Mon Sep 17 00:00:00 2001 From: Shohrukh1999 <46423713+Shohrukh1999@users.noreply.github.com> Date: Fri, 8 May 2020 01:52:35 +0500 Subject: [PATCH 1/5] Game Debug UI Without _flow, it looks much more readable. --- release/scripts/startup/bl_ui/properties_render.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 43098d1bade5..348b53cab66e 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -120,7 +120,7 @@ def draw(self, context): row.label(text="Exit Key") row.prop(gs, "exit_key", text="", event=True) - flow = layout.column_flow() + flow = layout.column() flow.prop(gs, "show_debug_properties", text="Debug Properties") flow.prop(gs, "show_framerate_profile", text="Framerate and Profile") flow.prop(gs, "show_physics_visualization", text="Physics Visualization") From 7b36333f5642c9cdf301715e1c9397778d3a2f9b Mon Sep 17 00:00:00 2001 From: Shohrukh1999 <46423713+Shohrukh1999@users.noreply.github.com> Date: Fri, 8 May 2020 09:56:36 +0500 Subject: [PATCH 2/5] Navmesh UI --- .../scripts/startup/bl_ui/properties_game.py | 96 ++++++++++++++----- 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 611b69229f9d..02fa2a30243d 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -425,49 +425,90 @@ def draw(self, context): layout.operator("mesh.navmesh_make", text="Build Navigation Mesh") - col = layout.column() - col.label(text="Rasterization:") - row = col.row() - row.prop(rd, "cell_size") - row.prop(rd, "cell_height") +class SCENE_PT_rasterization(SceneButtonsPanel, Panel): + bl_label = "Rasterization" + bl_parent_id = "SCENE_PT_game_navmesh" + COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + rd = context.scene.game_settings.recast_data col = layout.column() - col.label(text="Agent:") - split = col.split() + col.prop(rd, "cell_size") + col.prop(rd, "cell_height") - col = split.column() +class SCENE_PT_agent(SceneButtonsPanel, Panel): + bl_label = "Agent" + bl_parent_id = "SCENE_PT_game_navmesh" + COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + rd = context.scene.game_settings.recast_data + + col = layout.column() col.prop(rd, "agent_height", text="Height") col.prop(rd, "agent_radius", text="Radius") - - col = split.column() col.prop(rd, "slope_max") col.prop(rd, "climb_max") - col = layout.column() - col.label(text="Region:") - row = col.row() - row.prop(rd, "region_min_size") - if rd.partitioning != 'LAYERS': - row.prop(rd, "region_merge_size") +class SCENE_PT_region(SceneButtonsPanel, Panel): + bl_label = "Region" + bl_parent_id = "SCENE_PT_game_navmesh" + COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + rd = context.scene.game_settings.recast_data col = layout.column() + col.prop(rd, "region_min_size") + if rd.partitioning != 'LAYERS': + col.prop(rd, "region_merge_size") col.prop(rd, "partitioning") - col = layout.column() - col.label(text="Polygonization:") - split = col.split() +class SCENE_PT_polygonization(SceneButtonsPanel, Panel): + bl_label = "Polygonization" + bl_parent_id = "SCENE_PT_game_navmesh" + COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} - col = split.column() + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + rd = context.scene.game_settings.recast_data + + col = layout.column() col.prop(rd, "edge_max_len") col.prop(rd, "edge_max_error") + col.prop(rd, "verts_per_poly") + +class SCENE_PT_detail_mesh(SceneButtonsPanel, Panel): + bl_label = "Detail Mesh" + bl_parent_id = "SCENE_PT_game_navmesh" + COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} - split.prop(rd, "verts_per_poly") + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + rd = context.scene.game_settings.recast_data col = layout.column() - col.label(text="Detail Mesh:") - row = col.row() - row.prop(rd, "sample_dist") - row.prop(rd, "sample_max_error") + col.prop(rd, "sample_dist") + col.prop(rd, "sample_max_error") class SCENE_PT_game_hysteresis(SceneButtonsPanel, Panel): @@ -588,6 +629,11 @@ def draw(self, context): SCENE_PT_game_physics, SCENE_PT_game_physics_obstacles, SCENE_PT_game_navmesh, + SCENE_PT_rasterization, + SCENE_PT_agent, + SCENE_PT_region, + SCENE_PT_polygonization, + SCENE_PT_detail_mesh, SCENE_PT_game_hysteresis, SCENE_PT_game_console, OBJECT_MT_lod_tools, From 4c7a8b10ce5eed023cf7fa9976155328c314d50f Mon Sep 17 00:00:00 2001 From: Shohrukh1999 <46423713+Shohrukh1999@users.noreply.github.com> Date: Fri, 8 May 2020 10:16:06 +0500 Subject: [PATCH 3/5] Create Obstacle UI --- release/scripts/startup/bl_ui/properties_game.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 02fa2a30243d..1f31a2a888c6 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -307,6 +307,8 @@ def draw_header(self, context): def draw(self, context): layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False game = context.active_object.game @@ -314,7 +316,6 @@ def draw(self, context): row = layout.row() row.prop(game, "obstacle_radius", text="Radius") - row.label() class RenderButtonsPanel: From fb8e38342c3e456d67947d4d084255b66127870e Mon Sep 17 00:00:00 2001 From: Shohrukh1999 <46423713+Shohrukh1999@users.noreply.github.com> Date: Fri, 8 May 2020 10:25:56 +0500 Subject: [PATCH 4/5] Update properties_render.py --- .../scripts/startup/bl_ui/properties_render.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 348b53cab66e..640bb54753a9 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -120,14 +120,14 @@ def draw(self, context): row.label(text="Exit Key") row.prop(gs, "exit_key", text="", event=True) - flow = layout.column() - flow.prop(gs, "show_debug_properties", text="Debug Properties") - flow.prop(gs, "show_framerate_profile", text="Framerate and Profile") - flow.prop(gs, "show_physics_visualization", text="Physics Visualization") - flow.prop(gs, "use_deprecation_warnings") - flow.prop(gs, "show_mouse", text="Mouse Cursor") - flow.prop(gs, "use_undo", text="Undo at exit") - flow.prop(gs, "use_ui_anti_flicker", text="No UI flickering") + col = layout.column() + col.prop(gs, "show_debug_properties", text="Debug Properties") + col.prop(gs, "show_framerate_profile", text="Framerate and Profile") + col.prop(gs, "show_physics_visualization", text="Physics Visualization") + col.prop(gs, "use_deprecation_warnings") + col.prop(gs, "show_mouse", text="Mouse Cursor") + col.prop(gs, "use_undo", text="Undo at exit") + col.prop(gs, "use_ui_anti_flicker", text="No UI flickering") class RENDER_PT_color_management(RenderButtonsPanel, Panel): bl_label = "Color Management" From fc9dc2585043b15d5db8e9595d10ccc3d95ef06b Mon Sep 17 00:00:00 2001 From: Shohrukh1999 <46423713+Shohrukh1999@users.noreply.github.com> Date: Fri, 8 May 2020 19:43:43 +0500 Subject: [PATCH 5/5] Close some panels in Navmesh (by default) --- release/scripts/startup/bl_ui/properties_game.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 1f31a2a888c6..4bb55d6325d3 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -462,6 +462,7 @@ def draw(self, context): class SCENE_PT_region(SceneButtonsPanel, Panel): bl_label = "Region" + bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "SCENE_PT_game_navmesh" COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} @@ -480,6 +481,7 @@ def draw(self, context): class SCENE_PT_polygonization(SceneButtonsPanel, Panel): bl_label = "Polygonization" + bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "SCENE_PT_game_navmesh" COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'} @@ -497,6 +499,7 @@ def draw(self, context): class SCENE_PT_detail_mesh(SceneButtonsPanel, Panel): bl_label = "Detail Mesh" + bl_options = {'DEFAULT_CLOSED'} bl_parent_id = "SCENE_PT_game_navmesh" COMPAT_ENGINES = {'BLENDER_GAME', 'BLENDER_EEVEE'}