Skip to content

Commit

Permalink
Merge pull request #62187 from smix8/nav_nodes_depr_3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Jun 20, 2022
2 parents fa4c398 + 693aeaf commit 3c35617
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/classes/Navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Mesh-based navigation and pathfinding node.
</brief_description>
<description>
[i]Deprecated.[/i] [Navigation] node and [method get_simple_path] are deprecated and will be removed in a future version. Use [method NavigationServer.map_get_path] instead.
Provides navigation and pathfinding within a collection of [NavigationMesh]es. By default, these will be automatically collected from child [NavigationMeshInstance] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
</description>
<tutorials>
Expand Down Expand Up @@ -52,6 +53,7 @@
<argument index="1" name="end" type="Vector3" />
<argument index="2" name="optimize" type="bool" default="true" />
<description>
[i]Deprecated.[/i] [Navigation] node and [method get_simple_path] are deprecated and will be removed in a future version. Use [method NavigationServer.map_get_path] instead.
Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the agent properties associated with each [NavigationMesh] (radius, height, etc.) are considered in the path calculation, otherwise they are ignored.
</description>
</method>
Expand Down
2 changes: 2 additions & 0 deletions doc/classes/Navigation2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
2D navigation and pathfinding node.
</brief_description>
<description>
[i]Deprecated.[/i] [Navigation2D] node and [method get_simple_path] are deprecated and will be removed in a future version. Use [method Navigation2DServer.map_get_path] instead.
Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. By default, these are automatically collected from child [NavigationPolygonInstance] nodes.
</description>
<tutorials>
Expand Down Expand Up @@ -36,6 +37,7 @@
<argument index="1" name="end" type="Vector2" />
<argument index="2" name="optimize" type="bool" default="true" />
<description>
[i]Deprecated.[/i] [Navigation2D] node and [method get_simple_path] are deprecated and will be removed in a future version. Use [method Navigation2DServer.map_get_path] instead.
Returns the path between two given points. Points are in local coordinate space. If [code]optimize[/code] is [code]true[/code] (the default), the path is smoothed by merging path segments where possible.
</description>
</method>
Expand Down
5 changes: 5 additions & 0 deletions scene/2d/navigation_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ void Navigation2D::set_edge_connection_margin(float p_edge_connection_margin) {
}

Vector<Vector2> Navigation2D::get_simple_path(const Vector2 &p_start, const Vector2 &p_end, bool p_optimize) const {
WARN_DEPRECATED_MSG("'Navigation2D' node and 'Navigation2D.get_simple_path()' are deprecated and will be removed in a future version. Use 'Navigation2DServer.map_get_path()' instead.");
return Navigation2DServer::get_singleton()->map_get_path(map, p_start, p_end, p_optimize, navigation_layers);
}

String Navigation2D::get_configuration_warning() const {
return TTR("'Navigation2D' node and 'Navigation2D.get_simple_path()' are deprecated and will be removed in a future version. Use 'Navigation2DServer.map_get_path()' instead.");
}

Vector2 Navigation2D::get_closest_point(const Vector2 &p_point) const {
return Navigation2DServer::get_singleton()->map_get_closest_point(map, p_point);
}
Expand Down
2 changes: 2 additions & 0 deletions scene/2d/navigation_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class Navigation2D : public Node2D {
Vector2 get_closest_point(const Vector2 &p_point) const;
RID get_closest_point_owner(const Vector2 &p_point) const;

virtual String get_configuration_warning() const;

Navigation2D();
~Navigation2D();
};
Expand Down
5 changes: 5 additions & 0 deletions scene/3d/navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
#include "servers/navigation_server.h"

Vector<Vector3> Navigation::get_simple_path(const Vector3 &p_start, const Vector3 &p_end, bool p_optimize) const {
WARN_DEPRECATED_MSG("'Navigation' node and 'Navigation.get_simple_path()' are deprecated and will be removed in a future version. Use 'NavigationServer.map_get_path()' instead.");
return NavigationServer::get_singleton()->map_get_path(map, p_start, p_end, p_optimize, navigation_layers);
}

String Navigation::get_configuration_warning() const {
return TTR("'Navigation' node and 'Navigation.get_simple_path()' are deprecated and will be removed in a future version. Use 'NavigationServer.map_get_path()' instead.");
}

Vector3 Navigation::get_closest_point_to_segment(const Vector3 &p_from, const Vector3 &p_to, bool p_use_collision) const {
return NavigationServer::get_singleton()->map_get_closest_point_to_segment(map, p_from, p_to, p_use_collision);
}
Expand Down
2 changes: 2 additions & 0 deletions scene/3d/navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class Navigation : public Spatial {
Vector3 get_closest_point_normal(const Vector3 &p_point) const;
RID get_closest_point_owner(const Vector3 &p_point) const;

virtual String get_configuration_warning() const;

Navigation();
~Navigation();
};
Expand Down

0 comments on commit 3c35617

Please sign in to comment.