summaryrefslogtreecommitdiff
path: root/scene/2d/navigation_polygon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/navigation_polygon.cpp')
-rw-r--r--scene/2d/navigation_polygon.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 376aeb2d85..8c0d9cf35f 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -413,6 +413,7 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg
}
//update_gizmo();
_change_notify("navpoly");
+ update_configuration_warning();
}
@@ -427,6 +428,28 @@ void NavigationPolygonInstance::_navpoly_changed() {
update();
}
+
+String NavigationPolygonInstance::get_configuration_warning() const {
+
+ if (!is_visible() || !is_inside_tree())
+ return String();
+
+ if (!navpoly.is_valid()) {
+ return TTR("A NavigationPolygon resource must be set or created for this node to work. Please set a property or draw a polygon.");
+ }
+ const Node2D *c=this;
+ while(c) {
+
+ if (c->cast_to<Navigation2D>()) {
+ return String();
+ }
+
+ c=c->get_parent()->cast_to<Node2D>();
+ }
+
+ return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
+}
+
void NavigationPolygonInstance::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_navigation_polygon","navpoly:NavigationPolygon"),&NavigationPolygonInstance::set_navigation_polygon);