summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-20 21:12:35 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-20 21:12:35 +0200
commitc0ec7e933ac6b6419e564b276b49c8d9a6d03f30 (patch)
treefe24f7fb736cac37c244b3bf4ce5655cb0b14282 /tools/editor
parent1ea4b8e2dc61b39e78fb1691f738a03091ee2138 (diff)
parentb03a892f9574d78da2cfded1b829c549dd1fced1 (diff)
Merge pull request #4302 from Anarchid/gridmap-navmesh
Navmesh support for GridMaps
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/plugins/cube_grid_theme_editor_plugin.cpp17
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) {