From 693aeaf7990a11340a45f6c0a4251c556689903e Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Sun, 19 Jun 2022 02:00:22 +0200 Subject: [PATCH] [3.5] Mark Navigation/Navigation2D nodes as deprecated Mark Navigation/Navigation2D nodes as deprecated. They already just redirect calls to the NavigationServer and have no longer a real purpose. In Godot 4.0 both nodes are already removed for good reasons. --- doc/classes/Navigation.xml | 2 ++ doc/classes/Navigation2D.xml | 2 ++ scene/2d/navigation_2d.cpp | 5 +++++ scene/2d/navigation_2d.h | 2 ++ scene/3d/navigation.cpp | 5 +++++ scene/3d/navigation.h | 2 ++ 6 files changed, 18 insertions(+) diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml index 36a3757d8e0..2c9330ae107 100644 --- a/doc/classes/Navigation.xml +++ b/doc/classes/Navigation.xml @@ -4,6 +4,7 @@ Mesh-based navigation and pathfinding node. + [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. @@ -52,6 +53,7 @@ + [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. diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml index c78ffcf1f4e..0b7ff17f785 100644 --- a/doc/classes/Navigation2D.xml +++ b/doc/classes/Navigation2D.xml @@ -4,6 +4,7 @@ 2D navigation and pathfinding node. + [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. @@ -36,6 +37,7 @@ + [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. diff --git a/scene/2d/navigation_2d.cpp b/scene/2d/navigation_2d.cpp index 6b952bf97ab..360c7dec226 100644 --- a/scene/2d/navigation_2d.cpp +++ b/scene/2d/navigation_2d.cpp @@ -78,9 +78,14 @@ void Navigation2D::set_edge_connection_margin(float p_edge_connection_margin) { } Vector 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); } diff --git a/scene/2d/navigation_2d.h b/scene/2d/navigation_2d.h index 1e881d6670d..cae81bb91a7 100644 --- a/scene/2d/navigation_2d.h +++ b/scene/2d/navigation_2d.h @@ -68,6 +68,8 @@ public: 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(); }; diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index 3ea67bcb6be..af2f49c42e4 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -33,9 +33,14 @@ #include "servers/navigation_server.h" Vector 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); } diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h index 1009b482173..8651df8a473 100644 --- a/scene/3d/navigation.h +++ b/scene/3d/navigation.h @@ -82,6 +82,8 @@ public: 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(); };