diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/Navigation2DServer.xml
index 0bef2edac..4621b202d 100644
--- a/doc/classes/Navigation2DServer.xml
+++ b/doc/classes/Navigation2DServer.xml
@@ -127,6 +127,12 @@
Destroys the given RID.
+
+
+
+ Returns all created navigation map [RID]s on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them.
+
+
diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer.xml
index 683417398..59e73fbbc 100644
--- a/doc/classes/NavigationServer.xml
+++ b/doc/classes/NavigationServer.xml
@@ -126,6 +126,12 @@
Destroys the given RID.
+
+
+
+ Returns all created navigation map [RID]s on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them.
+
+
diff --git a/modules/navigation/pandemonium_navigation_server.cpp b/modules/navigation/pandemonium_navigation_server.cpp
index e26fe5424..fda62f9c3 100644
--- a/modules/navigation/pandemonium_navigation_server.cpp
+++ b/modules/navigation/pandemonium_navigation_server.cpp
@@ -127,6 +127,18 @@ void PandemoniumNavigationServer::add_command(SetCommand *command) const {
}
}
+Array PandemoniumNavigationServer::get_maps() const {
+ Array all_map_rids;
+ List maps_owned;
+ map_owner.get_owned_list(&maps_owned);
+ if (maps_owned.size()) {
+ for (List::Element *E = maps_owned.front(); E; E = E->next()) {
+ all_map_rids.push_back(E->get());
+ }
+ }
+ return all_map_rids;
+}
+
RID PandemoniumNavigationServer::map_create() const {
PandemoniumNavigationServer *mut_this = const_cast(this);
MutexLock lock(mut_this->operations_mutex);
diff --git a/modules/navigation/pandemonium_navigation_server.h b/modules/navigation/pandemonium_navigation_server.h
index eb9c00d90..d4500a114 100644
--- a/modules/navigation/pandemonium_navigation_server.h
+++ b/modules/navigation/pandemonium_navigation_server.h
@@ -82,6 +82,8 @@ public:
void add_command(SetCommand *command) const;
+ virtual Array get_maps() const;
+
virtual RID map_create() const;
COMMAND_2(map_set_active, RID, p_map, bool, p_active);
virtual bool map_is_active(RID p_map) const;
diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp
index ecfd18335..5cf4a9d90 100644
--- a/servers/navigation_2d_server.cpp
+++ b/servers/navigation_2d_server.cpp
@@ -172,6 +172,8 @@ void Navigation2DServer::_emit_map_changed(RID p_map) {
}
void Navigation2DServer::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_maps"), &Navigation2DServer::get_maps);
+
ClassDB::bind_method(D_METHOD("map_create"), &Navigation2DServer::map_create);
ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &Navigation2DServer::map_set_active);
ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &Navigation2DServer::map_is_active);
@@ -233,6 +235,8 @@ Navigation2DServer::~Navigation2DServer() {
singleton = nullptr;
}
+Array FORWARD_0_C(get_maps);
+
Array FORWARD_1_C(map_get_regions, RID, p_map, rid_to_rid);
Array FORWARD_1_C(map_get_agents, RID, p_map, rid_to_rid);
diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h
index e91c61270..9bffaf07f 100644
--- a/servers/navigation_2d_server.h
+++ b/servers/navigation_2d_server.h
@@ -52,6 +52,8 @@ public:
/// MUST be used in single thread!
static Navigation2DServer *get_singleton_mut() { return singleton; }
+ virtual Array get_maps() const;
+
/// Create a new map.
virtual RID map_create() const;
diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp
index b6a095f94..d715ed5b6 100644
--- a/servers/navigation_server.cpp
+++ b/servers/navigation_server.cpp
@@ -36,6 +36,8 @@
NavigationServer *NavigationServer::singleton = nullptr;
void NavigationServer::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer::get_maps);
+
ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer::map_create);
ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer::map_set_active);
ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer::map_is_active);
diff --git a/servers/navigation_server.h b/servers/navigation_server.h
index e2a306e28..625868360 100644
--- a/servers/navigation_server.h
+++ b/servers/navigation_server.h
@@ -58,6 +58,8 @@ public:
/// MUST be used in single thread!
static NavigationServer *get_singleton_mut();
+ virtual Array get_maps() const = 0;
+
/// Create a new map.
virtual RID map_create() const = 0;