diff options
author | Anarchid <anarchid@mail.ru> | 2016-04-20 21:19:05 +0300 |
---|---|---|
committer | Anarchid <anarchid@mail.ru> | 2016-04-20 21:19:05 +0300 |
commit | 73ca83184894f7c6a24178b25095088c7b4c508c (patch) | |
tree | ec1dfc5421dbe45af33a06fe9b1e679a6281b5a7 /tools/editor/plugins | |
parent | 15d1fca0614ad87fd16fa7532e4db867b342d00e (diff) |
Implement GridMap support for navigation meshes
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r-- | tools/editor/plugins/cube_grid_theme_editor_plugin.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
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<MeshLibrary>& p_theme) { @@ -107,6 +108,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, Ref<Shape> collision; + for(int j=0;j<mi->get_child_count();j++) { #if 1 Node *child2 = mi->get_child(j); @@ -125,10 +127,21 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, p_library->set_item_shape(id,collision); } - + Ref<NavigationMesh> navmesh; + for(int j=0;j<mi->get_child_count();j++) { + Node *child2 = mi->get_child(j); + if (!child2->cast_to<NavigationMeshInstance>()) + continue; + NavigationMeshInstance *sb = child2->cast_to<NavigationMeshInstance>(); + 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) { |