From c734f902824110fc79f5eb5c7dd3ae6492db0c21 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Sat, 18 Jan 2025 01:29:25 +0100 Subject: [PATCH] Fix NavigationObstacle3D debug clear regression Clears NavigationObstacle3D on tree exit. --- scene/3d/navigation_obstacle_3d.cpp | 13 ++++++++++++- scene/3d/navigation_obstacle_3d.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index 47e27c3977..f2b54b2b9f 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -111,7 +111,7 @@ void NavigationObstacle3D::_notification(int p_what) { set_physics_process_internal(false); _update_map(RID()); #ifdef DEBUG_ENABLED - _update_debug(); + _clear_debug(); #endif // DEBUG_ENABLED } break; @@ -633,3 +633,14 @@ void NavigationObstacle3D::_update_static_obstacle_debug() { } } #endif // DEBUG_ENABLED + +#ifdef DEBUG_ENABLED +void NavigationObstacle3D::_clear_debug() { + RenderingServer *rs = RenderingServer::get_singleton(); + ERR_FAIL_NULL(rs); + rs->mesh_clear(fake_agent_radius_debug_mesh_rid); + rs->mesh_clear(static_obstacle_debug_mesh_rid); + rs->instance_set_scenario(fake_agent_radius_debug_instance_rid, RID()); + rs->instance_set_scenario(static_obstacle_debug_instance_rid, RID()); +} +#endif // DEBUG_ENABLED diff --git a/scene/3d/navigation_obstacle_3d.h b/scene/3d/navigation_obstacle_3d.h index f18f935600..82b1a5ce26 100644 --- a/scene/3d/navigation_obstacle_3d.h +++ b/scene/3d/navigation_obstacle_3d.h @@ -71,6 +71,7 @@ private: void _update_debug(); void _update_fake_agent_radius_debug(); void _update_static_obstacle_debug(); + void _clear_debug(); #endif // DEBUG_ENABLED protected: