diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/Navigation2DServer.xml index 846071eea..088964569 100644 --- a/doc/classes/Navigation2DServer.xml +++ b/doc/classes/Navigation2DServer.xml @@ -127,6 +127,12 @@ Destroys the given RID. + + + + Returns [code]true[/code] when the NavigationServer has debug enabled. + + diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer.xml index d3402dead..eb2f51136 100644 --- a/doc/classes/NavigationServer.xml +++ b/doc/classes/NavigationServer.xml @@ -127,6 +127,13 @@ Destroys the given RID. + + + + + If [code]true[/code] enables debug mode on the NavigationServer. + + diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 7ccd3c7fa..3d05d2e2e 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -108,6 +108,9 @@ void Navigation2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &Navigation2DServer::free); + ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &Navigation2DServer::set_debug_enabled); + ClassDB::bind_method(D_METHOD("get_debug_enabled"), &Navigation2DServer::get_debug_enabled); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); } @@ -131,7 +134,6 @@ Navigation2DServer::~Navigation2DServer() { singleton = nullptr; } -#ifdef DEBUG_ENABLED void Navigation2DServer::set_debug_enabled(bool p_enabled) { NavigationServer::get_singleton_mut()->set_debug_enabled(p_enabled); } @@ -139,6 +141,8 @@ bool Navigation2DServer::get_debug_enabled() const { return NavigationServer::get_singleton()->get_debug_enabled(); } +#ifdef DEBUG_ENABLED + void Navigation2DServer::set_debug_navigation_link_connection_color(const Color &p_color) { NavigationServer::get_singleton_mut()->set_debug_navigation_link_connection_color(p_color); } diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h index 7b6a66d5b..3bb009e8c 100644 --- a/servers/navigation_2d_server.h +++ b/servers/navigation_2d_server.h @@ -238,10 +238,10 @@ public: Navigation2DServer(); virtual ~Navigation2DServer(); -#ifdef DEBUG_ENABLED void set_debug_enabled(bool p_enabled); bool get_debug_enabled() const; +#ifdef DEBUG_ENABLED void set_debug_navigation_link_connection_color(const Color &p_color); Color get_debug_navigation_link_connection_color() const; diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index 4be963a1f..33ecda260 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -130,6 +130,9 @@ void NavigationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_active", "active"), &NavigationServer::set_active); ClassDB::bind_method(D_METHOD("process", "delta_time"), &NavigationServer::process); + ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationServer::set_debug_enabled); + ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationServer::get_debug_enabled); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); #ifdef DEBUG_ENABLED @@ -181,6 +184,22 @@ NavigationServer::~NavigationServer() { singleton = nullptr; } +void NavigationServer::set_debug_enabled(bool p_enabled) { + if (_debug_enabled != p_enabled) { + _debug_dirty = true; + } + + _debug_enabled = p_enabled; + + if (_debug_dirty) { + call_deferred("_emit_navigation_debug_changed_signal"); + } +} + +bool NavigationServer::get_debug_enabled() const { + return _debug_enabled; +} + #ifdef DEBUG_ENABLED void NavigationServer::_emit_navigation_debug_changed_signal() { if (_debug_dirty) { @@ -481,21 +500,6 @@ bool NavigationServer::get_debug_navigation_enable_link_connections_xray() const return _debug_navigation_enable_link_connections_xray; } -void NavigationServer::set_debug_enabled(bool p_enabled) { - if (_debug_enabled != p_enabled) { - _debug_dirty = true; - } - - _debug_enabled = p_enabled; - - if (_debug_dirty) { - call_deferred("_emit_navigation_debug_changed_signal"); - } -} - -bool NavigationServer::get_debug_enabled() const { - return _debug_enabled; -} #endif // DEBUG_ENABLED void NavigationServer::query_path(const Ref &p_query_parameters, Ref p_query_result) const { diff --git a/servers/navigation_server.h b/servers/navigation_server.h index d7484b975..8397e2e64 100644 --- a/servers/navigation_server.h +++ b/servers/navigation_server.h @@ -263,11 +263,11 @@ public: NavigationServer(); virtual ~NavigationServer(); -#ifdef DEBUG_ENABLED - void set_debug_enabled(bool p_enabled); bool get_debug_enabled() const; +#ifdef DEBUG_ENABLED + void set_debug_navigation_edge_connection_color(const Color &p_color); Color get_debug_navigation_edge_connection_color() const;