summaryrefslogtreecommitdiff
path: root/scene/3d/navigation_mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/navigation_mesh.cpp')
-rw-r--r--scene/3d/navigation_mesh.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index a238a8ff22..3adf282f13 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -329,6 +329,7 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh>& p_na
nav_id = navigation->navmesh_create(navmesh,get_relative_transform(navigation),this);
}
update_gizmo();
+ update_configuration_warning();
}
@@ -337,6 +338,27 @@ Ref<NavigationMesh> NavigationMeshInstance::get_navigation_mesh() const{
return navmesh;
}
+String NavigationMeshInstance::get_configuration_warning() const {
+
+ if (!is_visible() || !is_inside_tree())
+ return String();
+
+ if (!navmesh.is_valid()) {
+ return TTR("A NavigationMesh resource must be set or created for this node to work.");
+ }
+ const Spatial *c=this;
+ while(c) {
+
+ if (c->cast_to<Navigation>())
+ return String();
+
+ c=c->get_parent()->cast_to<Spatial>();
+ }
+
+ return TTR("NavigationMeshInstance must be a child or grandchild to a Navigation node. It only provides navigation data.");
+}
+
+
void NavigationMeshInstance::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_navigation_mesh","navmesh"),&NavigationMeshInstance::set_navigation_mesh);