diff options
author | smix8 <52464204+smix8@users.noreply.github.com> | 2022-06-22 15:33:40 +0200 |
---|---|---|
committer | smix8 <52464204+smix8@users.noreply.github.com> | 2022-06-22 15:33:40 +0200 |
commit | c0fed1d4e886539a533fc77e58bd4c2e1ae17597 (patch) | |
tree | 53367916e14b06f06ab1862986ce65c33af3f030 /servers | |
parent | 5fc2864b052fd2ea0adf88701d5c6f7bb0c0bc0c (diff) |
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.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/navigation_server_2d.cpp | 4 | ||||
-rw-r--r-- | servers/navigation_server_2d.h | 2 | ||||
-rw-r--r-- | servers/navigation_server_3d.cpp | 2 | ||||
-rw-r--r-- | servers/navigation_server_3d.h | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 0442089503..ba64dc607e 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -159,6 +159,8 @@ void NavigationServer2D::_emit_map_changed(RID p_map) { } void NavigationServer2D::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer2D::get_maps); + ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer2D::map_create); ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer2D::map_set_active); ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer2D::map_is_active); @@ -217,6 +219,8 @@ NavigationServer2D::~NavigationServer2D() { 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_server_2d.h b/servers/navigation_server_2d.h index 30f553d10b..23d833ddcb 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -53,6 +53,8 @@ public: /// MUST be used in single thread! static NavigationServer2D *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_3d.cpp b/servers/navigation_server_3d.cpp index 60bbcec8d4..da675133c9 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -33,6 +33,8 @@ NavigationServer3D *NavigationServer3D::singleton = nullptr; void NavigationServer3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer3D::get_maps); + ClassDB::bind_method(D_METHOD("map_create"), &NavigationServer3D::map_create); ClassDB::bind_method(D_METHOD("map_set_active", "map", "active"), &NavigationServer3D::map_set_active); ClassDB::bind_method(D_METHOD("map_is_active", "nap"), &NavigationServer3D::map_is_active); diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index 9c04d68622..5bf5d8ecdb 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -56,6 +56,8 @@ public: /// MUST be used in single thread! static NavigationServer3D *get_singleton_mut(); + virtual Array get_maps() const = 0; + /// Create a new map. virtual RID map_create() const = 0; |