diff options
author | smix8 <52464204+smix8@users.noreply.github.com> | 2023-01-16 17:45:03 +0100 |
---|---|---|
committer | smix8 <52464204+smix8@users.noreply.github.com> | 2023-01-31 18:27:35 +0100 |
commit | 0ab764e84bc9d7f21292f954fb2be215377a7276 (patch) | |
tree | 5fbcee4056894c246ba9e61ca316d2bd497bda62 /servers/navigation_server_2d.cpp | |
parent | 2b710bc336a02ace95eb0588f3b0744923faf004 (diff) |
Add NavigationAgent Path Debug Visualization
Adds path debug visuals for NavigationAgent2D, NavigationAgent3D and NavigationServer.
Diffstat (limited to 'servers/navigation_server_2d.cpp')
-rw-r--r-- | servers/navigation_server_2d.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 2e4087c1de..85ba8ed431 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -207,6 +207,30 @@ void NavigationServer2D::set_debug_navigation_enable_edge_connections(const bool bool NavigationServer2D::get_debug_navigation_enable_edge_connections() const { return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections(); } + +void NavigationServer2D::set_debug_navigation_agent_path_color(const Color &p_color) { + NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_color(p_color); +} + +Color NavigationServer2D::get_debug_navigation_agent_path_color() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_color(); +} + +void NavigationServer2D::set_debug_navigation_enable_agent_paths(const bool p_value) { + NavigationServer3D::get_singleton()->set_debug_navigation_enable_agent_paths(p_value); +} + +bool NavigationServer2D::get_debug_navigation_enable_agent_paths() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_enable_agent_paths(); +} + +void NavigationServer2D::set_debug_navigation_agent_path_point_size(float p_point_size) { + NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_point_size(p_point_size); +} + +float NavigationServer2D::get_debug_navigation_agent_path_point_size() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_agent_path_point_size(); +} #endif // DEBUG_ENABLED void NavigationServer2D::_bind_methods() { @@ -286,14 +310,26 @@ void NavigationServer2D::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free); ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); + + ADD_SIGNAL(MethodInfo("navigation_debug_changed")); } NavigationServer2D::NavigationServer2D() { singleton = this; ERR_FAIL_COND_MSG(!NavigationServer3D::get_singleton(), "The Navigation3D singleton should be initialized before the 2D one."); NavigationServer3D::get_singleton()->connect("map_changed", callable_mp(this, &NavigationServer2D::_emit_map_changed)); + +#ifdef DEBUG_ENABLED + NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationServer2D::_emit_navigation_debug_changed_signal)); +#endif // DEBUG_ENABLED } +#ifdef DEBUG_ENABLED +void NavigationServer2D::_emit_navigation_debug_changed_signal() { + emit_signal(SNAME("navigation_debug_changed")); +} +#endif // DEBUG_ENABLED + NavigationServer2D::~NavigationServer2D() { singleton = nullptr; } |