Add NavigationServer API to enable regions and links

Adds NavigationServer API to enable regions and links.
This commit is contained in:
smix8 2023-07-06 23:01:19 +02:00
parent 202e4b2c1e
commit 69fad39cf5
18 changed files with 159 additions and 36 deletions

View File

@ -207,6 +207,13 @@
Create a new link between two positions on a map. Create a new link between two positions on a map.
</description> </description>
</method> </method>
<method name="link_get_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="link" type="RID" />
<description>
Returns [code]true[/code] if the specified [param link] is enabled.
</description>
</method>
<method name="link_get_end_position" qualifiers="const"> <method name="link_get_end_position" qualifiers="const">
<return type="Vector2" /> <return type="Vector2" />
<param index="0" name="link" type="RID" /> <param index="0" name="link" type="RID" />
@ -271,6 +278,14 @@
Sets whether this [param link] can be travelled in both directions. Sets whether this [param link] can be travelled in both directions.
</description> </description>
</method> </method>
<method name="link_set_enabled">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="enabled" type="bool" />
<description>
If [param enabled] is [code]true[/code] the specified [param link] will contribute to its current navigation map.
</description>
</method>
<method name="link_set_end_position"> <method name="link_set_end_position">
<return type="void" /> <return type="void" />
<param index="0" name="link" type="RID" /> <param index="0" name="link" type="RID" />
@ -601,6 +616,13 @@
Returns how many connections this [param region] has with other regions in the map. Returns how many connections this [param region] has with other regions in the map.
</description> </description>
</method> </method>
<method name="region_get_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="region" type="RID" />
<description>
Returns [code]true[/code] if the specified [param region] is enabled.
</description>
</method>
<method name="region_get_enter_cost" qualifiers="const"> <method name="region_get_enter_cost" qualifiers="const">
<return type="float" /> <return type="float" />
<param index="0" name="region" type="RID" /> <param index="0" name="region" type="RID" />
@ -653,6 +675,14 @@
[b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected. [b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
</description> </description>
</method> </method>
<method name="region_set_enabled">
<return type="void" />
<param index="0" name="region" type="RID" />
<param index="1" name="enabled" type="bool" />
<description>
If [param enabled] is [code]true[/code] the specified [param region] will contribute to its current navigation map.
</description>
</method>
<method name="region_set_enter_cost"> <method name="region_set_enter_cost">
<return type="void" /> <return type="void" />
<param index="0" name="region" type="RID" /> <param index="0" name="region" type="RID" />

View File

@ -248,6 +248,13 @@
Create a new link between two positions on a map. Create a new link between two positions on a map.
</description> </description>
</method> </method>
<method name="link_get_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="link" type="RID" />
<description>
Returns [code]true[/code] if the specified [param link] is enabled.
</description>
</method>
<method name="link_get_end_position" qualifiers="const"> <method name="link_get_end_position" qualifiers="const">
<return type="Vector3" /> <return type="Vector3" />
<param index="0" name="link" type="RID" /> <param index="0" name="link" type="RID" />
@ -312,6 +319,14 @@
Sets whether this [param link] can be travelled in both directions. Sets whether this [param link] can be travelled in both directions.
</description> </description>
</method> </method>
<method name="link_set_enabled">
<return type="void" />
<param index="0" name="link" type="RID" />
<param index="1" name="enabled" type="bool" />
<description>
If [param enabled] is [code]true[/code] the specified [param link] will contribute to its current navigation map.
</description>
</method>
<method name="link_set_end_position"> <method name="link_set_end_position">
<return type="void" /> <return type="void" />
<param index="0" name="link" type="RID" /> <param index="0" name="link" type="RID" />
@ -734,6 +749,13 @@
Returns how many connections this [param region] has with other regions in the map. Returns how many connections this [param region] has with other regions in the map.
</description> </description>
</method> </method>
<method name="region_get_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="region" type="RID" />
<description>
Returns [code]true[/code] if the specified [param region] is enabled.
</description>
</method>
<method name="region_get_enter_cost" qualifiers="const"> <method name="region_get_enter_cost" qualifiers="const">
<return type="float" /> <return type="float" />
<param index="0" name="region" type="RID" /> <param index="0" name="region" type="RID" />
@ -786,6 +808,14 @@
[b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected. [b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
</description> </description>
</method> </method>
<method name="region_set_enabled">
<return type="void" />
<param index="0" name="region" type="RID" />
<param index="1" name="enabled" type="bool" />
<description>
If [param enabled] is [code]true[/code] the specified [param region] will contribute to its current navigation map.
</description>
</method>
<method name="region_set_enter_cost"> <method name="region_set_enter_cost">
<return type="void" /> <return type="void" />
<param index="0" name="region" type="RID" /> <param index="0" name="region" type="RID" />

View File

@ -340,6 +340,20 @@ RID GodotNavigationServer::region_create() {
return rid; return rid;
} }
COMMAND_2(region_set_enabled, RID, p_region, bool, p_enabled) {
NavRegion *region = region_owner.get_or_null(p_region);
ERR_FAIL_COND(region == nullptr);
region->set_enabled(p_enabled);
}
bool GodotNavigationServer::region_get_enabled(RID p_region) const {
const NavRegion *region = region_owner.get_or_null(p_region);
ERR_FAIL_COND_V(region == nullptr, false);
return region->get_enabled();
}
COMMAND_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled) { COMMAND_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled) {
NavRegion *region = region_owner.get_or_null(p_region); NavRegion *region = region_owner.get_or_null(p_region);
ERR_FAIL_COND(region == nullptr); ERR_FAIL_COND(region == nullptr);
@ -512,6 +526,20 @@ RID GodotNavigationServer::link_get_map(const RID p_link) const {
return RID(); return RID();
} }
COMMAND_2(link_set_enabled, RID, p_link, bool, p_enabled) {
NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND(link == nullptr);
link->set_enabled(p_enabled);
}
bool GodotNavigationServer::link_get_enabled(RID p_link) const {
const NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND_V(link == nullptr, false);
return link->get_enabled();
}
COMMAND_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional) { COMMAND_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional) {
NavLink *link = link_owner.get_or_null(p_link); NavLink *link = link_owner.get_or_null(p_link);
ERR_FAIL_COND(link == nullptr); ERR_FAIL_COND(link == nullptr);

View File

@ -135,6 +135,9 @@ public:
virtual RID region_create() override; virtual RID region_create() override;
COMMAND_2(region_set_enabled, RID, p_region, bool, p_enabled);
virtual bool region_get_enabled(RID p_region) const override;
COMMAND_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled); COMMAND_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled);
virtual bool region_get_use_edge_connections(RID p_region) const override; virtual bool region_get_use_edge_connections(RID p_region) const override;
@ -164,6 +167,8 @@ public:
virtual RID link_create() override; virtual RID link_create() override;
COMMAND_2(link_set_map, RID, p_link, RID, p_map); COMMAND_2(link_set_map, RID, p_link, RID, p_map);
virtual RID link_get_map(RID p_link) const override; virtual RID link_get_map(RID p_link) const override;
COMMAND_2(link_set_enabled, RID, p_link, bool, p_enabled);
virtual bool link_get_enabled(RID p_link) const override;
COMMAND_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional); COMMAND_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional);
virtual bool link_is_bidirectional(RID p_link) const override; virtual bool link_is_bidirectional(RID p_link) const override;
COMMAND_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers); COMMAND_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers);

