diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/navigation_agent_2d.cpp | 24 | ||||
-rw-r--r-- | scene/2d/navigation_agent_2d.h | 8 | ||||
-rw-r--r-- | scene/2d/navigation_region_2d.cpp | 46 | ||||
-rw-r--r-- | scene/2d/navigation_region_2d.h | 6 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 8 | ||||
-rw-r--r-- | scene/3d/navigation_agent_3d.cpp | 24 | ||||
-rw-r--r-- | scene/3d/navigation_agent_3d.h | 8 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.cpp | 44 | ||||
-rw-r--r-- | scene/3d/navigation_region_3d.h | 6 | ||||
-rw-r--r-- | scene/resources/mesh_library.cpp | 44 | ||||
-rw-r--r-- | scene/resources/mesh_library.h | 14 | ||||
-rw-r--r-- | scene/resources/navigation_mesh.cpp | 22 | ||||
-rw-r--r-- | scene/resources/navigation_mesh.h | 12 | ||||
-rw-r--r-- | scene/resources/navigation_polygon.cpp | 36 | ||||
-rw-r--r-- | scene/resources/navigation_polygon.h | 6 |
15 files changed, 154 insertions, 154 deletions
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index 904b6564bd..67c32dffb4 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -79,8 +79,8 @@ void NavigationAgent2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent2D::get_next_location); ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent2D::distance_to_target); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent2D::set_velocity); - ClassDB::bind_method(D_METHOD("get_nav_path"), &NavigationAgent2D::get_nav_path); - ClassDB::bind_method(D_METHOD("get_nav_path_index"), &NavigationAgent2D::get_nav_path_index); + ClassDB::bind_method(D_METHOD("get_current_navigation_path"), &NavigationAgent2D::get_current_navigation_path); + ClassDB::bind_method(D_METHOD("get_current_navigation_path_index"), &NavigationAgent2D::get_current_navigation_path_index); ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent2D::is_target_reached); ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent2D::is_target_reachable); ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent2D::is_navigation_finished); @@ -329,11 +329,11 @@ Vector2 NavigationAgent2D::get_next_location() { ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector2(), "The agent has no parent."); return agent_parent->get_global_position(); } else { - return navigation_path[nav_path_index]; + return navigation_path[navigation_path_index]; } } -const Vector<Vector2> &NavigationAgent2D::get_nav_path() const { +const Vector<Vector2> &NavigationAgent2D::get_current_navigation_path() const { return navigation_result->get_path(); } @@ -418,12 +418,12 @@ void NavigationAgent2D::update_navigation() { reload_path = true; } else { // Check if too far from the navigation path - if (nav_path_index > 0) { + if (navigation_path_index > 0) { const Vector<Vector2> &navigation_path = navigation_result->get_path(); Vector2 segment[2]; - segment[0] = navigation_path[nav_path_index - 1]; - segment[1] = navigation_path[nav_path_index]; + segment[0] = navigation_path[navigation_path_index - 1]; + segment[1] = navigation_path[navigation_path_index]; Vector2 p = Geometry2D::get_closest_point_to_segment(origin, segment); if (origin.distance_to(p) >= path_max_distance) { // To faraway, reload path @@ -445,7 +445,7 @@ void NavigationAgent2D::update_navigation() { NavigationServer2D::get_singleton()->query_path(navigation_query, navigation_result); navigation_finished = false; - nav_path_index = 0; + navigation_path_index = 0; emit_signal(SNAME("path_changed")); } @@ -457,11 +457,11 @@ void NavigationAgent2D::update_navigation() { if (navigation_finished == false) { // Advances to the next far away location. const Vector<Vector2> &navigation_path = navigation_result->get_path(); - while (origin.distance_to(navigation_path[nav_path_index]) < path_desired_distance) { - nav_path_index += 1; - if (nav_path_index == navigation_path.size()) { + while (origin.distance_to(navigation_path[navigation_path_index]) < path_desired_distance) { + navigation_path_index += 1; + if (navigation_path_index == navigation_path.size()) { _check_distance_to_target(); - nav_path_index -= 1; + navigation_path_index -= 1; navigation_finished = true; emit_signal(SNAME("navigation_finished")); break; diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h index 5abd3c0317..2c77bdc8db 100644 --- a/scene/2d/navigation_agent_2d.h +++ b/scene/2d/navigation_agent_2d.h @@ -62,7 +62,7 @@ class NavigationAgent2D : public Node { Vector2 target_location; Ref<NavigationPathQueryParameters2D> navigation_query; Ref<NavigationPathQueryResult2D> navigation_result; - int nav_path_index = 0; + int navigation_path_index = 0; bool velocity_submitted = false; Vector2 prev_safe_velocity; /// The submitted target velocity @@ -141,10 +141,10 @@ public: Vector2 get_next_location(); - const Vector<Vector2> &get_nav_path() const; + const Vector<Vector2> &get_current_navigation_path() const; - int get_nav_path_index() const { - return nav_path_index; + int get_current_navigation_path_index() const { + return navigation_path_index; } real_t distance_to_target() const; diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index 32a6f266b9..e030628110 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -137,11 +137,11 @@ RID NavigationRegion2D::get_region_rid() const { #ifdef TOOLS_ENABLED Rect2 NavigationRegion2D::_edit_get_rect() const { - return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2(); + return navigation_polygon.is_valid() ? navigation_polygon->_edit_get_rect() : Rect2(); } bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { - return navpoly.is_valid() ? navpoly->_edit_is_selected_on_click(p_point, p_tolerance) : false; + return navigation_polygon.is_valid() ? navigation_polygon->_edit_is_selected_on_click(p_point, p_tolerance) : false; } #endif @@ -167,8 +167,8 @@ void NavigationRegion2D::_notification(int p_what) { case NOTIFICATION_DRAW: { #ifdef DEBUG_ENABLED - if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer3D::get_singleton()->get_debug_enabled()) && navpoly.is_valid()) { - Vector<Vector2> verts = navpoly->get_vertices(); + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer3D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) { + Vector<Vector2> verts = navigation_polygon->get_vertices(); if (verts.size() < 3) { return; } @@ -183,9 +183,9 @@ void NavigationRegion2D::_notification(int p_what) { RandomPCG rand; - for (int i = 0; i < navpoly->get_polygon_count(); i++) { + for (int i = 0; i < navigation_polygon->get_polygon_count(); i++) { // An array of vertices for this polygon. - Vector<int> polygon = navpoly->get_polygon(i); + Vector<int> polygon = navigation_polygon->get_polygon(i); Vector<Vector2> vertices; vertices.resize(polygon.size()); for (int j = 0; j < polygon.size(); j++) { @@ -226,36 +226,36 @@ void NavigationRegion2D::_notification(int p_what) { } } -void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) { - if (p_navpoly == navpoly) { +void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_navigation_polygon) { + if (p_navigation_polygon == navigation_polygon) { return; } - if (navpoly.is_valid()) { - navpoly->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navpoly_changed)); + if (navigation_polygon.is_valid()) { + navigation_polygon->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); } - navpoly = p_navpoly; - NavigationServer2D::get_singleton()->region_set_navpoly(region, p_navpoly); + navigation_polygon = p_navigation_polygon; + NavigationServer2D::get_singleton()->region_set_navigation_polygon(region, p_navigation_polygon); - if (navpoly.is_valid()) { - navpoly->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navpoly_changed)); + if (navigation_polygon.is_valid()) { + navigation_polygon->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NavigationRegion2D::_navigation_polygon_changed)); } - _navpoly_changed(); + _navigation_polygon_changed(); update_configuration_warnings(); } Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const { - return navpoly; + return navigation_polygon; } -void NavigationRegion2D::_navpoly_changed() { +void NavigationRegion2D::_navigation_polygon_changed() { if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) { queue_redraw(); } - if (navpoly.is_valid()) { - NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly); + if (navigation_polygon.is_valid()) { + NavigationServer2D::get_singleton()->region_set_navigation_polygon(region, navigation_polygon); } } @@ -271,7 +271,7 @@ PackedStringArray NavigationRegion2D::get_configuration_warnings() const { PackedStringArray warnings = Node2D::get_configuration_warnings(); if (is_visible_in_tree() && is_inside_tree()) { - if (!navpoly.is_valid()) { + if (!navigation_polygon.is_valid()) { warnings.push_back(RTR("A NavigationMesh resource must be set or created for this node to work. Please set a property or draw a polygon.")); } } @@ -280,7 +280,7 @@ PackedStringArray NavigationRegion2D::get_configuration_warnings() const { } void NavigationRegion2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationRegion2D::set_navigation_polygon); + ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navigation_polygon"), &NavigationRegion2D::set_navigation_polygon); ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationRegion2D::get_navigation_polygon); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion2D::set_enabled); @@ -300,9 +300,9 @@ void NavigationRegion2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_travel_cost", "travel_cost"), &NavigationRegion2D::set_travel_cost); ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationRegion2D::get_travel_cost); - ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed); + ClassDB::bind_method(D_METHOD("_navigation_polygon_changed"), &NavigationRegion2D::_navigation_polygon_changed); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navigation_polygon", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_2D_NAVIGATION), "set_navigation_layers", "get_navigation_layers"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "enter_cost"), "set_enter_cost", "get_enter_cost"); diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index fa012c2659..216e6088bc 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -41,9 +41,9 @@ class NavigationRegion2D : public Node2D { uint32_t navigation_layers = 1; real_t enter_cost = 0.0; real_t travel_cost = 1.0; - Ref<NavigationPolygon> navpoly; + Ref<NavigationPolygon> navigation_polygon; - void _navpoly_changed(); + void _navigation_polygon_changed(); void _map_changed(RID p_RID); protected: @@ -73,7 +73,7 @@ public: void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const; - void set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly); + void set_navigation_polygon(const Ref<NavigationPolygon> &p_navigation_polygon); Ref<NavigationPolygon> get_navigation_polygon() const; PackedStringArray get_configuration_warnings() const override; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index ad70559986..00ac4e87b5 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1728,10 +1728,10 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List q.navigation_regions[E_cell].resize(tile_set->get_navigation_layers_count()); for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) { - Ref<NavigationPolygon> navpoly; - navpoly = tile_data->get_navigation_polygon(layer_index); + Ref<NavigationPolygon> navigation_polygon; + navigation_polygon = tile_data->get_navigation_polygon(layer_index); - if (navpoly.is_valid()) { + if (navigation_polygon.is_valid()) { Transform2D tile_transform; tile_transform.set_origin(map_to_local(E_cell)); @@ -1739,7 +1739,7 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List NavigationServer2D::get_singleton()->region_set_owner_id(region, get_instance_id()); NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map()); NavigationServer2D::get_singleton()->region_set_transform(region, tilemap_xform * tile_transform); - NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly); + NavigationServer2D::get_singleton()->region_set_navigation_polygon(region, navigation_polygon); q.navigation_regions[E_cell].write[layer_index] = region; } } diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index e907b9f66f..08ceb946df 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -83,8 +83,8 @@ void NavigationAgent3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_next_location"), &NavigationAgent3D::get_next_location); ClassDB::bind_method(D_METHOD("distance_to_target"), &NavigationAgent3D::distance_to_target); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &NavigationAgent3D::set_velocity); - ClassDB::bind_method(D_METHOD("get_nav_path"), &NavigationAgent3D::get_nav_path); - ClassDB::bind_method(D_METHOD("get_nav_path_index"), &NavigationAgent3D::get_nav_path_index); + ClassDB::bind_method(D_METHOD("get_current_navigation_path"), &NavigationAgent3D::get_current_navigation_path); + ClassDB::bind_method(D_METHOD("get_current_navigation_path_index"), &NavigationAgent3D::get_current_navigation_path_index); ClassDB::bind_method(D_METHOD("is_target_reached"), &NavigationAgent3D::is_target_reached); ClassDB::bind_method(D_METHOD("is_target_reachable"), &NavigationAgent3D::is_target_reachable); ClassDB::bind_method(D_METHOD("is_navigation_finished"), &NavigationAgent3D::is_navigation_finished); @@ -345,11 +345,11 @@ Vector3 NavigationAgent3D::get_next_location() { ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent."); return agent_parent->get_global_transform().origin; } else { - return navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0); + return navigation_path[navigation_path_index] - Vector3(0, navigation_height_offset, 0); } } -const Vector<Vector3> &NavigationAgent3D::get_nav_path() const { +const Vector<Vector3> &NavigationAgent3D::get_current_navigation_path() const { return navigation_result->get_path(); } @@ -433,12 +433,12 @@ void NavigationAgent3D::update_navigation() { reload_path = true; } else { // Check if too far from the navigation path - if (nav_path_index > 0) { + if (navigation_path_index > 0) { const Vector<Vector3> &navigation_path = navigation_result->get_path(); Vector3 segment[2]; - segment[0] = navigation_path[nav_path_index - 1]; - segment[1] = navigation_path[nav_path_index]; + segment[0] = navigation_path[navigation_path_index - 1]; + segment[1] = navigation_path[navigation_path_index]; segment[0].y -= navigation_height_offset; segment[1].y -= navigation_height_offset; Vector3 p = Geometry3D::get_closest_point_to_segment(origin, segment); @@ -462,7 +462,7 @@ void NavigationAgent3D::update_navigation() { NavigationServer3D::get_singleton()->query_path(navigation_query, navigation_result); navigation_finished = false; - nav_path_index = 0; + navigation_path_index = 0; emit_signal(SNAME("path_changed")); } @@ -474,11 +474,11 @@ void NavigationAgent3D::update_navigation() { if (navigation_finished == false) { // Advances to the next far away location. const Vector<Vector3> &navigation_path = navigation_result->get_path(); - while (origin.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) { - nav_path_index += 1; - if (nav_path_index == navigation_path.size()) { + while (origin.distance_to(navigation_path[navigation_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) { + navigation_path_index += 1; + if (navigation_path_index == navigation_path.size()) { _check_distance_to_target(); - nav_path_index -= 1; + navigation_path_index -= 1; navigation_finished = true; emit_signal(SNAME("navigation_finished")); break; diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h index 90ceab0242..1caa783a8b 100644 --- a/scene/3d/navigation_agent_3d.h +++ b/scene/3d/navigation_agent_3d.h @@ -64,7 +64,7 @@ class NavigationAgent3D : public Node { Vector3 target_location; Ref<NavigationPathQueryParameters3D> navigation_query; Ref<NavigationPathQueryResult3D> navigation_result; - int nav_path_index = 0; + int navigation_path_index = 0; bool velocity_submitted = false; Vector3 prev_safe_velocity; /// The submitted target velocity @@ -153,10 +153,10 @@ public: Vector3 get_next_location(); - const Vector<Vector3> &get_nav_path() const; + const Vector<Vector3> &get_current_navigation_path() const; - int get_nav_path_index() const { - return nav_path_index; + int get_current_navigation_path_index() const { + return navigation_path_index; } real_t distance_to_target() const; diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index bd96c55512..520bf0a1aa 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -192,26 +192,26 @@ void NavigationRegion3D::_notification(int p_what) { } } -void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh) { - if (p_navmesh == navmesh) { +void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navigation_mesh) { + if (p_navigation_mesh == navigation_mesh) { return; } - if (navmesh.is_valid()) { - navmesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); + if (navigation_mesh.is_valid()) { + navigation_mesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); } - navmesh = p_navmesh; + navigation_mesh = p_navigation_mesh; - if (navmesh.is_valid()) { - navmesh->connect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); + if (navigation_mesh.is_valid()) { + navigation_mesh->connect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); } - NavigationServer3D::get_singleton()->region_set_navmesh(region, p_navmesh); + NavigationServer3D::get_singleton()->region_set_navigation_mesh(region, p_navigation_mesh); #ifdef DEBUG_ENABLED if (is_inside_tree() && NavigationServer3D::get_singleton()->get_debug_enabled()) { - if (navmesh.is_valid()) { + if (navigation_mesh.is_valid()) { _update_debug_mesh(); _update_debug_edge_connections_mesh(); } else { @@ -232,7 +232,7 @@ void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmes } Ref<NavigationMesh> NavigationRegion3D::get_navigation_mesh() const { - return navmesh; + return navigation_mesh; } struct BakeThreadsArgs { @@ -245,7 +245,7 @@ void _bake_navigation_mesh(void *p_user_data) { if (args->nav_region->get_navigation_mesh().is_valid()) { Ref<NavigationMesh> nav_mesh = args->nav_region->get_navigation_mesh()->duplicate(); - NavigationServer3D::get_singleton()->region_bake_navmesh(nav_mesh, args->nav_region); + NavigationServer3D::get_singleton()->region_bake_navigation_mesh(nav_mesh, args->nav_region); args->nav_region->call_deferred(SNAME("_bake_finished"), nav_mesh); memdelete(args); } else { @@ -278,7 +278,7 @@ PackedStringArray NavigationRegion3D::get_configuration_warnings() const { PackedStringArray warnings = Node::get_configuration_warnings(); if (is_visible_in_tree() && is_inside_tree()) { - if (!navmesh.is_valid()) { + if (!navigation_mesh.is_valid()) { warnings.push_back(RTR("A NavigationMesh resource must be set or created for this node to work.")); } } @@ -287,7 +287,7 @@ PackedStringArray NavigationRegion3D::get_configuration_warnings() const { } void NavigationRegion3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationRegion3D::set_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navigation_mesh"), &NavigationRegion3D::set_navigation_mesh); ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationRegion3D::get_navigation_mesh); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion3D::set_enabled); @@ -308,9 +308,9 @@ void NavigationRegion3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationRegion3D::get_travel_cost); ClassDB::bind_method(D_METHOD("bake_navigation_mesh", "on_thread"), &NavigationRegion3D::bake_navigation_mesh, DEFVAL(true)); - ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationRegion3D::_bake_finished); + ClassDB::bind_method(D_METHOD("_bake_finished", "navigation_mesh"), &NavigationRegion3D::_bake_finished); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"), "set_navigation_mesh", "get_navigation_mesh"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navigation_mesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"), "set_navigation_mesh", "get_navigation_mesh"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "enter_cost"), "set_enter_cost", "get_enter_cost"); @@ -353,8 +353,8 @@ NavigationRegion3D::NavigationRegion3D() { } NavigationRegion3D::~NavigationRegion3D() { - if (navmesh.is_valid()) { - navmesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); + if (navigation_mesh.is_valid()) { + navigation_mesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); } NavigationServer3D::get_singleton()->free(region); @@ -392,7 +392,7 @@ void NavigationRegion3D::_update_debug_mesh() { return; } - if (!navmesh.is_valid()) { + if (!navigation_mesh.is_valid()) { if (debug_instance.is_valid()) { RS::get_singleton()->instance_set_visible(debug_instance, false); } @@ -412,12 +412,12 @@ void NavigationRegion3D::_update_debug_mesh() { bool enabled_geometry_face_random_color = NavigationServer3D::get_singleton()->get_debug_navigation_enable_geometry_face_random_color(); bool enabled_edge_lines = NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_lines(); - Vector<Vector3> vertices = navmesh->get_vertices(); + Vector<Vector3> vertices = navigation_mesh->get_vertices(); if (vertices.size() == 0) { return; } - int polygon_count = navmesh->get_polygon_count(); + int polygon_count = navigation_mesh->get_polygon_count(); if (polygon_count == 0) { return; } @@ -450,7 +450,7 @@ void NavigationRegion3D::_update_debug_mesh() { polygon_color.a = debug_navigation_geometry_face_color.a; } - Vector<int> polygon = navmesh->get_polygon(i); + Vector<int> polygon = navigation_mesh->get_polygon(i); face_vertex_array.push_back(vertices[polygon[0]]); face_vertex_array.push_back(vertices[polygon[1]]); @@ -528,7 +528,7 @@ void NavigationRegion3D::_update_debug_edge_connections_mesh() { return; } - if (!navmesh.is_valid()) { + if (!navigation_mesh.is_valid()) { if (debug_edge_connections_instance.is_valid()) { RS::get_singleton()->instance_set_visible(debug_edge_connections_instance, false); } diff --git a/scene/3d/navigation_region_3d.h b/scene/3d/navigation_region_3d.h index 660538d314..7dcfa9cfa4 100644 --- a/scene/3d/navigation_region_3d.h +++ b/scene/3d/navigation_region_3d.h @@ -42,7 +42,7 @@ class NavigationRegion3D : public Node3D { uint32_t navigation_layers = 1; real_t enter_cost = 0.0; real_t travel_cost = 1.0; - Ref<NavigationMesh> navmesh; + Ref<NavigationMesh> navigation_mesh; Thread bake_thread; @@ -82,13 +82,13 @@ public: void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const; - void set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh); + void set_navigation_mesh(const Ref<NavigationMesh> &p_navigation_mesh); Ref<NavigationMesh> get_navigation_mesh() const; /// Bakes the navigation mesh; once done, automatically /// sets the new navigation mesh and emits a signal void bake_navigation_mesh(bool p_on_thread); - void _bake_finished(Ref<NavigationMesh> p_nav_mesh); + void _bake_finished(Ref<NavigationMesh> p_navigation_mesh); PackedStringArray get_configuration_warnings() const override; diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 7c78b757c7..8b47d12308 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -57,10 +57,10 @@ bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { _set_item_shapes(idx, p_value); } else if (what == "preview") { set_item_preview(idx, p_value); - } else if (what == "navmesh") { - set_item_navmesh(idx, p_value); - } else if (what == "navmesh_transform") { - set_item_navmesh_transform(idx, p_value); + } else if (what == "navigation_mesh") { + set_item_navigation_mesh(idx, p_value); + } else if (what == "navigation_mesh_transform") { + set_item_navigation_mesh_transform(idx, p_value); } else { return false; } @@ -85,10 +85,10 @@ bool MeshLibrary::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_item_mesh_transform(idx); } else if (what == "shapes") { r_ret = _get_item_shapes(idx); - } else if (what == "navmesh") { - r_ret = get_item_navmesh(idx); - } else if (what == "navmesh_transform") { - r_ret = get_item_navmesh_transform(idx); + } else if (what == "navigation_mesh") { + r_ret = get_item_navigation_mesh(idx); + } else if (what == "navigation_mesh_transform") { + r_ret = get_item_navigation_mesh_transform(idx); } else if (what == "preview") { r_ret = get_item_preview(idx); } else { @@ -105,8 +105,8 @@ void MeshLibrary::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("mesh"), PROPERTY_HINT_RESOURCE_TYPE, "Mesh")); p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prop_name + PNAME("mesh_transform"), PROPERTY_HINT_NONE, "suffix:m")); p_list->push_back(PropertyInfo(Variant::ARRAY, prop_name + PNAME("shapes"))); - p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("navmesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); - p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prop_name + PNAME("navmesh_transform"), PROPERTY_HINT_NONE, "suffix:m")); + p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("navigation_mesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prop_name + PNAME("navigation_mesh_transform"), PROPERTY_HINT_NONE, "suffix:m")); p_list->push_back(PropertyInfo(Variant::OBJECT, prop_name + PNAME("preview"), PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT)); } } @@ -150,18 +150,18 @@ void MeshLibrary::set_item_shapes(int p_item, const Vector<ShapeData> &p_shapes) notify_property_list_changed(); } -void MeshLibrary::set_item_navmesh(int p_item, const Ref<NavigationMesh> &p_navmesh) { +void MeshLibrary::set_item_navigation_mesh(int p_item, const Ref<NavigationMesh> &p_navigation_mesh) { ERR_FAIL_COND_MSG(!item_map.has(p_item), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - item_map[p_item].navmesh = p_navmesh; + item_map[p_item].navigation_mesh = p_navigation_mesh; notify_property_list_changed(); notify_change_to_owners(); emit_changed(); notify_property_list_changed(); } -void MeshLibrary::set_item_navmesh_transform(int p_item, const Transform3D &p_transform) { +void MeshLibrary::set_item_navigation_mesh_transform(int p_item, const Transform3D &p_transform) { ERR_FAIL_COND_MSG(!item_map.has(p_item), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - item_map[p_item].navmesh_transform = p_transform; + item_map[p_item].navigation_mesh_transform = p_transform; notify_change_to_owners(); emit_changed(); notify_property_list_changed(); @@ -194,14 +194,14 @@ Vector<MeshLibrary::ShapeData> MeshLibrary::get_item_shapes(int p_item) const { return item_map[p_item].shapes; } -Ref<NavigationMesh> MeshLibrary::get_item_navmesh(int p_item) const { +Ref<NavigationMesh> MeshLibrary::get_item_navigation_mesh(int p_item) const { ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref<NavigationMesh>(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - return item_map[p_item].navmesh; + return item_map[p_item].navigation_mesh; } -Transform3D MeshLibrary::get_item_navmesh_transform(int p_item) const { +Transform3D MeshLibrary::get_item_navigation_mesh_transform(int p_item) const { ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Transform3D(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - return item_map[p_item].navmesh_transform; + return item_map[p_item].navigation_mesh_transform; } Ref<Texture2D> MeshLibrary::get_item_preview(int p_item) const { @@ -314,15 +314,15 @@ void MeshLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("set_item_name", "id", "name"), &MeshLibrary::set_item_name); ClassDB::bind_method(D_METHOD("set_item_mesh", "id", "mesh"), &MeshLibrary::set_item_mesh); ClassDB::bind_method(D_METHOD("set_item_mesh_transform", "id", "mesh_transform"), &MeshLibrary::set_item_mesh_transform); - ClassDB::bind_method(D_METHOD("set_item_navmesh", "id", "navmesh"), &MeshLibrary::set_item_navmesh); - ClassDB::bind_method(D_METHOD("set_item_navmesh_transform", "id", "navmesh"), &MeshLibrary::set_item_navmesh_transform); + ClassDB::bind_method(D_METHOD("set_item_navigation_mesh", "id", "navigation_mesh"), &MeshLibrary::set_item_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_item_navigation_mesh_transform", "id", "navigation_mesh"), &MeshLibrary::set_item_navigation_mesh_transform); ClassDB::bind_method(D_METHOD("set_item_shapes", "id", "shapes"), &MeshLibrary::_set_item_shapes); ClassDB::bind_method(D_METHOD("set_item_preview", "id", "texture"), &MeshLibrary::set_item_preview); ClassDB::bind_method(D_METHOD("get_item_name", "id"), &MeshLibrary::get_item_name); ClassDB::bind_method(D_METHOD("get_item_mesh", "id"), &MeshLibrary::get_item_mesh); ClassDB::bind_method(D_METHOD("get_item_mesh_transform", "id"), &MeshLibrary::get_item_mesh_transform); - ClassDB::bind_method(D_METHOD("get_item_navmesh", "id"), &MeshLibrary::get_item_navmesh); - ClassDB::bind_method(D_METHOD("get_item_navmesh_transform", "id"), &MeshLibrary::get_item_navmesh_transform); + ClassDB::bind_method(D_METHOD("get_item_navigation_mesh", "id"), &MeshLibrary::get_item_navigation_mesh); + ClassDB::bind_method(D_METHOD("get_item_navigation_mesh_transform", "id"), &MeshLibrary::get_item_navigation_mesh_transform); ClassDB::bind_method(D_METHOD("get_item_shapes", "id"), &MeshLibrary::_get_item_shapes); ClassDB::bind_method(D_METHOD("get_item_preview", "id"), &MeshLibrary::get_item_preview); ClassDB::bind_method(D_METHOD("remove_item", "id"), &MeshLibrary::remove_item); diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h index 79acb41c4e..a18e2b20d3 100644 --- a/scene/resources/mesh_library.h +++ b/scene/resources/mesh_library.h @@ -49,11 +49,11 @@ public: struct Item { String name; Ref<Mesh> mesh; + Transform3D mesh_transform; Vector<ShapeData> shapes; Ref<Texture2D> preview; - Transform3D navmesh_transform; - Transform3D mesh_transform; - Ref<NavigationMesh> navmesh; + Ref<NavigationMesh> navigation_mesh; + Transform3D navigation_mesh_transform; }; RBMap<int, Item> item_map; @@ -74,15 +74,15 @@ public: void set_item_name(int p_item, const String &p_name); void set_item_mesh(int p_item, const Ref<Mesh> &p_mesh); void set_item_mesh_transform(int p_item, const Transform3D &p_transform); - void set_item_navmesh(int p_item, const Ref<NavigationMesh> &p_navmesh); - void set_item_navmesh_transform(int p_item, const Transform3D &p_transform); + void set_item_navigation_mesh(int p_item, const Ref<NavigationMesh> &p_navigation_mesh); + void set_item_navigation_mesh_transform(int p_item, const Transform3D &p_transform); void set_item_shapes(int p_item, const Vector<ShapeData> &p_shapes); void set_item_preview(int p_item, const Ref<Texture2D> &p_preview); String get_item_name(int p_item) const; Ref<Mesh> get_item_mesh(int p_item) const; Transform3D get_item_mesh_transform(int p_item) const; - Ref<NavigationMesh> get_item_navmesh(int p_item) const; - Transform3D get_item_navmesh_transform(int p_item) const; + Ref<NavigationMesh> get_item_navigation_mesh(int p_item) const; + Transform3D get_item_navigation_mesh_transform(int p_item) const; Vector<ShapeData> get_item_shapes(int p_item) const; Ref<Texture2D> get_item_preview(int p_item) const; diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index de97498674..76552faec1 100644 --- a/scene/resources/navigation_mesh.cpp +++ b/scene/resources/navigation_mesh.cpp @@ -225,13 +225,13 @@ float NavigationMesh::get_edge_max_error() const { return edge_max_error; } -void NavigationMesh::set_verts_per_poly(float p_value) { +void NavigationMesh::set_vertices_per_polyon(float p_value) { ERR_FAIL_COND(p_value < 3); - verts_per_poly = p_value; + vertices_per_polyon = p_value; } -float NavigationMesh::get_verts_per_poly() const { - return verts_per_poly; +float NavigationMesh::get_vertices_per_polyon() const { + return vertices_per_polyon; } void NavigationMesh::set_detail_sample_distance(float p_value) { @@ -483,8 +483,8 @@ void NavigationMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("set_edge_max_error", "edge_max_error"), &NavigationMesh::set_edge_max_error); ClassDB::bind_method(D_METHOD("get_edge_max_error"), &NavigationMesh::get_edge_max_error); - ClassDB::bind_method(D_METHOD("set_verts_per_poly", "verts_per_poly"), &NavigationMesh::set_verts_per_poly); - ClassDB::bind_method(D_METHOD("get_verts_per_poly"), &NavigationMesh::get_verts_per_poly); + ClassDB::bind_method(D_METHOD("set_vertices_per_polyon", "vertices_per_polyon"), &NavigationMesh::set_vertices_per_polyon); + ClassDB::bind_method(D_METHOD("get_vertices_per_polyon"), &NavigationMesh::get_vertices_per_polyon); ClassDB::bind_method(D_METHOD("set_detail_sample_distance", "detail_sample_dist"), &NavigationMesh::set_detail_sample_distance); ClassDB::bind_method(D_METHOD("get_detail_sample_distance"), &NavigationMesh::get_detail_sample_distance); @@ -527,9 +527,9 @@ void NavigationMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_parsed_geometry_type", PROPERTY_HINT_ENUM, "Mesh Instances,Static Colliders,Both"), "set_parsed_geometry_type", "get_parsed_geometry_type"); ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); ADD_PROPERTY_DEFAULT("geometry_collision_mask", 0xFFFFFFFF); - ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "NavMesh Children,Group With Children,Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "geometry_source_geometry_mode", PROPERTY_HINT_ENUM, "Root Node Children,Group With Children,Group Explicit"), "set_source_geometry_mode", "get_source_geometry_mode"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "geometry_source_group_name"), "set_source_group_name", "get_source_group_name"); - ADD_PROPERTY_DEFAULT("geometry_source_group_name", StringName("navmesh")); + ADD_PROPERTY_DEFAULT("geometry_source_group_name", StringName("navigation_mesh_source_group")); ADD_GROUP("Cells", "cell_"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_size", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater,suffix:m"), "set_cell_size", "get_cell_size"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_height", PROPERTY_HINT_RANGE, "0.01,500.0,0.01,or_greater,suffix:m"), "set_cell_height", "get_cell_height"); @@ -545,7 +545,7 @@ void NavigationMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge_max_length", PROPERTY_HINT_RANGE, "0.0,50.0,0.01,or_greater,suffix:m"), "set_edge_max_length", "get_edge_max_length"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "edge_max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater,suffix:m"), "set_edge_max_error", "get_edge_max_error"); ADD_GROUP("Polygons", "polygon_"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "polygon_verts_per_poly", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_verts_per_poly", "get_verts_per_poly"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "polygon_vertices_per_polyon", PROPERTY_HINT_RANGE, "3.0,12.0,1.0,or_greater"), "set_vertices_per_polyon", "get_vertices_per_polyon"); ADD_GROUP("Details", "detail_"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail_sample_distance", PROPERTY_HINT_RANGE, "0.1,16.0,0.01,or_greater,suffix:m"), "set_detail_sample_distance", "get_detail_sample_distance"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "detail_sample_max_error", PROPERTY_HINT_RANGE, "0.0,16.0,0.01,or_greater,suffix:m"), "set_detail_sample_max_error", "get_detail_sample_max_error"); @@ -566,7 +566,7 @@ void NavigationMesh::_bind_methods() { BIND_ENUM_CONSTANT(PARSED_GEOMETRY_BOTH); BIND_ENUM_CONSTANT(PARSED_GEOMETRY_MAX); - BIND_ENUM_CONSTANT(SOURCE_GEOMETRY_NAVMESH_CHILDREN); + BIND_ENUM_CONSTANT(SOURCE_GEOMETRY_ROOT_NODE_CHILDREN); BIND_ENUM_CONSTANT(SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN); BIND_ENUM_CONSTANT(SOURCE_GEOMETRY_GROUPS_EXPLICIT); BIND_ENUM_CONSTANT(SOURCE_GEOMETRY_MAX); @@ -581,7 +581,7 @@ void NavigationMesh::_validate_property(PropertyInfo &p_property) const { } if (p_property.name == "geometry_source_group_name") { - if (source_geometry_mode == SOURCE_GEOMETRY_NAVMESH_CHILDREN) { + if (source_geometry_mode == SOURCE_GEOMETRY_ROOT_NODE_CHILDREN) { p_property.usage = PROPERTY_USAGE_NONE; return; } diff --git a/scene/resources/navigation_mesh.h b/scene/resources/navigation_mesh.h index 5ddbd75dcb..93880603eb 100644 --- a/scene/resources/navigation_mesh.h +++ b/scene/resources/navigation_mesh.h @@ -84,7 +84,7 @@ public: }; enum SourceGeometryMode { - SOURCE_GEOMETRY_NAVMESH_CHILDREN = 0, + SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0, SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN, SOURCE_GEOMETRY_GROUPS_EXPLICIT, SOURCE_GEOMETRY_MAX @@ -101,7 +101,7 @@ protected: float region_merge_size = 20.0f; float edge_max_length = 12.0f; float edge_max_error = 1.3f; - float verts_per_poly = 6.0f; + float vertices_per_polyon = 6.0f; float detail_sample_distance = 6.0f; float detail_sample_max_error = 1.0f; @@ -109,8 +109,8 @@ protected: ParsedGeometryType parsed_geometry_type = PARSED_GEOMETRY_MESH_INSTANCES; uint32_t collision_mask = 0xFFFFFFFF; - SourceGeometryMode source_geometry_mode = SOURCE_GEOMETRY_NAVMESH_CHILDREN; - StringName source_group_name = "navmesh"; + SourceGeometryMode source_geometry_mode = SOURCE_GEOMETRY_ROOT_NODE_CHILDREN; + StringName source_group_name = "navigation_mesh_source_group"; bool filter_low_hanging_obstacles = false; bool filter_ledge_spans = false; @@ -168,8 +168,8 @@ public: void set_edge_max_error(float p_value); float get_edge_max_error() const; - void set_verts_per_poly(float p_value); - float get_verts_per_poly() const; + void set_vertices_per_polyon(float p_value); + float get_vertices_per_polyon() const; void set_detail_sample_distance(float p_value); float get_detail_sample_distance() const; diff --git a/scene/resources/navigation_polygon.cpp b/scene/resources/navigation_polygon.cpp index fa9b701010..04077e95a7 100644 --- a/scene/resources/navigation_polygon.cpp +++ b/scene/resources/navigation_polygon.cpp @@ -81,8 +81,8 @@ bool NavigationPolygon::_edit_is_selected_on_click(const Point2 &p_point, double void NavigationPolygon::set_vertices(const Vector<Vector2> &p_vertices) { { - MutexLock lock(navmesh_generation); - navmesh.unref(); + MutexLock lock(navigation_mesh_generation); + navigation_mesh.unref(); } vertices = p_vertices; rect_cache_dirty = true; @@ -94,8 +94,8 @@ Vector<Vector2> NavigationPolygon::get_vertices() const { void NavigationPolygon::_set_polygons(const TypedArray<Vector<int32_t>> &p_array) { { - MutexLock lock(navmesh_generation); - navmesh.unref(); + MutexLock lock(navigation_mesh_generation); + navigation_mesh.unref(); } polygons.resize(p_array.size()); for (int i = 0; i < p_array.size(); i++) { @@ -136,8 +136,8 @@ void NavigationPolygon::add_polygon(const Vector<int> &p_polygon) { polygon.indices = p_polygon; polygons.push_back(polygon); { - MutexLock lock(navmesh_generation); - navmesh.unref(); + MutexLock lock(navigation_mesh_generation); + navigation_mesh.unref(); } } @@ -158,16 +158,16 @@ Vector<int> NavigationPolygon::get_polygon(int p_idx) { void NavigationPolygon::clear_polygons() { polygons.clear(); { - MutexLock lock(navmesh_generation); - navmesh.unref(); + MutexLock lock(navigation_mesh_generation); + navigation_mesh.unref(); } } -Ref<NavigationMesh> NavigationPolygon::get_mesh() { - MutexLock lock(navmesh_generation); +Ref<NavigationMesh> NavigationPolygon::get_navigation_mesh() { + MutexLock lock(navigation_mesh_generation); - if (navmesh.is_null()) { - navmesh.instantiate(); + if (navigation_mesh.is_null()) { + navigation_mesh.instantiate(); Vector<Vector3> verts; { verts.resize(get_vertices().size()); @@ -179,14 +179,14 @@ Ref<NavigationMesh> NavigationPolygon::get_mesh() { w[i] = Vector3(r[i].x, 0.0, r[i].y); } } - navmesh->set_vertices(verts); + navigation_mesh->set_vertices(verts); for (int i(0); i < get_polygon_count(); i++) { - navmesh->add_polygon(get_polygon(i)); + navigation_mesh->add_polygon(get_polygon(i)); } } - return navmesh; + return navigation_mesh; } void NavigationPolygon::add_outline(const Vector<Vector2> &p_outline) { @@ -222,8 +222,8 @@ void NavigationPolygon::clear_outlines() { void NavigationPolygon::make_polygons_from_outlines() { { - MutexLock lock(navmesh_generation); - navmesh.unref(); + MutexLock lock(navigation_mesh_generation); + navigation_mesh.unref(); } List<TPPLPoly> in_poly, out_poly; @@ -331,7 +331,7 @@ void NavigationPolygon::_bind_methods() { ClassDB::bind_method(D_METHOD("get_polygon_count"), &NavigationPolygon::get_polygon_count); ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationPolygon::get_polygon); ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationPolygon::clear_polygons); - ClassDB::bind_method(D_METHOD("get_mesh"), &NavigationPolygon::get_mesh); + ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationPolygon::get_navigation_mesh); ClassDB::bind_method(D_METHOD("add_outline", "outline"), &NavigationPolygon::add_outline); ClassDB::bind_method(D_METHOD("add_outline_at_index", "outline", "index"), &NavigationPolygon::add_outline_at_index); diff --git a/scene/resources/navigation_polygon.h b/scene/resources/navigation_polygon.h index 771b9c296a..e943cff04e 100644 --- a/scene/resources/navigation_polygon.h +++ b/scene/resources/navigation_polygon.h @@ -47,9 +47,9 @@ class NavigationPolygon : public Resource { mutable Rect2 item_rect; mutable bool rect_cache_dirty = true; - Mutex navmesh_generation; + Mutex navigation_mesh_generation; // Navigation mesh - Ref<NavigationMesh> navmesh; + Ref<NavigationMesh> navigation_mesh; protected: static void _bind_methods(); @@ -85,7 +85,7 @@ public: Vector<int> get_polygon(int p_idx); void clear_polygons(); - Ref<NavigationMesh> get_mesh(); + Ref<NavigationMesh> get_navigation_mesh(); NavigationPolygon() {} ~NavigationPolygon() {} |