Repository: godotengine/godot (language: cpp)

Issue:
NavigationRegion2D visible even though not enabled in Debug
### Tested versions

v4.4.stable.steam.4c311cbee

### System information

Windows 11 - Godot Engine v4.4.stable.steam.4c311cbee

### Issue description

If you enable the option Debug > Visible Avoidance, the navigation mesh will also become visible (regardless of whether Visible Navigation is enabled). This was not the case in previous versions.

### Steps to reproduce

Check Debug > Visible Avoidance

### Minimal reproduction project (MRP)

[new-game.zip](https://github.com/user-attachments/files/19086046/new-game.zip)


Discussion / hints:
This is likely because the "Visible Avoidance" option enables the general debug on the NavigationServer in addition to just the visible avoidance debug (which it needs to do to have any debug render).

The avoidance debug was added far later so most older navigation related Node types likely still have debug code that just looks at the general debug enabled and needs to be updated to also check for the more specific debug enabled.

There are 3 debug related functions on the NavigationServer.
`get_debug_enabled()` for the general debug for both navmesh and avoidance.
`get_debug_navigation_enabled()` which is just the debug for anything navmesh or path related.
`get_debug_avoidance_enabled()` which is the debug for anything avoidance related.

For this issue it is likely enough to just add an additional check for the get_debug_navigation_enabled() in the draw function for the NavigationRegion2D but I expect other node types might also need an update.

EDIT:
Not a regression, the code on the NavigationRegion2D or debug for this is all older. It is more likely that the fixes to visibility now just show the bug more clearly, or user is on an older version without the debug enabled patch that was rolled out for 4.3 as well.

Fix patch:
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 365d5ba4f68e..ef83027fa0c4 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -181,7 +181,7 @@ void NavigationRegion2D::_notification(int p_what) {
 
 		case NOTIFICATION_DRAW: {
 #ifdef DEBUG_ENABLED
-			if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) {
+			if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || (NavigationServer2D::get_singleton()->get_debug_enabled() && NavigationServer2D::get_singleton()->get_debug_navigation_enabled())) && navigation_polygon.is_valid()) {
 				_update_debug_mesh();
 				_update_debug_edge_connections_mesh();
 				_update_debug_baking_rect();


Test patch: