From fdea2698053b616d0805ef3c4501a76945ce82ef Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:16:38 +0200 Subject: Add NavigationServer map_force_update() function Adds map_force_update() function to NavigationServer. This function immediately flushes the Navigationserver command queue and recalculates all navigationmeshes and region connections for a specific map. --- servers/navigation_server_2d.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'servers/navigation_server_2d.cpp') diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 0442089503..8540fdbd53 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -173,6 +173,8 @@ void NavigationServer2D::_bind_methods() { ClassDB::bind_method(D_METHOD("map_get_regions", "map"), &NavigationServer2D::map_get_regions); ClassDB::bind_method(D_METHOD("map_get_agents", "map"), &NavigationServer2D::map_get_agents); + ClassDB::bind_method(D_METHOD("map_force_update", "map"), &NavigationServer2D::map_force_update); + ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create); ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer2D::region_set_enter_cost); ClassDB::bind_method(D_METHOD("region_get_enter_cost", "region"), &NavigationServer2D::region_get_enter_cost); @@ -231,6 +233,10 @@ void FORWARD_2_C(map_set_active, RID, p_map, bool, p_active, rid_to_rid, bool_to bool FORWARD_1_C(map_is_active, RID, p_map, rid_to_rid); +void NavigationServer2D::map_force_update(RID p_map) { + NavigationServer3D::get_singleton_mut()->map_force_update(p_map); +} + void FORWARD_2_C(map_set_cell_size, RID, p_map, real_t, p_cell_size, rid_to_rid, real_to_real); real_t FORWARD_1_C(map_get_cell_size, RID, p_map, rid_to_rid); -- cgit v1.2.3