diff options
| author | Rémi Verschelde | 2016-04-20 21:12:35 +0200 |
|---|---|---|
| committer | Rémi Verschelde | 2016-04-20 21:12:35 +0200 |
| commit | c0ec7e933ac6b6419e564b276b49c8d9a6d03f30 (patch) | |
| tree | fe24f7fb736cac37c244b3bf4ce5655cb0b14282 /tools/editor/plugins/cube_grid_theme_editor_plugin.cpp | |
| parent | 1ea4b8e2dc61b39e78fb1691f738a03091ee2138 (diff) | |
| parent | b03a892f9574d78da2cfded1b829c549dd1fced1 (diff) | |
| download | godot-c0ec7e933ac6b6419e564b276b49c8d9a6d03f30.tar.gz godot-c0ec7e933ac6b6419e564b276b49c8d9a6d03f30.tar.zst godot-c0ec7e933ac6b6419e564b276b49c8d9a6d03f30.zip | |
Merge pull request #4302 from Anarchid/gridmap-navmesh
Navmesh support for GridMaps
Diffstat (limited to 'tools/editor/plugins/cube_grid_theme_editor_plugin.cpp')
| -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 ab4f14b80..4d6ea5dfb 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) { |