View File

@ -49,6 +49,16 @@ void NavLink::set_map(NavMap *p_map) {
} }
} }
void NavLink::set_enabled(bool p_enabled) {
if (enabled == p_enabled) {
return;
}
enabled = p_enabled;
// TODO: This should not require a full rebuild as the link has not really changed.
link_dirty = true;
};
void NavLink::set_bidirectional(bool p_bidirectional) { void NavLink::set_bidirectional(bool p_bidirectional) {
if (bidirectional == p_bidirectional) { if (bidirectional == p_bidirectional) {
return; return;

View File

@ -39,6 +39,7 @@ class NavLink : public NavBase {
bool bidirectional = true; bool bidirectional = true;
Vector3 start_position; Vector3 start_position;
Vector3 end_position; Vector3 end_position;
bool enabled = true;
bool link_dirty = true; bool link_dirty = true;
@ -52,6 +53,9 @@ public:
return map; return map;
} }
void set_enabled(bool p_enabled);
bool get_enabled() const { return enabled; }
void set_bidirectional(bool p_bidirectional); void set_bidirectional(bool p_bidirectional);
bool is_bidirectional() const { bool is_bidirectional() const {
return bidirectional; return bidirectional;

View File

@ -804,6 +804,9 @@ void NavMap::sync() {
// Resize the polygon count. // Resize the polygon count.
int count = 0; int count = 0;
for (const NavRegion *region : regions) { for (const NavRegion *region : regions) {
if (!region->get_enabled()) {
continue;
}
count += region->get_polygons().size(); count += region->get_polygons().size();
} }
polygons.resize(count); polygons.resize(count);
@ -811,6 +814,9 @@ void NavMap::sync() {
// Copy all region polygons in the map. // Copy all region polygons in the map.
count = 0; count = 0;
for (const NavRegion *region : regions) { for (const NavRegion *region : regions) {
if (!region->get_enabled()) {
continue;
}
const LocalVector<gd::Polygon> &polygons_source = region->get_polygons(); const LocalVector<gd::Polygon> &polygons_source = region->get_polygons();
for (uint32_t n = 0; n < polygons_source.size(); n++) { for (uint32_t n = 0; n < polygons_source.size(); n++) {
polygons[count + n] = polygons_source[n]; polygons[count + n] = polygons_source[n];

View File

@ -51,6 +51,16 @@ void NavRegion::set_map(NavMap *p_map) {
} }
} }
void NavRegion::set_enabled(bool p_enabled) {
if (enabled == p_enabled) {
return;
}
enabled = p_enabled;
// TODO: This should not require a full rebuild as the region has not really changed.
polygons_dirty = true;
};
void NavRegion::set_use_edge_connections(bool p_enabled) { void NavRegion::set_use_edge_connections(bool p_enabled) {
if (use_edge_connections != p_enabled) { if (use_edge_connections != p_enabled) {
use_edge_connections = p_enabled; use_edge_connections = p_enabled;

View File

@ -41,6 +41,7 @@ class NavRegion : public NavBase {
Transform3D transform; Transform3D transform;
Ref<NavigationMesh> mesh; Ref<NavigationMesh> mesh;
Vector<gd::Edge::Connection> connections; Vector<gd::Edge::Connection> connections;
bool enabled = true;
bool use_edge_connections = true; bool use_edge_connections = true;
@ -58,6 +59,9 @@ public:
polygons_dirty = true; polygons_dirty = true;
} }
void set_enabled(bool p_enabled);
bool get_enabled() const { return enabled; }
void set_map(NavMap *p_map); void set_map(NavMap *p_map);
NavMap *get_map() const { NavMap *get_map() const {
return map; return map;

View File

@ -182,15 +182,7 @@ void NavigationLink2D::set_enabled(bool p_enabled) {
enabled = p_enabled; enabled = p_enabled;
if (!is_inside_tree()) { NavigationServer3D::get_singleton()->link_set_enabled(link, enabled);
return;
}
if (!enabled) {
NavigationServer2D::get_singleton()->link_set_map(link, RID());
} else {
NavigationServer2D::get_singleton()->link_set_map(link, get_world_2d()->get_navigation_map());
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) { if (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) {

View File

@ -42,15 +42,7 @@ void NavigationRegion2D::set_enabled(bool p_enabled) {
enabled = p_enabled; enabled = p_enabled;
if (!is_inside_tree()) { NavigationServer2D::get_singleton()->region_set_enabled(region, enabled);
return;
}
if (!enabled) {
_region_enter_navigation_map();
} else {
_region_exit_navigation_map();
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_navigation_enabled()) { if (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_navigation_enabled()) {

View File

@ -291,15 +291,7 @@ void NavigationLink3D::set_enabled(bool p_enabled) {
enabled = p_enabled; enabled = p_enabled;
if (!is_inside_tree()) { NavigationServer3D::get_singleton()->link_set_enabled(link, enabled);
return;
}
if (enabled) {
NavigationServer3D::get_singleton()->link_set_map(link, get_world_3d()->get_navigation_map());
} else {
NavigationServer3D::get_singleton()->link_set_map(link, RID());
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (debug_instance.is_valid() && debug_mesh.is_valid()) { if (debug_instance.is_valid() && debug_mesh.is_valid()) {

View File

@ -40,15 +40,7 @@ void NavigationRegion3D::set_enabled(bool p_enabled) {
enabled = p_enabled; enabled = p_enabled;
if (!is_inside_tree()) { NavigationServer3D::get_singleton()->region_set_enabled(region, enabled);
return;
}
if (!enabled) {
_region_enter_navigation_map();
} else {
_region_exit_navigation_map();
}
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
if (debug_instance.is_valid()) { if (debug_instance.is_valid()) {

View File

@ -391,6 +391,8 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("query_path", "parameters", "result"), &NavigationServer2D::query_path); ClassDB::bind_method(D_METHOD("query_path", "parameters", "result"), &NavigationServer2D::query_path);
ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create); ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer2D::region_create);
ClassDB::bind_method(D_METHOD("region_set_enabled", "region", "enabled"), &NavigationServer2D::region_set_enabled);
ClassDB::bind_method(D_METHOD("region_get_enabled", "region"), &NavigationServer2D::region_get_enabled);
ClassDB::bind_method(D_METHOD("region_set_use_edge_connections", "region", "enabled"), &NavigationServer2D::region_set_use_edge_connections); ClassDB::bind_method(D_METHOD("region_set_use_edge_connections", "region", "enabled"), &NavigationServer2D::region_set_use_edge_connections);
ClassDB::bind_method(D_METHOD("region_get_use_edge_connections", "region"), &NavigationServer2D::region_get_use_edge_connections); ClassDB::bind_method(D_METHOD("region_get_use_edge_connections", "region"), &NavigationServer2D::region_get_use_edge_connections);
ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer2D::region_set_enter_cost); ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer2D::region_set_enter_cost);
@ -413,6 +415,8 @@ void NavigationServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_create"), &NavigationServer2D::link_create); ClassDB::bind_method(D_METHOD("link_create"), &NavigationServer2D::link_create);
ClassDB::bind_method(D_METHOD("link_set_map", "link", "map"), &NavigationServer2D::link_set_map); ClassDB::bind_method(D_METHOD("link_set_map", "link", "map"), &NavigationServer2D::link_set_map);
ClassDB::bind_method(D_METHOD("link_get_map", "link"), &NavigationServer2D::link_get_map); ClassDB::bind_method(D_METHOD("link_get_map", "link"), &NavigationServer2D::link_get_map);
ClassDB::bind_method(D_METHOD("link_set_enabled", "link", "enabled"), &NavigationServer2D::link_set_enabled);
ClassDB::bind_method(D_METHOD("link_get_enabled", "link"), &NavigationServer2D::link_get_enabled);
ClassDB::bind_method(D_METHOD("link_set_bidirectional", "link", "bidirectional"), &NavigationServer2D::link_set_bidirectional); ClassDB::bind_method(D_METHOD("link_set_bidirectional", "link", "bidirectional"), &NavigationServer2D::link_set_bidirectional);
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer2D::link_is_bidirectional); ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer2D::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer2D::link_set_navigation_layers); ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer2D::link_set_navigation_layers);
@ -536,6 +540,8 @@ RID FORWARD_2_C(map_get_closest_point_owner, RID, p_map, const Vector2 &, p_poin
RID FORWARD_0(region_create); RID FORWARD_0(region_create);
void FORWARD_2(region_set_enabled, RID, p_region, bool, p_enabled, rid_to_rid, bool_to_bool);
bool FORWARD_1_C(region_get_enabled, RID, p_region, rid_to_rid);
void FORWARD_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled, rid_to_rid, bool_to_bool); void FORWARD_2(region_set_use_edge_connections, RID, p_region, bool, p_enabled, rid_to_rid, bool_to_bool);
bool FORWARD_1_C(region_get_use_edge_connections, RID, p_region, rid_to_rid); bool FORWARD_1_C(region_get_use_edge_connections, RID, p_region, rid_to_rid);
@ -564,6 +570,8 @@ RID FORWARD_0(link_create);
void FORWARD_2(link_set_map, RID, p_link, RID, p_map, rid_to_rid, rid_to_rid); void FORWARD_2(link_set_map, RID, p_link, RID, p_map, rid_to_rid, rid_to_rid);
RID FORWARD_1_C(link_get_map, RID, p_link, rid_to_rid); RID FORWARD_1_C(link_get_map, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_enabled, RID, p_link, bool, p_enabled, rid_to_rid, bool_to_bool);
bool FORWARD_1_C(link_get_enabled, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional, rid_to_rid, bool_to_bool); void FORWARD_2(link_set_bidirectional, RID, p_link, bool, p_bidirectional, rid_to_rid, bool_to_bool);
bool FORWARD_1_C(link_is_bidirectional, RID, p_link, rid_to_rid); bool FORWARD_1_C(link_is_bidirectional, RID, p_link, rid_to_rid);
void FORWARD_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers, rid_to_rid, uint32_to_uint32); void FORWARD_2(link_set_navigation_layers, RID, p_link, uint32_t, p_navigation_layers, rid_to_rid, uint32_to_uint32);

View File

@ -101,6 +101,9 @@ public:
/// Creates a new region. /// Creates a new region.
virtual RID region_create(); virtual RID region_create();
virtual void region_set_enabled(RID p_region, bool p_enabled);
virtual bool region_get_enabled(RID p_region) const;
virtual void region_set_use_edge_connections(RID p_region, bool p_enabled); virtual void region_set_use_edge_connections(RID p_region, bool p_enabled);
virtual bool region_get_use_edge_connections(RID p_region) const; virtual bool region_get_use_edge_connections(RID p_region) const;
@ -144,6 +147,9 @@ public:
virtual void link_set_map(RID p_link, RID p_map); virtual void link_set_map(RID p_link, RID p_map);
virtual RID link_get_map(RID p_link) const; virtual RID link_get_map(RID p_link) const;
virtual void link_set_enabled(RID p_link, bool p_enabled);
virtual bool link_get_enabled(RID p_link) const;
/// Set whether this link travels in both directions. /// Set whether this link travels in both directions.
virtual void link_set_bidirectional(RID p_link, bool p_bidirectional); virtual void link_set_bidirectional(RID p_link, bool p_bidirectional);
virtual bool link_is_bidirectional(RID p_link) const; virtual bool link_is_bidirectional(RID p_link) const;

View File

@ -67,6 +67,8 @@ void NavigationServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("query_path", "parameters", "result"), &NavigationServer3D::query_path); ClassDB::bind_method(D_METHOD("query_path", "parameters", "result"), &NavigationServer3D::query_path);
ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer3D::region_create); ClassDB::bind_method(D_METHOD("region_create"), &NavigationServer3D::region_create);
ClassDB::bind_method(D_METHOD("region_set_enabled", "region", "enabled"), &NavigationServer3D::region_set_enabled);
ClassDB::bind_method(D_METHOD("region_get_enabled", "region"), &NavigationServer3D::region_get_enabled);
ClassDB::bind_method(D_METHOD("region_set_use_edge_connections", "region", "enabled"), &NavigationServer3D::region_set_use_edge_connections); ClassDB::bind_method(D_METHOD("region_set_use_edge_connections", "region", "enabled"), &NavigationServer3D::region_set_use_edge_connections);
ClassDB::bind_method(D_METHOD("region_get_use_edge_connections", "region"), &NavigationServer3D::region_get_use_edge_connections); ClassDB::bind_method(D_METHOD("region_get_use_edge_connections", "region"), &NavigationServer3D::region_get_use_edge_connections);
ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer3D::region_set_enter_cost); ClassDB::bind_method(D_METHOD("region_set_enter_cost", "region", "enter_cost"), &NavigationServer3D::region_set_enter_cost);
@ -92,6 +94,8 @@ void NavigationServer3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("link_create"), &NavigationServer3D::link_create); ClassDB::bind_method(D_METHOD("link_create"), &NavigationServer3D::link_create);
ClassDB::bind_method(D_METHOD("link_set_map", "link", "map"), &NavigationServer3D::link_set_map); ClassDB::bind_method(D_METHOD("link_set_map", "link", "map"), &NavigationServer3D::link_set_map);
ClassDB::bind_method(D_METHOD("link_get_map", "link"), &NavigationServer3D::link_get_map); ClassDB::bind_method(D_METHOD("link_get_map", "link"), &NavigationServer3D::link_get_map);
ClassDB::bind_method(D_METHOD("link_set_enabled", "link", "enabled"), &NavigationServer3D::link_set_enabled);
ClassDB::bind_method(D_METHOD("link_get_enabled", "link"), &NavigationServer3D::link_get_enabled);
ClassDB::bind_method(D_METHOD("link_set_bidirectional", "link", "bidirectional"), &NavigationServer3D::link_set_bidirectional); ClassDB::bind_method(D_METHOD("link_set_bidirectional", "link", "bidirectional"), &NavigationServer3D::link_set_bidirectional);
ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer3D::link_is_bidirectional); ClassDB::bind_method(D_METHOD("link_is_bidirectional", "link"), &NavigationServer3D::link_is_bidirectional);
ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer3D::link_set_navigation_layers); ClassDB::bind_method(D_METHOD("link_set_navigation_layers", "link", "navigation_layers"), &NavigationServer3D::link_set_navigation_layers);

View File

@ -117,6 +117,9 @@ public:
/// Creates a new region. /// Creates a new region.
virtual RID region_create() = 0; virtual RID region_create() = 0;
virtual void region_set_enabled(RID p_region, bool p_enabled) = 0;
virtual bool region_get_enabled(RID p_region) const = 0;
virtual void region_set_use_edge_connections(RID p_region, bool p_enabled) = 0; virtual void region_set_use_edge_connections(RID p_region, bool p_enabled) = 0;
virtual bool region_get_use_edge_connections(RID p_region) const = 0; virtual bool region_get_use_edge_connections(RID p_region) const = 0;
@ -165,6 +168,9 @@ public:
virtual void link_set_map(RID p_link, RID p_map) = 0; virtual void link_set_map(RID p_link, RID p_map) = 0;
virtual RID link_get_map(RID p_link) const = 0; virtual RID link_get_map(RID p_link) const = 0;
virtual void link_set_enabled(RID p_link, bool p_enabled) = 0;
virtual bool link_get_enabled(RID p_link) const = 0;
/// Set whether this link travels in both directions. /// Set whether this link travels in both directions.
virtual void link_set_bidirectional(RID p_link, bool p_bidirectional) = 0; virtual void link_set_bidirectional(RID p_link, bool p_bidirectional) = 0;
virtual bool link_is_bidirectional(RID p_link) const = 0; virtual bool link_is_bidirectional(RID p_link) const = 0;

View File

@ -64,6 +64,8 @@ public:
TypedArray<RID> map_get_obstacles(RID p_map) const override { return TypedArray<RID>(); } TypedArray<RID> map_get_obstacles(RID p_map) const override { return TypedArray<RID>(); }
void map_force_update(RID p_map) override {} void map_force_update(RID p_map) override {}
RID region_create() override { return RID(); } RID region_create() override { return RID(); }
void region_set_enabled(RID p_region, bool p_enabled) override {}
bool region_get_enabled(RID p_region) const override { return false; }
void region_set_use_edge_connections(RID p_region, bool p_enabled) override {} void region_set_use_edge_connections(RID p_region, bool p_enabled) override {}
bool region_get_use_edge_connections(RID p_region) const override { return false; } bool region_get_use_edge_connections(RID p_region) const override { return false; }
void region_set_enter_cost(RID p_region, real_t p_enter_cost) override {} void region_set_enter_cost(RID p_region, real_t p_enter_cost) override {}
@ -88,6 +90,8 @@ public:
RID link_create() override { return RID(); } RID link_create() override { return RID(); }
void link_set_map(RID p_link, RID p_map) override {} void link_set_map(RID p_link, RID p_map) override {}
RID link_get_map(RID p_link) const override { return RID(); } RID link_get_map(RID p_link) const override { return RID(); }
void link_set_enabled(RID p_link, bool p_enabled) override {}
bool link_get_enabled(RID p_link) const override { return false; }
void link_set_bidirectional(RID p_link, bool p_bidirectional) override {} void link_set_bidirectional(RID p_link, bool p_bidirectional) override {}
bool link_is_bidirectional(RID p_link) const override { return false; } bool link_is_bidirectional(RID p_link) const override { return false; }
void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) override {} void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) override {}