From 73ca83184894f7c6a24178b25095088c7b4c508c Mon Sep 17 00:00:00 2001 From: Anarchid Date: Wed, 20 Apr 2016 21:19:05 +0300 Subject: Implement GridMap support for navigation meshes --- tools/editor/plugins/cube_grid_theme_editor_plugin.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index ab4f14b806..4d6ea5dfb0 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -35,6 +35,7 @@ #include "tools/editor/editor_node.h" #include "main/main.h" #include "tools/editor/editor_settings.h" +#include "scene/3d/navigation_mesh.h" void MeshLibraryEditor::edit(const Ref& p_theme) { @@ -107,6 +108,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, Ref collision; + for(int j=0;jget_child_count();j++) { #if 1 Node *child2 = mi->get_child(j); @@ -125,10 +127,21 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, p_library->set_item_shape(id,collision); } - + Ref navmesh; + for(int j=0;jget_child_count();j++) { + Node *child2 = mi->get_child(j); + if (!child2->cast_to()) + continue; + NavigationMeshInstance *sb = child2->cast_to(); + navmesh=sb->get_navigation_mesh(); + if (!navmesh.is_null()) + break; + } + if(!navmesh.is_null()){ + p_library->set_item_navmesh(id, navmesh); + } } - //generate previews! if (1) { -- cgit v1.2.3