From 245da150e7a3eb17435f64afd25939ad669e0901 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Tue, 14 Jun 2022 23:34:43 +0200 Subject: Streamline Navigation layer function names. Streamline Navigation layer function names. --- modules/gridmap/grid_map.cpp | 8 ++++---- modules/gridmap/grid_map.h | 2 +- modules/navigation/godot_navigation_server.cpp | 12 ++++++------ modules/navigation/godot_navigation_server.h | 6 +++--- modules/navigation/nav_map.cpp | 6 +++--- modules/navigation/nav_map.h | 2 +- modules/navigation/nav_region.cpp | 8 ++++---- modules/navigation/nav_region.h | 6 +++--- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'modules') diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 6255e11405..0e34b5907e 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -226,8 +226,8 @@ bool GridMap::is_baking_navigation() { return bake_navigation; } -void GridMap::set_navigation_layers(uint32_t p_layers) { - navigation_layers = p_layers; +void GridMap::set_navigation_layers(uint32_t p_navigation_layers) { + navigation_layers = p_navigation_layers; _recreate_octant_data(); } @@ -548,7 +548,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (bake_navigation) { RID region = NavigationServer3D::get_singleton()->region_create(); - NavigationServer3D::get_singleton()->region_set_layers(region, navigation_layers); + NavigationServer3D::get_singleton()->region_set_navigation_layers(region, navigation_layers); NavigationServer3D::get_singleton()->region_set_navmesh(region, navmesh); NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform() * nm.xform); NavigationServer3D::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map()); @@ -659,7 +659,7 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { Ref nm = mesh_library->get_item_navmesh(cell_map[F.key].item); if (nm.is_valid()) { RID region = NavigationServer3D::get_singleton()->region_create(); - NavigationServer3D::get_singleton()->region_set_layers(region, navigation_layers); + NavigationServer3D::get_singleton()->region_set_navigation_layers(region, navigation_layers); NavigationServer3D::get_singleton()->region_set_navmesh(region, nm); NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform() * F.value.xform); NavigationServer3D::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map()); diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index c79557afea..08ed4d3d12 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -238,7 +238,7 @@ public: void set_bake_navigation(bool p_bake_navigation); bool is_baking_navigation(); - void set_navigation_layers(uint32_t p_layers); + void set_navigation_layers(uint32_t p_navigation_layers); uint32_t get_navigation_layers(); void set_mesh_library(const Ref &p_mesh_library); diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp index f4e719b0c1..2f8cb6c230 100644 --- a/modules/navigation/godot_navigation_server.cpp +++ b/modules/navigation/godot_navigation_server.cpp @@ -198,11 +198,11 @@ real_t GodotNavigationServer::map_get_edge_connection_margin(RID p_map) const { return map->get_edge_connection_margin(); } -Vector GodotNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers) const { +Vector GodotNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers) const { const NavMap *map = map_owner.get_or_null(p_map); ERR_FAIL_COND_V(map == nullptr, Vector()); - return map->get_path(p_origin, p_destination, p_optimize, p_layers); + return map->get_path(p_origin, p_destination, p_optimize, p_navigation_layers); } Vector3 GodotNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const { @@ -339,18 +339,18 @@ real_t GodotNavigationServer::region_get_travel_cost(RID p_region) const { return region->get_travel_cost(); } -COMMAND_2(region_set_layers, RID, p_region, uint32_t, p_layers) { +COMMAND_2(region_set_navigation_layers, RID, p_region, uint32_t, p_navigation_layers) { NavRegion *region = region_owner.get_or_null(p_region); ERR_FAIL_COND(region == nullptr); - region->set_layers(p_layers); + region->set_navigation_layers(p_navigation_layers); } -uint32_t GodotNavigationServer::region_get_layers(RID p_region) const { +uint32_t GodotNavigationServer::region_get_navigation_layers(RID p_region) const { NavRegion *region = region_owner.get_or_null(p_region); ERR_FAIL_COND_V(region == nullptr, 0); - return region->get_layers(); + return region->get_navigation_layers(); } COMMAND_2(region_set_navmesh, RID, p_region, Ref, p_nav_mesh) { diff --git a/modules/navigation/godot_navigation_server.h b/modules/navigation/godot_navigation_server.h index 1a7fddb7e6..d931dbaee0 100644 --- a/modules/navigation/godot_navigation_server.h +++ b/modules/navigation/godot_navigation_server.h @@ -98,7 +98,7 @@ public: COMMAND_2(map_set_edge_connection_margin, RID, p_map, real_t, p_connection_margin); virtual real_t map_get_edge_connection_margin(RID p_map) const override; - virtual Vector map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers = 1) const override; + virtual Vector map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers = 1) const override; virtual Vector3 map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision = false) const override; virtual Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const override; @@ -117,8 +117,8 @@ public: COMMAND_2(region_set_map, RID, p_region, RID, p_map); virtual RID region_get_map(RID p_region) const override; - COMMAND_2(region_set_layers, RID, p_region, uint32_t, p_layers); - virtual uint32_t region_get_layers(RID p_region) const override; + COMMAND_2(region_set_navigation_layers, RID, p_region, uint32_t, p_navigation_layers); + virtual uint32_t region_get_navigation_layers(RID p_region) const override; COMMAND_2(region_set_transform, RID, p_region, Transform3D, p_transform); COMMAND_2(region_set_navmesh, RID, p_region, Ref, p_nav_mesh); virtual void region_bake_navmesh(Ref r_mesh, Node *p_node) const override; diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp index 059dc989a8..49c12813b3 100644 --- a/modules/navigation/nav_map.cpp +++ b/modules/navigation/nav_map.cpp @@ -65,7 +65,7 @@ gd::PointKey NavMap::get_point_key(const Vector3 &p_pos) const { return p; } -Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers) const { +Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers) const { // Find the start poly and the end poly on this map. const gd::Polygon *begin_poly = nullptr; const gd::Polygon *end_poly = nullptr; @@ -78,7 +78,7 @@ Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p const gd::Polygon &p = polygons[i]; // Only consider the polygon if it in a region with compatible layers. - if ((p_layers & p.owner->get_layers()) == 0) { + if ((p_navigation_layers & p.owner->get_navigation_layers()) == 0) { continue; } @@ -154,7 +154,7 @@ Vector NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p const gd::Edge::Connection &connection = edge.connections[connection_index]; // Only consider the connection to another polygon if this polygon is in a region with compatible layers. - if ((p_layers & connection.polygon->owner->get_layers()) == 0) { + if ((p_navigation_layers & connection.polygon->owner->get_navigation_layers()) == 0) { continue; } diff --git a/modules/navigation/nav_map.h b/modules/navigation/nav_map.h index 20115dd1b4..2036dbecd7 100644 --- a/modules/navigation/nav_map.h +++ b/modules/navigation/nav_map.h @@ -105,7 +105,7 @@ public: gd::PointKey get_point_key(const Vector3 &p_pos) const; - Vector get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers = 1) const; + Vector get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers = 1) const; Vector3 get_closest_point_to_segment(const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const; Vector3 get_closest_point(const Vector3 &p_point) const; Vector3 get_closest_point_normal(const Vector3 &p_point) const; diff --git a/modules/navigation/nav_region.cpp b/modules/navigation/nav_region.cpp index fea0ad519a..88740807eb 100644 --- a/modules/navigation/nav_region.cpp +++ b/modules/navigation/nav_region.cpp @@ -40,12 +40,12 @@ void NavRegion::set_map(NavMap *p_map) { } } -void NavRegion::set_layers(uint32_t p_layers) { - layers = p_layers; +void NavRegion::set_navigation_layers(uint32_t p_navigation_layers) { + navigation_layers = p_navigation_layers; } -uint32_t NavRegion::get_layers() const { - return layers; +uint32_t NavRegion::get_navigation_layers() const { + return navigation_layers; } void NavRegion::set_transform(Transform3D p_transform) { diff --git a/modules/navigation/nav_region.h b/modules/navigation/nav_region.h index acde5de834..484856ae36 100644 --- a/modules/navigation/nav_region.h +++ b/modules/navigation/nav_region.h @@ -45,7 +45,7 @@ class NavRegion : public NavRid { NavMap *map = nullptr; Transform3D transform; Ref mesh; - uint32_t layers = 1; + uint32_t navigation_layers = 1; float enter_cost = 0.0; float travel_cost = 1.0; Vector connections; @@ -73,8 +73,8 @@ public: void set_travel_cost(float p_travel_cost) { travel_cost = MAX(p_travel_cost, 0.0); } float get_travel_cost() const { return travel_cost; } - void set_layers(uint32_t p_layers); - uint32_t get_layers() const; + void set_navigation_layers(uint32_t p_navigation_layers); + uint32_t get_navigation_layers() const; void set_transform(Transform3D transform); const Transform3D &get_transform() const { -- cgit v1.2.3