1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add Navigation function to get all navigation maps

Added new function that returns all created navigation map RIDs from the NavigationServer. The function returns both 2D and 3D created navigation maps as technically there is no distinction between them.

(cherry picked from commit c0fed1d4e8)
This commit is contained in:
smix8
2022-06-22 15:33:40 +02:00
committed by Rémi Verschelde
parent 7bcb9fddc9
commit 38ee593b76
8 changed files with 36 additions and 0 deletions

View File

@@ -123,6 +123,18 @@ void GodotNavigationServer::add_command(SetCommand *command) const {
}
}
Array GodotNavigationServer::get_maps() const {
Array all_map_rids;
List<RID> maps_owned;
map_owner.get_owned_list(&maps_owned);
if (maps_owned.size()) {
for (List<RID>::Element *E = maps_owned.front(); E; E = E->next()) {
all_map_rids.push_back(E->get());
}
}
return all_map_rids;
}
RID GodotNavigationServer::map_create() const {
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
MutexLock lock(mut_this->operations_mutex);