diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-05-17 18:27:15 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-05-17 18:28:44 -0300 |
commit | c195c0df6b36debc870216dd42e49fbda70fa861 (patch) | |
tree | 194a26e39ace86d7a471f3e86159c2aed6be261c /scene/2d/navigation_polygon.cpp | |
parent | 3a26e14a2bab777c9ba6aedceff6e4ef2666faf0 (diff) |
-Added configuration warning system for nodes
-Added a new "add" and "instance" buttons for scene tree
-Added a vformat() function to ease translation work
Diffstat (limited to 'scene/2d/navigation_polygon.cpp')
-rw-r--r-- | scene/2d/navigation_polygon.cpp | 23 |
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); |