diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/Navigation2DServer.xml index 881a0b5ee..1e3a4aa6e 100644 --- a/doc/classes/Navigation2DServer.xml +++ b/doc/classes/Navigation2DServer.xml @@ -623,7 +623,7 @@ Set the region's navigation layers. This allows selecting regions from a path request (when using [method Navigation2DServer.map_get_path]). - + diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent.xml index bc60abacb..03c630a4b 100644 --- a/doc/classes/NavigationAgent.xml +++ b/doc/classes/NavigationAgent.xml @@ -184,7 +184,7 @@ The maximum speed that an agent can move. - A bitfield determining all navigation map layers the [NavigationAgent] belongs to. On path requests the agent will ignore navmeshes without at least one matching layer. + A bitfield determining all navigation map layers the [NavigationAgent] belongs to. On path requests the agent will ignore navigation meshes without at least one matching layer. The distance to search for other agents. diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml index 6532b17f5..c4cb3baa7 100644 --- a/doc/classes/NavigationAgent2D.xml +++ b/doc/classes/NavigationAgent2D.xml @@ -184,7 +184,7 @@ The maximum speed that an agent can move. - A bitfield determining all navigation map layers the [NavigationAgent2D] belongs to. On path requests the agent will ignore navmeshes without at least one matching layer. + A bitfield determining all navigation map layers the [NavigationAgent2D] belongs to. On path requests the agent will ignore navigation meshes without at least one matching layer. The distance to search for other agents. diff --git a/doc/classes/NavigationMesh.xml b/doc/classes/NavigationMesh.xml index 20ebf4371..0a24413d8 100644 --- a/doc/classes/NavigationMesh.xml +++ b/doc/classes/NavigationMesh.xml @@ -143,11 +143,11 @@ The source of the geometry used when baking. See [enum SourceGeometryMode] for possible values. - + The name of the group to scan for geometry. Only used when [member geometry_source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT]. - + The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process. @@ -187,6 +187,7 @@ Represents the size of the [enum ParsedGeometryType] enum. + Scans the child nodes of the root node recursively for geometry. Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member geometry_source_group_name]. diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationMeshInstance.xml index 514595af8..ae0fb9c2b 100644 --- a/doc/classes/NavigationMeshInstance.xml +++ b/doc/classes/NavigationMeshInstance.xml @@ -4,7 +4,7 @@ An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. By default this node will register to the default [World3D] navigation map. If this node is a child of a [Navigation] node it will register to the navigation map of the navigation node. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using [method NavigationServer.map_set_edge_connection_margin]. - [b]Note:[/b] Overlapping two regions' navmeshes is not enough for connecting two regions. They must share a similar edge. + [b]Note:[/b] Overlapping two regions' navigation meshes is not enough for connecting two regions. They must share a similar edge. The cost of entering this region from another region can be controlled with the [member enter_cost] value. [b]Note[/b]: This value is not added to the path cost when the start position is already inside this region. The cost of traveling distances inside this region can be controlled with the [member travel_cost] multiplier. @@ -63,16 +63,16 @@ Determines if the [NavigationMeshInstance] is enabled or disabled. - When pathfinding enters this regions navmesh from another regions navmesh the [code]enter_cost[/code] value is added to the path distance for determining the shortest path. + When pathfinding enters this regions navigation mesh from another regions navigation mesh the [code]enter_cost[/code] value is added to the path distance for determining the shortest path. - A bitfield determining all navigation map layers the [NavigationMesh] belongs to. On path requests with [method NavigationServer.map_get_path] navmeshes without matching layers will be ignored and the navigation map will only proximity merge different navmeshes with matching layers. + A bitfield determining all navigation map layers the [NavigationMesh] belongs to. On path requests with [method NavigationServer.map_get_path] navigation meshes without matching layers will be ignored and the navigation map will only proximity merge different navigation meshes with matching layers. - + The [NavigationMesh] resource to use. - When pathfinding moves inside this regions navmesh the traveled distances are multiplied with [code]travel_cost[/code] for determining the shortest path. + When pathfinding moves inside this regions navigation mesh the traveled distances are multiplied with [code]travel_cost[/code] for determining the shortest path. If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationPolygonInstance.xml index 4112378d9..9f4fecbfd 100644 --- a/doc/classes/NavigationPolygonInstance.xml +++ b/doc/classes/NavigationPolygonInstance.xml @@ -84,16 +84,16 @@ Determines if the [NavigationPolygonInstance] is enabled or disabled. - When pathfinding enters this regions navmesh from another regions navmesh the [code]enter_cost[/code] value is added to the path distance for determining the shortest path. + When pathfinding enters this regions navigation mesh from another regions navigation mesh the [code]enter_cost[/code] value is added to the path distance for determining the shortest path. - A bitfield determining all navigation map layers the [NavigationPolygon] belongs to. On path requests with [method Navigation2DServer.map_get_path] navmeshes without matching layers will be ignored and the navigation map will only proximity merge different navmeshes with matching layers. + A bitfield determining all navigation map layers the [NavigationPolygon] belongs to. On path requests with [method Navigation2DServer.map_get_path] navigation meshes without matching layers will be ignored and the navigation map will only proximity merge different navigation meshes with matching layers. - + The [NavigationPolygon] resource to use. - When pathfinding moves inside this regions navmesh the traveled distances are multiplied with [code]travel_cost[/code] for determining the shortest path. + When pathfinding moves inside this regions navigation mesh the traveled distances are multiplied with [code]travel_cost[/code] for determining the shortest path. If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer.xml index f96f32338..e1cdde8c3 100644 --- a/doc/classes/NavigationServer.xml +++ b/doc/classes/NavigationServer.xml @@ -704,10 +704,10 @@ Set the region's navigation layers. This allows selecting regions from a path request (when using [method NavigationServer.map_get_path]). - + - + Sets the navigation mesh for the region. diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index d2b2adbe5..b49c6dc87 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -531,7 +531,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, RBMap(p_node)) { + } else if (_teststr(name, "navigation_mesh") && Object::cast_to(p_node)) { if (isroot) { return p_node; } @@ -542,7 +542,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, RBMapset_name(_fixstr(name, "navmesh")); + nmi->set_name(_fixstr(name, "navigation_mesh")); Ref nmesh = memnew(NavigationMesh); nmesh->create_from_mesh(mesh); nmi->set_navigation_mesh(nmesh); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 0d79e74db..1971d6662 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -3566,10 +3566,10 @@ int NavigationMeshSpatialGizmoPlugin::get_priority() const { } void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { - NavigationMeshInstance *navmesh_instance = Object::cast_to(p_gizmo->get_spatial_node()); + NavigationMeshInstance *navigation_mesh_instance = Object::cast_to(p_gizmo->get_spatial_node()); p_gizmo->clear(); - Ref navigationmesh = navmesh_instance->get_navigation_mesh(); + Ref navigationmesh = navigation_mesh_instance->get_navigation_mesh(); if (navigationmesh.is_null()) { return; } @@ -3693,7 +3693,7 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { } debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, face_mesh_array); - p_gizmo->add_mesh(debug_mesh, navmesh_instance->is_enabled() ? get_material("face_material", p_gizmo) : get_material("face_material_disabled", p_gizmo)); + p_gizmo->add_mesh(debug_mesh, navigation_mesh_instance->is_enabled() ? get_material("face_material", p_gizmo) : get_material("face_material_disabled", p_gizmo)); // if enabled build geometry edge line surface bool enabled_edge_lines = NavigationServer::get_singleton()->get_debug_navigation_enable_edge_lines(); @@ -3713,7 +3713,7 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { line_vertex_array.push_back(vertices[polygon[0]]); } - p_gizmo->add_lines(line_vertex_array, navmesh_instance->is_enabled() ? get_material("edge_material", p_gizmo) : get_material("edge_material_disabled", p_gizmo)); + p_gizmo->add_lines(line_vertex_array, navigation_mesh_instance->is_enabled() ? get_material("edge_material", p_gizmo) : get_material("edge_material_disabled", p_gizmo)); } } diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 1dae78e68..a095b41cf 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -187,7 +187,7 @@ - If [code]true[/code], this GridMap uses cell navmesh resources to create navigation regions. + If [code]true[/code], this GridMap uses cell navigation mesh resources to create navigation regions. If [code]true[/code], grid items are centered on the X axis. diff --git a/modules/gridmap/doc_classes/MeshLibrary.xml b/modules/gridmap/doc_classes/MeshLibrary.xml index f2c2bdbd4..f24305838 100644 --- a/modules/gridmap/doc_classes/MeshLibrary.xml +++ b/modules/gridmap/doc_classes/MeshLibrary.xml @@ -59,14 +59,14 @@ Returns the item's name. - + Returns the item's navigation mesh. - + @@ -126,18 +126,18 @@ This name is shown in the editor. It can also be used to look up the item later using [method find_item_by_name]. - + - + Sets the item's navigation mesh. - + - + Sets the transform to apply to the item's navigation mesh. diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 0008f5b05..04b35960c 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -233,7 +233,7 @@ void GridMap::set_navigation_map(RID p_navigation_map) { for (RBMap::Element *E = octant_map.front(); E; E = E->next()) { Octant &g = *(E->get()); - for (RBMap::Element *F = g.navmesh_ids.front(); F; F = F->next()) { + for (RBMap::Element *F = g.navigation_cell_ids.front(); F; F = F->next()) { if (F->get().region.is_valid()) { NavigationServer::get_singleton()->region_set_map(F->get().region, nav_map); } @@ -489,12 +489,12 @@ void GridMap::_octant_transform(const OctantKey &p_key) { // update transform for NavigationServer regions and navigation debugmesh instances if (bake_navigation) { - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (E->get().region.is_valid()) { NavigationServer::get_singleton()->region_set_transform(E->get().region, get_global_transform() * E->get().xform); } - if (E->get().navmesh_debug_instance.is_valid()) { - RS::get_singleton()->instance_set_transform(E->get().navmesh_debug_instance, get_global_transform() * E->get().xform); + if (E->get().navigation_mesh_debug_instance.is_valid()) { + RS::get_singleton()->instance_set_transform(E->get().navigation_mesh_debug_instance, get_global_transform() * E->get().xform); } } } @@ -520,16 +520,16 @@ bool GridMap::_octant_update(const OctantKey &p_key) { } //erase navigation - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (E->get().region.is_valid()) { NavigationServer::get_singleton()->free(E->get().region); E->get().region = RID(); } - if (E->get().navmesh_debug_instance.is_valid()) { - RS::get_singleton()->free(E->get().navmesh_debug_instance); + if (E->get().navigation_mesh_debug_instance.is_valid()) { + RS::get_singleton()->free(E->get().navigation_mesh_debug_instance); } } - g.navmesh_ids.clear(); + g.navigation_cell_ids.clear(); //erase multimeshes @@ -601,17 +601,17 @@ bool GridMap::_octant_update(const OctantKey &p_key) { } } - // add the item's navmesh at given xform to GridMap's Navigation ancestor - Ref navmesh = mesh_library->get_item_navmesh(c.item); - if (navmesh.is_valid()) { - Octant::NavMesh nm; - nm.xform = xform * mesh_library->get_item_navmesh_transform(c.item); + // add the item's navigation_mesh at given xform to GridMap's Navigation ancestor + Ref navigation_mesh = mesh_library->get_item_navigation_mesh(c.item); + if (navigation_mesh.is_valid()) { + Octant::NavigationCell nm; + nm.xform = xform * mesh_library->get_item_navigation_mesh_transform(c.item); if (bake_navigation) { RID region = NavigationServer::get_singleton()->region_create(); NavigationServer::get_singleton()->region_set_owner_id(region, get_instance_id()); NavigationServer::get_singleton()->region_set_navigation_layers(region, navigation_layers); - NavigationServer::get_singleton()->region_set_navmesh(region, navmesh); + NavigationServer::get_singleton()->region_set_navigation_mesh(region, navigation_mesh); NavigationServer::get_singleton()->region_set_transform(region, get_global_transform() * nm.xform); if (is_inside_tree()) { NavigationServer::get_singleton()->region_set_map(region, get_navigation_map()); @@ -622,19 +622,19 @@ bool GridMap::_octant_update(const OctantKey &p_key) { // add navigation debugmesh visual instances if debug is enabled SceneTree *st = SceneTree::get_singleton(); if (st && st->is_debugging_navigation_hint()) { - if (!nm.navmesh_debug_instance.is_valid()) { - RID navmesh_debug_rid = navmesh->get_debug_mesh()->get_rid(); - nm.navmesh_debug_instance = RS::get_singleton()->instance_create(); - RS::get_singleton()->instance_set_base(nm.navmesh_debug_instance, navmesh_debug_rid); + if (!nm.navigation_mesh_debug_instance.is_valid()) { + RID navigation_mesh_debug_rid = navigation_mesh->get_debug_mesh()->get_rid(); + nm.navigation_mesh_debug_instance = RS::get_singleton()->instance_create(); + RS::get_singleton()->instance_set_base(nm.navigation_mesh_debug_instance, navigation_mesh_debug_rid); } if (is_inside_tree()) { - RS::get_singleton()->instance_set_scenario(nm.navmesh_debug_instance, get_world_3d()->get_scenario()); - RS::get_singleton()->instance_set_transform(nm.navmesh_debug_instance, get_global_transform() * nm.xform); + RS::get_singleton()->instance_set_scenario(nm.navigation_mesh_debug_instance, get_world_3d()->get_scenario()); + RS::get_singleton()->instance_set_transform(nm.navigation_mesh_debug_instance, get_global_transform() * nm.xform); } } #endif // DEBUG_ENABLED } - g.navmesh_ids[E->get()] = nm; + g.navigation_cell_ids[E->get()] = nm; } } @@ -725,14 +725,14 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { } if (bake_navigation && mesh_library.is_valid()) { - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (cell_map.has(E->key()) && E->get().region.is_valid() == false) { - Ref nm = mesh_library->get_item_navmesh(cell_map[E->key()].item); + Ref nm = mesh_library->get_item_navigation_mesh(cell_map[E->key()].item); if (nm.is_valid()) { RID region = NavigationServer::get_singleton()->region_create(); NavigationServer::get_singleton()->region_set_owner_id(region, get_instance_id()); NavigationServer::get_singleton()->region_set_navigation_layers(region, navigation_layers); - NavigationServer::get_singleton()->region_set_navmesh(region, nm); + NavigationServer::get_singleton()->region_set_navigation_mesh(region, nm); NavigationServer::get_singleton()->region_set_transform(region, get_global_transform() * E->get().xform); NavigationServer::get_singleton()->region_set_map(region, get_navigation_map()); E->get().region = region; @@ -769,14 +769,14 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) { RS::get_singleton()->instance_set_scenario(g.multimesh_instances[i].instance, RID()); } - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (E->get().region.is_valid()) { NavigationServer::get_singleton()->free(E->get().region); E->get().region = RID(); } - if (E->get().navmesh_debug_instance.is_valid()) { - RS::get_singleton()->free(E->get().navmesh_debug_instance); - E->get().navmesh_debug_instance = RID(); + if (E->get().navigation_mesh_debug_instance.is_valid()) { + RS::get_singleton()->free(E->get().navigation_mesh_debug_instance); + E->get().navigation_mesh_debug_instance = RID(); } } @@ -813,15 +813,15 @@ void GridMap::_octant_clean_up(const OctantKey &p_key) { } // Erase navigation - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (E->get().region.is_valid()) { NavigationServer::get_singleton()->free(E->get().region); } - if (E->get().navmesh_debug_instance.is_valid()) { - RS::get_singleton()->free(E->get().navmesh_debug_instance); + if (E->get().navigation_mesh_debug_instance.is_valid()) { + RS::get_singleton()->free(E->get().navigation_mesh_debug_instance); } } - g.navmesh_ids.clear(); + g.navigation_cell_ids.clear(); #ifdef DEBUG_ENABLED if (bake_navigation) { @@ -1422,7 +1422,7 @@ void GridMap::_update_octant_navigation_debug_edge_connections_mesh(const Octant Vector vertex_array; - for (RBMap::Element *E = g.navmesh_ids.front(); E; E = E->next()) { + for (RBMap::Element *E = g.navigation_cell_ids.front(); E; E = E->next()) { if (cell_map.has(E->key()) && E->get().region.is_valid()) { int connections_count = NavigationServer::get_singleton()->region_get_connections_count(E->get().region); if (connections_count == 0) { diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 2d5925c76..72fedb32e 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -87,10 +87,10 @@ class GridMap : public Spatial { * A GridMap can have multiple Octants. */ struct Octant { - struct NavMesh { + struct NavigationCell { RID region; Transform xform; - RID navmesh_debug_instance; + RID navigation_mesh_debug_instance; }; struct MultimeshInstance { @@ -116,7 +116,7 @@ class GridMap : public Spatial { bool dirty; RID static_body; - RBMap navmesh_ids; + RBMap navigation_cell_ids; }; union OctantKey { diff --git a/modules/gridmap/mesh_library.cpp b/modules/gridmap/mesh_library.cpp index 527b29d72..e29eada12 100644 --- a/modules/gridmap/mesh_library.cpp +++ b/modules/gridmap/mesh_library.cpp @@ -58,10 +58,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; } @@ -86,10 +86,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 { @@ -106,8 +106,8 @@ void MeshLibrary::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, name + ("mesh"), PROPERTY_HINT_RESOURCE_TYPE, "Mesh")); p_list->push_back(PropertyInfo(Variant::TRANSFORM, name + ("mesh_transform"))); p_list->push_back(PropertyInfo(Variant::ARRAY, name + ("shapes"))); - p_list->push_back(PropertyInfo(Variant::OBJECT, name + ("navmesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, name + ("navmesh_transform"))); + p_list->push_back(PropertyInfo(Variant::OBJECT, name + ("navigation_mesh"), PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); + p_list->push_back(PropertyInfo(Variant::TRANSFORM, name + ("navigation_mesh_transform"))); p_list->push_back(PropertyInfo(Variant::OBJECT, name + ("preview"), PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_HELPER)); } } @@ -151,18 +151,18 @@ void MeshLibrary::set_item_shapes(int p_item, const Vector &p_shapes) _change_notify(); } -void MeshLibrary::set_item_navmesh(int p_item, const Ref &p_navmesh) { +void MeshLibrary::set_item_navigation_mesh(int p_item, const Ref &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; _change_notify(); notify_change_to_owners(); emit_changed(); _change_notify(); } -void MeshLibrary::set_item_navmesh_transform(int p_item, const Transform &p_transform) { +void MeshLibrary::set_item_navigation_mesh_transform(int p_item, const Transform &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(); _change_notify(); @@ -195,14 +195,14 @@ Vector MeshLibrary::get_item_shapes(int p_item) const { return item_map[p_item].shapes; } -Ref MeshLibrary::get_item_navmesh(int p_item) const { +Ref MeshLibrary::get_item_navigation_mesh(int p_item) const { ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - return item_map[p_item].navmesh; + return item_map[p_item].navigation_mesh; } -Transform MeshLibrary::get_item_navmesh_transform(int p_item) const { +Transform MeshLibrary::get_item_navigation_mesh_transform(int p_item) const { ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Transform(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); - return item_map[p_item].navmesh_transform; + return item_map[p_item].navigation_mesh_transform; } Ref MeshLibrary::get_item_preview(int p_item) const { @@ -311,15 +311,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/modules/gridmap/mesh_library.h b/modules/gridmap/mesh_library.h index 396cd2bce..b8d99f2ee 100644 --- a/modules/gridmap/mesh_library.h +++ b/modules/gridmap/mesh_library.h @@ -53,9 +53,9 @@ public: Ref mesh; Vector shapes; Ref preview; - Transform navmesh_transform; + Transform navigation_mesh_transform; Transform mesh_transform; - Ref navmesh; + Ref navigation_mesh; }; RBMap item_map; @@ -75,15 +75,15 @@ public: void set_item_name(int p_item, const String &p_name); void set_item_mesh(int p_item, const Ref &p_mesh); void set_item_mesh_transform(int p_item, const Transform &p_transform); - void set_item_navmesh(int p_item, const Ref &p_navmesh); - void set_item_navmesh_transform(int p_item, const Transform &p_transform); + void set_item_navigation_mesh(int p_item, const Ref &p_navigation_mesh); + void set_item_navigation_mesh_transform(int p_item, const Transform &p_transform); void set_item_shapes(int p_item, const Vector &p_shapes); void set_item_preview(int p_item, const Ref &p_preview); String get_item_name(int p_item) const; Ref get_item_mesh(int p_item) const; Transform get_item_mesh_transform(int p_item) const; - Ref get_item_navmesh(int p_item) const; - Transform get_item_navmesh_transform(int p_item) const; + Ref get_item_navigation_mesh(int p_item) const; + Transform get_item_navigation_mesh_transform(int p_item) const; Vector get_item_shapes(int p_item) const; Ref get_item_preview(int p_item) const; diff --git a/modules/gridmap/mesh_library_editor_plugin.cpp b/modules/gridmap/mesh_library_editor_plugin.cpp index 15010efbb..0e39cbc83 100644 --- a/modules/gridmap/mesh_library_editor_plugin.cpp +++ b/modules/gridmap/mesh_library_editor_plugin.cpp @@ -170,23 +170,23 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, p_library->set_item_shapes(id, collisions); - Ref navmesh; - Transform navmesh_transform; + Ref navigation_mesh; + Transform navigation_mesh_transform; for (int j = 0; j < mi->get_child_count(); j++) { Node *child2 = mi->get_child(j); if (!Object::cast_to(child2)) { continue; } NavigationMeshInstance *sb = Object::cast_to(child2); - navmesh = sb->get_navigation_mesh(); - navmesh_transform = sb->get_transform(); - if (!navmesh.is_null()) { + navigation_mesh = sb->get_navigation_mesh(); + navigation_mesh_transform = sb->get_transform(); + if (!navigation_mesh.is_null()) { break; } } - if (!navmesh.is_null()) { - p_library->set_item_navmesh(id, navmesh); - p_library->set_item_navmesh_transform(id, navmesh_transform); + if (!navigation_mesh.is_null()) { + p_library->set_item_navigation_mesh(id, navigation_mesh); + p_library->set_item_navigation_mesh_transform(id, navigation_mesh_transform); } } diff --git a/modules/navigation/pandemonium_navigation_2d_server.cpp b/modules/navigation/pandemonium_navigation_2d_server.cpp index d7a5a9c1d..bff9bae0f 100644 --- a/modules/navigation/pandemonium_navigation_2d_server.cpp +++ b/modules/navigation/pandemonium_navigation_2d_server.cpp @@ -284,8 +284,8 @@ void FORWARD_2(region_set_navigation_layers, RID, p_region, uint32_t, p_navigati uint32_t FORWARD_1_C(region_get_navigation_layers, RID, p_region, rid_to_rid); void FORWARD_2(region_set_transform, RID, p_region, Transform2D, p_transform, rid_to_rid, trf2_to_trf3); -void PandemoniumNavigation2DServer::region_set_navpoly(RID p_region, Ref p_nav_mesh) { - NavigationServer::get_singleton()->region_set_navmesh(p_region, poly_to_mesh(p_nav_mesh)); +void PandemoniumNavigation2DServer::region_set_navigation_polygon(RID p_region, Ref p_navigation_mesh) { + NavigationServer::get_singleton()->region_set_navigation_mesh(p_region, poly_to_mesh(p_navigation_mesh)); } int FORWARD_1_C(region_get_connections_count, RID, p_region, rid_to_rid); diff --git a/modules/navigation/pandemonium_navigation_2d_server.h b/modules/navigation/pandemonium_navigation_2d_server.h index 8588f7799..74c41f2c0 100644 --- a/modules/navigation/pandemonium_navigation_2d_server.h +++ b/modules/navigation/pandemonium_navigation_2d_server.h @@ -127,7 +127,7 @@ public: virtual void region_set_transform(RID p_region, Transform2D p_transform); /// Set the navigation poly of this region. - virtual void region_set_navpoly(RID p_region, Ref p_nav_mesh); + virtual void region_set_navigation_polygon(RID p_region, Ref p_navigation_mesh); /// Get a list of a region's connection to other regions. virtual int region_get_connections_count(RID p_region) const; diff --git a/modules/navigation/pandemonium_navigation_server.cpp b/modules/navigation/pandemonium_navigation_server.cpp index c364cc5e9..19088d537 100644 --- a/modules/navigation/pandemonium_navigation_server.cpp +++ b/modules/navigation/pandemonium_navigation_server.cpp @@ -499,11 +499,11 @@ uint32_t PandemoniumNavigationServer::region_get_navigation_layers(RID p_region) return region->get_navigation_layers(); } -COMMAND_2(region_set_navmesh, RID, p_region, Ref, p_nav_mesh) { +COMMAND_2(region_set_navigation_mesh, RID, p_region, Ref, p_navigation_mesh) { NavRegion *region = region_owner.getornull(p_region); ERR_FAIL_COND(region == nullptr); - region->set_mesh(p_nav_mesh); + region->set_mesh(p_navigation_mesh); } int PandemoniumNavigationServer::region_get_connections_count(RID p_region) const { diff --git a/modules/navigation/pandemonium_navigation_server.h b/modules/navigation/pandemonium_navigation_server.h index 073f46298..5f3d891c0 100644 --- a/modules/navigation/pandemonium_navigation_server.h +++ b/modules/navigation/pandemonium_navigation_server.h @@ -154,7 +154,7 @@ public: 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; COMMAND_2(region_set_transform, RID, p_region, Transform, p_transform); - COMMAND_2(region_set_navmesh, RID, p_region, Ref, p_nav_mesh); + COMMAND_2(region_set_navigation_mesh, RID, p_region, Ref, p_navigation_mesh); virtual int region_get_connections_count(RID p_region) const; virtual Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const; diff --git a/modules/navigation_dummy/dummy_navigation_2d_server.cpp b/modules/navigation_dummy/dummy_navigation_2d_server.cpp index 0315a22aa..0fc9bc586 100644 --- a/modules/navigation_dummy/dummy_navigation_2d_server.cpp +++ b/modules/navigation_dummy/dummy_navigation_2d_server.cpp @@ -32,7 +32,7 @@ #include "scene/resources/navigation_polygon.h" -void DummyNavigation2DServer::region_set_navpoly(RID p_region, Ref p_nav_mesh) { +void DummyNavigation2DServer::region_set_navigation_polygon(RID p_region, Ref p_navigation_mesh) { } NavigationUtilities::PathQueryResult2D DummyNavigation2DServer::_query_path(const NavigationUtilities::PathQueryParameters2D &p_parameters) const { diff --git a/modules/navigation_dummy/dummy_navigation_2d_server.h b/modules/navigation_dummy/dummy_navigation_2d_server.h index 4a2ae0a86..d81e0a3f9 100644 --- a/modules/navigation_dummy/dummy_navigation_2d_server.h +++ b/modules/navigation_dummy/dummy_navigation_2d_server.h @@ -51,7 +51,7 @@ public: virtual void region_set_navigation_layers(RID p_region, uint32_t p_navigation_layers) {} virtual uint32_t region_get_navigation_layers(RID p_region) const { return 0; } virtual void region_set_transform(RID p_region, Transform2D p_transform) {} - virtual void region_set_navpoly(RID p_region, Ref p_nav_mesh); + virtual void region_set_navigation_polygon(RID p_region, Ref p_navigation_mesh); virtual int region_get_connections_count(RID p_region) const { return 0; } virtual Vector2 region_get_connection_pathway_start(RID p_region, int p_connection_id) const { return Vector2(); } virtual Vector2 region_get_connection_pathway_end(RID p_region, int p_connection_id) const { return Vector2(); } diff --git a/modules/navigation_dummy/dummy_navigation_server.cpp b/modules/navigation_dummy/dummy_navigation_server.cpp index 50a4cb9bf..dc57d7f6a 100644 --- a/modules/navigation_dummy/dummy_navigation_server.cpp +++ b/modules/navigation_dummy/dummy_navigation_server.cpp @@ -3,7 +3,7 @@ #include "scene/resources/navigation_mesh.h" -void DummyNavigationServer::region_set_navmesh(RID p_region, Ref p_nav_mesh) { +void DummyNavigationServer::region_set_navigation_mesh(RID p_region, Ref p_navigation_mesh) { } NavigationUtilities::PathQueryResult DummyNavigationServer::_query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const { diff --git a/modules/navigation_dummy/dummy_navigation_server.h b/modules/navigation_dummy/dummy_navigation_server.h index 37dfd7907..47e047076 100644 --- a/modules/navigation_dummy/dummy_navigation_server.h +++ b/modules/navigation_dummy/dummy_navigation_server.h @@ -53,7 +53,7 @@ public: virtual void region_set_navigation_layers(RID p_region, uint32_t p_navigation_layers) {} virtual uint32_t region_get_navigation_layers(RID p_region) const { return 0; } virtual void region_set_transform(RID p_region, Transform p_transform) {} - virtual void region_set_navmesh(RID p_region, Ref p_nav_mesh); + virtual void region_set_navigation_mesh(RID p_region, Ref p_navigation_mesh); virtual int region_get_connections_count(RID p_region) const { return 0; } virtual Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const { return Vector3(); } virtual Vector3 region_get_connection_pathway_end(RID p_region, int p_connection_id) const { return Vector3(); } diff --git a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp index de6a672f8..6f02e50fd 100644 --- a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp +++ b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp @@ -45,13 +45,13 @@ #include "servers/navigation/navigation_mesh_generator.h" #include "scene/gui/separator.h" -Ref NavigationPolygonEditor::_ensure_navpoly() const { - Ref navpoly = node->get_navigation_polygon(); - if (!navpoly.is_valid()) { - navpoly = Ref(memnew(NavigationPolygon)); - node->set_navigation_polygon(navpoly); +Ref NavigationPolygonEditor::_ensure_navigation_polygon() const { + Ref navigation_polygon = node->get_navigation_polygon(); + if (!navigation_polygon.is_valid()) { + navigation_polygon = Ref(memnew(NavigationPolygon)); + node->set_navigation_polygon(navigation_polygon); } - return navpoly; + return navigation_polygon; } Node2D *NavigationPolygonEditor::_get_node() const { @@ -63,52 +63,52 @@ void NavigationPolygonEditor::_set_node(Node *p_polygon) { } int NavigationPolygonEditor::_get_polygon_count() const { - Ref navpoly = node->get_navigation_polygon(); - if (navpoly.is_valid()) { - return navpoly->get_outline_count(); + Ref navigation_polygon = node->get_navigation_polygon(); + if (navigation_polygon.is_valid()) { + return navigation_polygon->get_outline_count(); } else { return 0; } } Variant NavigationPolygonEditor::_get_polygon(int p_idx) const { - Ref navpoly = node->get_navigation_polygon(); - if (navpoly.is_valid()) { - return navpoly->get_outline(p_idx); + Ref navigation_polygon = node->get_navigation_polygon(); + if (navigation_polygon.is_valid()) { + return navigation_polygon->get_outline(p_idx); } else { return Variant(Vector()); } } void NavigationPolygonEditor::_set_polygon(int p_idx, const Variant &p_polygon) const { - Ref navpoly = _ensure_navpoly(); - navpoly->set_outline(p_idx, p_polygon); + Ref navigation_polygon = _ensure_navigation_polygon(); + navigation_polygon->set_outline(p_idx, p_polygon); } void NavigationPolygonEditor::_action_add_polygon(const Variant &p_polygon) { - Ref navpoly = _ensure_navpoly(); + Ref navigation_polygon = _ensure_navigation_polygon(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); undo_redo->create_action("Add Navigation Polygon"); - undo_redo->add_do_method(navpoly.ptr(), "add_outline", p_polygon); - undo_redo->add_undo_method(navpoly.ptr(), "remove_outline", navpoly->get_outline_count()); + undo_redo->add_do_method(navigation_polygon.ptr(), "add_outline", p_polygon); + undo_redo->add_undo_method(navigation_polygon.ptr(), "remove_outline", navigation_polygon->get_outline_count()); undo_redo->commit_action(); } void NavigationPolygonEditor::_action_remove_polygon(int p_idx) { - Ref navpoly = _ensure_navpoly(); + Ref navigation_polygon = _ensure_navigation_polygon(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); undo_redo->create_action("Remove Navigation Polygon"); - undo_redo->add_do_method(navpoly.ptr(), "remove_outline", p_idx); - undo_redo->add_undo_method(navpoly.ptr(), "add_outline_at_index", navpoly->get_outline(p_idx), p_idx); + undo_redo->add_do_method(navigation_polygon.ptr(), "remove_outline", p_idx); + undo_redo->add_undo_method(navigation_polygon.ptr(), "add_outline_at_index", navigation_polygon->get_outline(p_idx), p_idx); undo_redo->commit_action(); } void NavigationPolygonEditor::_action_set_polygon(int p_idx, const Variant &p_previous, const Variant &p_polygon) { - Ref navpoly = _ensure_navpoly(); + Ref navigation_polygon = _ensure_navigation_polygon(); UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); undo_redo->create_action("Set Navigation Polygon"); - undo_redo->add_do_method(navpoly.ptr(), "set_outline", p_idx, p_polygon); - undo_redo->add_undo_method(navpoly.ptr(), "set_outline", p_idx, p_previous); + undo_redo->add_do_method(navigation_polygon.ptr(), "set_outline", p_idx, p_polygon); + undo_redo->add_undo_method(navigation_polygon.ptr(), "set_outline", p_idx, p_previous); undo_redo->commit_action(); } diff --git a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h index c32660247..705b61b82 100644 --- a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h +++ b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h @@ -47,7 +47,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor { NavigationPolygonInstance *node = nullptr; - Ref _ensure_navpoly() const; + Ref _ensure_navigation_polygon() const; AcceptDialog *err_dialog = nullptr; diff --git a/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.cpp b/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.cpp index edaa1de68..7e645b360 100644 --- a/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.cpp +++ b/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.cpp @@ -108,10 +108,10 @@ void PandemoniumNavigationMeshGenerator::process() { } void PandemoniumNavigationMeshGenerator::cleanup() { - _baking_navpolys.clear(); + _baking_navigation_polygons.clear(); _geometry_2d_parsers.clear(); #ifndef _3D_DISABLED - _baking_navmeshes.clear(); + _baking_navigation_meshes.clear(); _geometry_3d_parsers.clear(); #endif // _3D_DISABLED } @@ -188,8 +188,8 @@ void PandemoniumNavigationMeshGenerator::_process_2d_bake_cleanup_tasks() { _2d_running_jobs.remove_unordered(i); --i; - int indx = _baking_navpolys.find(e->navigation_polygon); - _baking_navpolys.remove_unordered(indx); + int indx = _baking_navigation_polygons.find(e->navigation_polygon); + _baking_navigation_polygons.remove_unordered(indx); e->call_callback(); } @@ -228,18 +228,18 @@ void PandemoniumNavigationMeshGenerator::bake_2d_from_source_geometry_data(Refget_outline_count() == 0 && !p_source_geometry_data->has_data(), "NavigationMeshSourceGeometryData2D is empty. Parse source geometry first."); - ERR_FAIL_COND_MSG(_baking_navpolys.find(p_navigation_polygon) >= 0, "NavigationPolygon is already baking. Wait for current bake task to finish."); + ERR_FAIL_COND_MSG(_baking_navigation_polygons.find(p_navigation_polygon) >= 0, "NavigationPolygon is already baking. Wait for current bake task to finish."); _generator_mutex.lock(); - _baking_navpolys.push_back(p_navigation_polygon); + _baking_navigation_polygons.push_back(p_navigation_polygon); _generator_mutex.unlock(); _static_bake_2d_from_source_geometry_data(p_navigation_polygon, p_source_geometry_data); _generator_mutex.lock(); - int64_t navigation_polygon_index = _baking_navpolys.find(p_navigation_polygon); + int64_t navigation_polygon_index = _baking_navigation_polygons.find(p_navigation_polygon); if (navigation_polygon_index >= 0) { - _baking_navpolys.remove_unordered(navigation_polygon_index); + _baking_navigation_polygons.remove_unordered(navigation_polygon_index); } _generator_mutex.unlock(); } @@ -443,11 +443,11 @@ void PandemoniumNavigationMeshGenerator::_static_bake_2d_from_source_geometry_da } void PandemoniumNavigationMeshGenerator::parse_and_bake_2d(Ref p_navigation_polygon, Node *p_root_node, Ref p_callback) { - ERR_FAIL_COND_MSG(_baking_navpolys.find(p_navigation_polygon) >= 0, "NavigationPolygon was already added to baking queue. Wait for current bake task to finish."); + ERR_FAIL_COND_MSG(_baking_navigation_polygons.find(p_navigation_polygon) >= 0, "NavigationPolygon was already added to baking queue. Wait for current bake task to finish."); ERR_FAIL_COND_MSG(p_root_node == nullptr, "NavigationPolygon requires a valid root node."); _generator_mutex.lock(); - _baking_navpolys.push_back(p_navigation_polygon); + _baking_navigation_polygons.push_back(p_navigation_polygon); _generator_mutex.unlock(); Ref navigation_generator_task; @@ -466,7 +466,7 @@ void PandemoniumNavigationMeshGenerator::parse_and_bake_2d(Ref p_navigation_polygon) const { ERR_FAIL_COND_V(!p_navigation_polygon.is_valid(), false); - return _baking_navpolys.find(p_navigation_polygon) >= 0; + return _baking_navigation_polygons.find(p_navigation_polygon) >= 0; } #ifndef _3D_DISABLED @@ -542,8 +542,8 @@ void PandemoniumNavigationMeshGenerator::_process_3d_bake_cleanup_tasks() { _3d_running_jobs.remove_unordered(i); --i; - int indx = _baking_navpolys.find(e->navigation_mesh); - _baking_navpolys.remove_unordered(indx); + int indx = _baking_navigation_polygons.find(e->navigation_mesh); + _baking_navigation_polygons.remove_unordered(indx); e->call_callback(); } @@ -598,7 +598,7 @@ void PandemoniumNavigationMeshGenerator::_static_bake_3d_from_source_geometry_da cfg.maxSimplificationError = p_navigation_mesh->get_edge_max_error(); cfg.minRegionArea = (int)(p_navigation_mesh->get_region_min_size() * p_navigation_mesh->get_region_min_size()); cfg.mergeRegionArea = (int)(p_navigation_mesh->get_region_merge_size() * p_navigation_mesh->get_region_merge_size()); - cfg.maxVertsPerPoly = (int)p_navigation_mesh->get_verts_per_poly(); + cfg.maxVertsPerPoly = (int)p_navigation_mesh->get_vertices_per_polyon(); cfg.detailSampleDist = MAX(p_navigation_mesh->get_cell_size() * p_navigation_mesh->get_detail_sample_distance(), 0.1f); cfg.detailSampleMaxError = p_navigation_mesh->get_cell_height() * p_navigation_mesh->get_detail_sample_max_error(); @@ -760,11 +760,11 @@ void PandemoniumNavigationMeshGenerator::_static_bake_3d_from_source_geometry_da } void PandemoniumNavigationMeshGenerator::parse_and_bake_3d(Ref p_navigation_mesh, Node *p_root_node, Ref p_callback) { - ERR_FAIL_COND_MSG(_baking_navmeshes.find(p_navigation_mesh) >= 0, "NavigationMesh was already added to baking queue. Wait for current bake task to finish."); + ERR_FAIL_COND_MSG(_baking_navigation_meshes.find(p_navigation_mesh) >= 0, "NavigationMesh was already added to baking queue. Wait for current bake task to finish."); ERR_FAIL_COND_MSG(p_root_node == nullptr, "avigationMesh requires a valid root node."); _generator_mutex.lock(); - _baking_navmeshes.push_back(p_navigation_mesh); + _baking_navigation_meshes.push_back(p_navigation_mesh); _generator_mutex.unlock(); Ref navigation_generator_task; @@ -785,7 +785,7 @@ void PandemoniumNavigationMeshGenerator::parse_and_bake_3d(Ref p bool PandemoniumNavigationMeshGenerator::is_navigation_mesh_baking(Ref p_navigation_mesh) const { ERR_FAIL_COND_V(!p_navigation_mesh.is_valid(), false); - return _baking_navmeshes.find(p_navigation_mesh) >= 0; + return _baking_navigation_meshes.find(p_navigation_mesh) >= 0; } void PandemoniumNavigationMeshGenerator::register_geometry_parser_3d(Ref p_geometry_parser) { @@ -820,18 +820,18 @@ void PandemoniumNavigationMeshGenerator::bake_3d_from_source_geometry_data(Refhas_data(), "NavigationMeshSourceGeometryData3D is empty. Parse source geometry first."); - ERR_FAIL_COND_MSG(_baking_navmeshes.find(p_navigation_mesh) >= 0, "NavigationMesh is already baking. Wait for current bake task to finish."); + ERR_FAIL_COND_MSG(_baking_navigation_meshes.find(p_navigation_mesh) >= 0, "NavigationMesh is already baking. Wait for current bake task to finish."); _generator_mutex.lock(); - _baking_navmeshes.push_back(p_navigation_mesh); + _baking_navigation_meshes.push_back(p_navigation_mesh); _generator_mutex.unlock(); _static_bake_3d_from_source_geometry_data(p_navigation_mesh, p_source_geometry_data); _generator_mutex.lock(); - int64_t navigation_mesh_index = _baking_navmeshes.find(p_navigation_mesh); + int64_t navigation_mesh_index = _baking_navigation_meshes.find(p_navigation_mesh); if (navigation_mesh_index >= 0) { - _baking_navmeshes.remove_unordered(navigation_mesh_index); + _baking_navigation_meshes.remove_unordered(navigation_mesh_index); } _generator_mutex.unlock(); } diff --git a/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.h b/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.h index bcc47b822..e8dd21fd2 100644 --- a/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.h +++ b/modules/navigation_mesh_generator/pandemonium_navigation_mesh_generator.h @@ -170,14 +170,14 @@ private: LocalVector> _geometry_2d_parsers; - LocalVector> _baking_navpolys; + LocalVector> _baking_navigation_polygons; LocalVector> _2d_parse_jobs; LocalVector> _2d_running_jobs; #ifndef _3D_DISABLED LocalVector> _geometry_3d_parsers; - LocalVector> _baking_navmeshes; + LocalVector> _baking_navigation_meshes; LocalVector> _3d_parse_jobs; LocalVector> _3d_running_jobs; #endif // _3D_DISABLED diff --git a/modules/tile_map/tile_map.cpp b/modules/tile_map/tile_map.cpp index f0528558a..f0bf46bcd 100644 --- a/modules/tile_map/tile_map.cpp +++ b/modules/tile_map/tile_map.cpp @@ -44,13 +44,13 @@ #include "servers/navigation_server.h" #endif // DEBUG_ENABLED -void TileMap::Quadrant::clear_navpoly() { - for (RBMap::Element *E = navpoly_ids.front(); E; E = E->next()) { +void TileMap::Quadrant::clear_navigation_polygon() { + for (RBMap::Element *E = navigation_polygon_ids.front(); E; E = E->next()) { RID region = E->get().region; Navigation2DServer::get_singleton()->region_set_map(region, RID()); Navigation2DServer::get_singleton()->free(region); } - navpoly_ids.clear(); + navigation_polygon_ids.clear(); } int TileMap::_get_quadrant_size() const { @@ -96,7 +96,7 @@ void TileMap::_notification(int p_what) { for (RBMap::Element *E = quadrant_map.front(); E; E = E->next()) { Quadrant &q = E->get(); if (bake_navigation) { - q.clear_navpoly(); + q.clear_navigation_polygon(); } if (collision_parent) { @@ -181,7 +181,7 @@ void TileMap::_update_quadrant_transform() { } if (bake_navigation) { - for (RBMap::Element *F = q.navpoly_ids.front(); F; F = F->next()) { + for (RBMap::Element *F = q.navigation_polygon_ids.front(); F; F = F->next()) { Navigation2DServer::get_singleton()->region_set_transform(F->get().region, nav_rel * F->get().xform); } } @@ -427,7 +427,7 @@ void TileMap::update_dirty_quadrants() { int shape_idx = 0; if (bake_navigation) { - q.clear_navpoly(); + q.clear_navigation_polygon(); } for (RBMap::Element *E = q.occluder_instances.front(); E; E = E->next()) { @@ -680,17 +680,17 @@ void TileMap::update_dirty_quadrants() { } if (bake_navigation) { - Ref navpoly; + Ref navigation_polygon; Vector2 npoly_ofs; if (tile_set->tile_get_tile_mode(c.id) == TileSet::AUTO_TILE || tile_set->tile_get_tile_mode(c.id) == TileSet::ATLAS_TILE) { - navpoly = tile_set->autotile_get_navigation_polygon(c.id, Vector2(c.autotile_coord_x, c.autotile_coord_y)); + navigation_polygon = tile_set->autotile_get_navigation_polygon(c.id, Vector2(c.autotile_coord_x, c.autotile_coord_y)); npoly_ofs = Vector2(); } else { - navpoly = tile_set->tile_get_navigation_polygon(c.id); + navigation_polygon = tile_set->tile_get_navigation_polygon(c.id); npoly_ofs = tile_set->tile_get_navigation_polygon_offset(c.id); } - if (navpoly.is_valid()) { + if (navigation_polygon.is_valid()) { Transform2D xform; xform.set_origin(offset.floor() + q.pos + tile_ofs); _fix_cell_transform(xform, c, npoly_ofs, s); @@ -704,11 +704,11 @@ void TileMap::update_dirty_quadrants() { } Navigation2DServer::get_singleton()->region_set_navigation_layers(region, navigation_layers); Navigation2DServer::get_singleton()->region_set_transform(region, nav_rel * xform); - Navigation2DServer::get_singleton()->region_set_navpoly(region, navpoly); + Navigation2DServer::get_singleton()->region_set_navigation_polygon(region, navigation_polygon); Quadrant::NavPoly np; np.region = region; np.xform = xform; - q.navpoly_ids[E->key()] = np; + q.navigation_polygon_ids[E->key()] = np; if (debug_navigation) { RID debug_navigation_item = RID_PRIME(vs->canvas_item_create()); @@ -717,7 +717,7 @@ void TileMap::update_dirty_quadrants() { vs->canvas_item_set_z_index(debug_navigation_item, RS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug if (debug_navigation_item.is_valid()) { - PoolVector navigation_polygon_vertices = navpoly->get_vertices(); + PoolVector navigation_polygon_vertices = navigation_polygon->get_vertices(); int vsize = navigation_polygon_vertices.size(); if (vsize > 2) { @@ -747,8 +747,8 @@ void TileMap::update_dirty_quadrants() { Vector indices; - for (int j = 0; j < navpoly->get_polygon_count(); j++) { - Vector polygon = navpoly->get_polygon(j); + for (int j = 0; j < navigation_polygon->get_polygon_count(); j++) { + Vector polygon = navigation_polygon->get_polygon(j); for (int k = 2; k < polygon.size(); k++) { int kofs[3] = { 0, k - 1, k }; @@ -922,7 +922,7 @@ void TileMap::_erase_quadrant(RBMap::Element *Q) { } if (bake_navigation) { - q.clear_navpoly(); + q.clear_navigation_polygon(); } for (RBMap::Element *E = q.occluder_instances.front(); E; E = E->next()) { diff --git a/modules/tile_map/tile_map.h b/modules/tile_map/tile_map.h index 12a0d6bb6..2817bb6ee 100644 --- a/modules/tile_map/tile_map.h +++ b/modules/tile_map/tile_map.h @@ -156,12 +156,12 @@ private: Transform2D xform; }; - RBMap navpoly_ids; + RBMap navigation_polygon_ids; RBMap occluder_instances; VSet cells; - void clear_navpoly(); + void clear_navigation_polygon(); void operator=(const Quadrant &q) { pos = q.pos; @@ -169,7 +169,7 @@ private: body = q.body; shape_owner_id = q.shape_owner_id; cells = q.cells; - navpoly_ids = q.navpoly_ids; + navigation_polygon_ids = q.navigation_polygon_ids; occluder_instances = q.occluder_instances; } Quadrant(const Quadrant &q) : @@ -180,7 +180,7 @@ private: shape_owner_id = q.shape_owner_id; cells = q.cells; occluder_instances = q.occluder_instances; - navpoly_ids = q.navpoly_ids; + navigation_polygon_ids = q.navigation_polygon_ids; } Quadrant() : dirty_list(this) {} diff --git a/modules/tile_map/tile_set.cpp b/modules/tile_map/tile_set.cpp index e75261895..aab0006ff 100644 --- a/modules/tile_map/tile_set.cpp +++ b/modules/tile_map/tile_set.cpp @@ -104,8 +104,8 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { } p.pop_front(); } - } else if (what == "navpoly_map") { - tile_map[id].autotile_data.navpoly_map.clear(); + } else if (what == "navigation_polygon_map") { + tile_map[id].autotile_data.navigation_polygon_map.clear(); Array p = p_value; Vector2 last_coord; while (p.size() > 0) { @@ -260,9 +260,9 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { p.push_back(E->value()); } r_ret = p; - } else if (what == "navpoly_map") { + } else if (what == "navigation_polygon_map") { Array p; - for (RBMap>::Element *E = tile_map[id].autotile_data.navpoly_map.front(); E; E = E->next()) { + for (RBMap>::Element *E = tile_map[id].autotile_data.navigation_polygon_map.front(); E; E = E->next()) { p.push_back(E->key()); p.push_back(E->value()); } @@ -342,7 +342,7 @@ void TileSet::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navigation_polygon_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/z_index_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } else if (tile_get_tile_mode(id) == ATLAS_TILE) { @@ -350,7 +350,7 @@ void TileSet::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "autotile/tile_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::INT, pre + "autotile/spacing", PROPERTY_HINT_RANGE, "0,256,1", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/occluder_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); - p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navpoly_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); + p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/navigation_polygon_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/priority_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); p_list->push_back(PropertyInfo(Variant::ARRAY, pre + "autotile/z_index_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL)); } @@ -976,27 +976,27 @@ const RBMap> &TileSet::autotile_get_light_oclusi void TileSet::autotile_set_navigation_polygon(int p_id, const Ref &p_navigation_polygon, const Vector2 &p_coord) { ERR_FAIL_COND_MSG(!tile_map.has(p_id), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); if (p_navigation_polygon.is_null()) { - if (tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) { - tile_map[p_id].autotile_data.navpoly_map.erase(p_coord); + if (tile_map[p_id].autotile_data.navigation_polygon_map.has(p_coord)) { + tile_map[p_id].autotile_data.navigation_polygon_map.erase(p_coord); } } else { - tile_map[p_id].autotile_data.navpoly_map[p_coord] = p_navigation_polygon; + tile_map[p_id].autotile_data.navigation_polygon_map[p_coord] = p_navigation_polygon; } } Ref TileSet::autotile_get_navigation_polygon(int p_id, const Vector2 &p_coord) const { ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), Ref(), vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); - if (!tile_map[p_id].autotile_data.navpoly_map.has(p_coord)) { + if (!tile_map[p_id].autotile_data.navigation_polygon_map.has(p_coord)) { return Ref(); } else { - return tile_map[p_id].autotile_data.navpoly_map[p_coord]; + return tile_map[p_id].autotile_data.navigation_polygon_map[p_coord]; } } const RBMap> &TileSet::autotile_get_navigation_map(int p_id) const { static RBMap> dummy; ERR_FAIL_COND_V_MSG(!tile_map.has(p_id), dummy, vformat("The TileSet doesn't have a tile with ID '%d'.", p_id)); - return tile_map[p_id].autotile_data.navpoly_map; + return tile_map[p_id].autotile_data.navigation_polygon_map; } void TileSet::tile_set_occluder_offset(int p_id, const Vector2 &p_offset) { diff --git a/modules/tile_map/tile_set.h b/modules/tile_map/tile_set.h index 67882898a..085a1bb9d 100644 --- a/modules/tile_map/tile_set.h +++ b/modules/tile_map/tile_set.h @@ -104,7 +104,7 @@ public: Vector2 icon_coord; RBMap flags; RBMap> occluder_map; - RBMap> navpoly_map; + RBMap> navigation_polygon_map; RBMap priority_map; RBMap z_index_map; FallbackMode fallback_mode; diff --git a/scene/2d/navigation_polygon_instance.cpp b/scene/2d/navigation_polygon_instance.cpp index 1d4ac5827..2e858d4e4 100644 --- a/scene/2d/navigation_polygon_instance.cpp +++ b/scene/2d/navigation_polygon_instance.cpp @@ -168,11 +168,11 @@ RID NavigationPolygonInstance::get_region_rid() const { ///////////////////////////// #ifdef TOOLS_ENABLED Rect2 NavigationPolygonInstance::_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 NavigationPolygonInstance::_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 @@ -258,7 +258,7 @@ void NavigationPolygonInstance::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { #ifdef DEBUG_ENABLED - if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || Navigation2DServer::get_singleton()->get_debug_navigation_enabled()) && navpoly.is_valid()) { + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || Navigation2DServer::get_singleton()->get_debug_navigation_enabled()) && navigation_polygon.is_valid()) { _update_debug_mesh(); _update_debug_edge_connections_mesh(); } @@ -267,27 +267,27 @@ void NavigationPolygonInstance::_notification(int p_what) { } } -void NavigationPolygonInstance::set_navigation_polygon(const Ref &p_navpoly) { - if (p_navpoly == navpoly) { +void NavigationPolygonInstance::set_navigation_polygon(const Ref &p_navigation_polygon) { + if (p_navigation_polygon == navigation_polygon) { return; } - if (navpoly.is_valid()) { - navpoly->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_polygon_changed"); + if (navigation_polygon.is_valid()) { + navigation_polygon->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_polygon_changed"); } - navpoly = p_navpoly; - Navigation2DServer::get_singleton()->region_set_navpoly(region, p_navpoly); + navigation_polygon = p_navigation_polygon; + Navigation2DServer::get_singleton()->region_set_navigation_polygon(region, p_navigation_polygon); - if (navpoly.is_valid()) { - navpoly->connect(CoreStringNames::get_singleton()->changed, this, "_navigation_polygon_changed"); + if (navigation_polygon.is_valid()) { + navigation_polygon->connect(CoreStringNames::get_singleton()->changed, this, "_navigation_polygon_changed"); } _navigation_polygon_changed(); } Ref NavigationPolygonInstance::get_navigation_polygon() const { - return navpoly; + return navigation_polygon; } void NavigationPolygonInstance::set_navigation_map(RID p_navigation_map) { @@ -319,24 +319,24 @@ void NavigationPolygonInstance::bake_navigation_polygon(bool p_on_thread) { } baking_started = true; - navpoly->clear(); + navigation_polygon->clear(); if (p_on_thread && OS::get_singleton()->can_use_threads()) { Ref f; f.instance(); f->set_instance(this); f->set_function("_bake_finished"); - NavigationMeshGenerator::get_singleton()->parse_and_bake_2d(navpoly, this, f); + NavigationMeshGenerator::get_singleton()->parse_and_bake_2d(navigation_polygon, this, f); } else { - Ref source_geometry_data = NavigationMeshGenerator::get_singleton()->parse_2d_source_geometry_data(navpoly, this); - NavigationMeshGenerator::get_singleton()->bake_2d_from_source_geometry_data(navpoly, source_geometry_data); + Ref source_geometry_data = NavigationMeshGenerator::get_singleton()->parse_2d_source_geometry_data(navigation_polygon, this); + NavigationMeshGenerator::get_singleton()->bake_2d_from_source_geometry_data(navigation_polygon, source_geometry_data); _bake_finished(); } } void NavigationPolygonInstance::_bake_finished() { baking_started = false; - set_navigation_polygon(navpoly); + set_navigation_polygon(navigation_polygon); emit_signal("bake_finished"); } @@ -344,14 +344,14 @@ void NavigationPolygonInstance::_navigation_polygon_changed() { if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) { update(); } - if (navpoly.is_valid()) { - Navigation2DServer::get_singleton()->region_set_navpoly(region, navpoly); + if (navigation_polygon.is_valid()) { + Navigation2DServer::get_singleton()->region_set_navigation_polygon(region, navigation_polygon); } _update_avoidance_constrain(); emit_signal("navigation_polygon_changed"); - _change_notify("navpoly"); + _change_notify("navigation_polygon"); update_configuration_warning(); } @@ -379,7 +379,7 @@ String NavigationPolygonInstance::get_configuration_warning() const { } String warning = Node2D::get_configuration_warning(); - if (!navpoly.is_valid()) { + if (!navigation_polygon.is_valid()) { if (warning != String()) { warning += "\n\n"; } @@ -415,7 +415,7 @@ void NavigationPolygonInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("set_travel_cost", "travel_cost"), &NavigationPolygonInstance::set_travel_cost); ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationPolygonInstance::get_travel_cost); - ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon); + ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navigation_polygon"), &NavigationPolygonInstance::set_navigation_polygon); ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon); ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationPolygonInstance::set_navigation_map); @@ -426,7 +426,7 @@ void NavigationPolygonInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("get_region_rid"), &NavigationPolygonInstance::get_region_rid); - 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::BOOL, "use_edge_connections"), "set_use_edge_connections", "get_use_edge_connections"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_2D_NAVIGATION), "set_navigation_layers", "get_navigation_layers"); @@ -505,15 +505,15 @@ void NavigationPolygonInstance::_update_avoidance_constrain() { return; } - Ref _navpoly = get_navigation_polygon(); - int _outline_count = _navpoly->get_outline_count(); + Ref _navigation_polygon = get_navigation_polygon(); + int _outline_count = _navigation_polygon->get_outline_count(); if (_outline_count == 0) { return; } for (int outline_index(0); outline_index < _outline_count; outline_index++) { - //TODO navpoly should probably use normal vectors internally - const PoolVector &_outline = _navpoly->get_outline(outline_index); + //TODO navigation_polygon should probably use normal vectors internally + const PoolVector &_outline = _navigation_polygon->get_outline(outline_index); Vector outline; outline.resize(_outline.size()); @@ -605,7 +605,7 @@ bool NavigationPolygonInstance::get_avoidance_layer_value(int p_layer_number) co #ifdef DEBUG_ENABLED void NavigationPolygonInstance::_update_debug_mesh() { - PoolVector navigation_polygon_vertices = navpoly->get_vertices(); + PoolVector navigation_polygon_vertices = navigation_polygon->get_vertices(); if (navigation_polygon_vertices.size() < 3) { return; } @@ -627,9 +627,9 @@ void NavigationPolygonInstance::_update_debug_mesh() { 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 polygon = navpoly->get_polygon(i); + Vector polygon = navigation_polygon->get_polygon(i); Vector debug_polygon_vertices; debug_polygon_vertices.resize(polygon.size()); diff --git a/scene/2d/navigation_polygon_instance.h b/scene/2d/navigation_polygon_instance.h index e0f9b4fdb..db704f039 100644 --- a/scene/2d/navigation_polygon_instance.h +++ b/scene/2d/navigation_polygon_instance.h @@ -47,7 +47,7 @@ class NavigationPolygonInstance : public Node2D { RID region; RID map_override; Navigation2D *navigation; - Ref navpoly; + Ref navigation_polygon; bool baking_started; real_t enter_cost; @@ -101,7 +101,7 @@ public: void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const; - void set_navigation_polygon(const Ref &p_navpoly); + void set_navigation_polygon(const Ref &p_navigation_polygon); Ref get_navigation_polygon() const; void set_constrain_avoidance(bool p_enabled); diff --git a/scene/3d/navigation_mesh_instance.cpp b/scene/3d/navigation_mesh_instance.cpp index 9ada906fb..917baefb3 100644 --- a/scene/3d/navigation_mesh_instance.cpp +++ b/scene/3d/navigation_mesh_instance.cpp @@ -245,21 +245,21 @@ void NavigationMeshInstance::_notification(int p_what) { } void NavigationMeshInstance::set_navigation_mesh(const Ref &p_navigation_mesh) { - if (navmesh.is_valid()) { - navmesh->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); + if (navigation_mesh.is_valid()) { + navigation_mesh->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); } - navmesh = p_navigation_mesh; + navigation_mesh = p_navigation_mesh; - if (navmesh.is_valid()) { - navmesh->connect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); + if (navigation_mesh.is_valid()) { + navigation_mesh->connect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); } _navigation_mesh_changed(); } Ref NavigationMeshInstance::get_navigation_mesh() const { - return navmesh; + return navigation_mesh; } void NavigationMeshInstance::set_navigation_map(RID p_navigation_map) { @@ -289,7 +289,7 @@ void NavigationMeshInstance::bake_navigation_mesh(bool p_on_thread) { } baking_started = true; - navmesh->clear(); + navigation_mesh->clear(); if (p_on_thread && OS::get_singleton()->can_use_threads()) { Ref f; @@ -297,22 +297,22 @@ void NavigationMeshInstance::bake_navigation_mesh(bool p_on_thread) { f->set_instance(this); f->set_function("_bake_finished"); - NavigationMeshGenerator::get_singleton()->parse_and_bake_3d(navmesh, this, f); + NavigationMeshGenerator::get_singleton()->parse_and_bake_3d(navigation_mesh, this, f); } else { - Ref source_geometry_data = NavigationMeshGenerator::get_singleton()->parse_3d_source_geometry_data(navmesh, this); - NavigationMeshGenerator::get_singleton()->bake_3d_from_source_geometry_data(navmesh, source_geometry_data); - _bake_finished(navmesh); + Ref source_geometry_data = NavigationMeshGenerator::get_singleton()->parse_3d_source_geometry_data(navigation_mesh, this); + NavigationMeshGenerator::get_singleton()->bake_3d_from_source_geometry_data(navigation_mesh, source_geometry_data); + _bake_finished(navigation_mesh); } } -void NavigationMeshInstance::_bake_finished(Ref p_nav_mesh) { +void NavigationMeshInstance::_bake_finished(Ref p_navigation_mesh) { baking_started = false; - set_navigation_mesh(p_nav_mesh); + set_navigation_mesh(p_navigation_mesh); emit_signal("bake_finished"); } void NavigationMeshInstance::_navigation_mesh_changed() { - NavigationServer::get_singleton()->region_set_navmesh(region, navmesh); + NavigationServer::get_singleton()->region_set_navigation_mesh(region, navigation_mesh); update_gizmos(); update_configuration_warning(); @@ -321,7 +321,7 @@ void NavigationMeshInstance::_navigation_mesh_changed() { #ifdef DEBUG_ENABLED if (is_inside_tree() && NavigationServer::get_singleton()->get_debug_navigation_enabled()) { - if (navmesh.is_valid()) { + if (navigation_mesh.is_valid()) { _update_debug_mesh(); _update_debug_edge_connections_mesh(); } else { @@ -349,7 +349,7 @@ String NavigationMeshInstance::get_configuration_warning() const { return String(); } - if (!navmesh.is_valid()) { + if (!navigation_mesh.is_valid()) { return TTR("A NavigationMesh resource must be set or created for this node to work."); } @@ -363,7 +363,7 @@ void NavigationMeshInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_edge_connections", "enabled"), &NavigationMeshInstance::set_use_edge_connections); ClassDB::bind_method(D_METHOD("get_use_edge_connections"), &NavigationMeshInstance::get_use_edge_connections); - ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navigation_mesh"), &NavigationMeshInstance::set_navigation_mesh); ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh); ClassDB::bind_method(D_METHOD("set_navigation_map", "navigation_map"), &NavigationMeshInstance::set_navigation_map); @@ -393,7 +393,7 @@ void NavigationMeshInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("_navigation_map_changed"), &NavigationMeshInstance::_navigation_map_changed); #endif - 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::BOOL, "use_edge_connections"), "set_use_edge_connections", "get_use_edge_connections"); ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers"); @@ -436,8 +436,8 @@ NavigationMeshInstance::NavigationMeshInstance() { } NavigationMeshInstance::~NavigationMeshInstance() { - if (navmesh.is_valid()) { - navmesh->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); + if (navigation_mesh.is_valid()) { + navigation_mesh->disconnect(CoreStringNames::get_singleton()->changed, this, "_navigation_mesh_changed"); } ERR_FAIL_NULL(NavigationServer::get_singleton()); @@ -480,7 +480,7 @@ void NavigationMeshInstance::_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); } @@ -497,12 +497,12 @@ void NavigationMeshInstance::_update_debug_mesh() { debug_mesh->clear_surfaces(); - PoolVector vertices = navmesh->get_vertices(); + PoolVector 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; } @@ -514,7 +514,7 @@ void NavigationMeshInstance::_update_debug_mesh() { int line_count = 0; for (int i = 0; i < polygon_count; i++) { - const Vector &polygon = navmesh->get_polygon(i); + const Vector &polygon = navigation_mesh->get_polygon(i); int polygon_size = polygon.size(); if (polygon_size < 3) { continue; @@ -549,7 +549,7 @@ void NavigationMeshInstance::_update_debug_mesh() { Vector3 *line_vertex_array_ptrw = line_vertex_array.ptrw(); for (int polygon_index = 0; polygon_index < polygon_count; polygon_index++) { - const Vector &polygon_indices = navmesh->get_polygon(polygon_index); + const Vector &polygon_indices = navigation_mesh->get_polygon(polygon_index); int polygon_indices_size = polygon_indices.size(); if (polygon_indices_size < 3) { continue; @@ -657,7 +657,7 @@ void NavigationMeshInstance::_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_mesh_instance.h b/scene/3d/navigation_mesh_instance.h index 638c26212..8289571fc 100644 --- a/scene/3d/navigation_mesh_instance.h +++ b/scene/3d/navigation_mesh_instance.h @@ -45,7 +45,7 @@ class NavigationMeshInstance : public Spatial { RID region; RID map_override; - Ref navmesh; + Ref navigation_mesh; Transform current_global_transform; @@ -94,7 +94,7 @@ public: void set_travel_cost(real_t p_travel_cost); real_t get_travel_cost() const; - void set_navigation_mesh(const Ref &p_navmesh); + void set_navigation_mesh(const Ref &p_navigation_mesh); Ref get_navigation_mesh() const; void set_navigation_map(RID p_navigation_map); @@ -105,7 +105,7 @@ public: /// Bakes the navigation mesh; once done, automatically /// sets the new navigation mesh and emits a signal void bake_navigation_mesh(bool p_on_thread = true); - void _bake_finished(Ref p_nav_mesh); + void _bake_finished(Ref p_navigation_mesh); void _navigation_mesh_changed(); String get_configuration_warning() const; diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index 9adabc885..7004c0f4a 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) { @@ -331,19 +331,19 @@ void NavigationMesh::commit_changes() { if (navigation_mesh_dirty) { navigation_mesh_dirty = false; /* - Vector new_navmesh_vertices; - Vector> new_navmesh_polygons; - new_navmesh_vertices.resize(vertices.size()); - new_navmesh_polygons.resize(polygons.size()); - Vector3 *new_navmesh_vertices_ptrw = new_navmesh_vertices.ptrw(); - Vector *new_navmesh_polygons_ptrw = new_navmesh_polygons.ptrw(); + Vector new_navigation_mesh_vertices; + Vector> new_navigation_mesh_polygons; + new_navigation_mesh_vertices.resize(vertices.size()); + new_navigation_mesh_polygons.resize(polygons.size()); + Vector3 *new_navigation_mesh_vertices_ptrw = new_navigation_mesh_vertices.ptrw(); + Vector *new_navigation_mesh_polygons_ptrw = new_navigation_mesh_polygons.ptrw(); for (int i = 0; i < vertices.size(); i++) { - new_navmesh_vertices_ptrw[i] = vertices[i]; + new_navigation_mesh_vertices_ptrw[i] = vertices[i]; } for (int i = 0; i < polygons.size(); i++) { - new_navmesh_polygons_ptrw[i] = polygons[i]; + new_navigation_mesh_polygons_ptrw[i] = polygons[i]; } - NavigationServer3D::get_singleton()->navmesh_set_data(navmesh_rid, new_navmesh_vertices, new_navmesh_polygons); + NavigationServer3D::get_singleton()->navigation_mesh_set_data(navigation_mesh_rid, new_navigation_mesh_vertices, new_navigation_mesh_polygons); */ emit_changed(); } @@ -376,8 +376,8 @@ Array NavigationMesh::_get_polygons() const { } RID NavigationMesh::get_rid() const { - if (navmesh_rid.is_valid()) { - return navmesh_rid; + if (navigation_mesh_rid.is_valid()) { + return navigation_mesh_rid; } return RID(); } @@ -526,8 +526,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); @@ -595,7 +595,7 @@ void NavigationMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "edge_max_error", PROPERTY_HINT_RANGE, "0.1,3.0,0.01,or_greater"), "set_edge_max_error", "get_edge_max_error"); ADD_GROUP("Polygons", "polygon_"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "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::REAL, "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::REAL, "detail_sample_distance", PROPERTY_HINT_RANGE, "0.1,16.0,0.01,or_greater"), "set_detail_sample_distance", "get_detail_sample_distance"); @@ -651,7 +651,7 @@ NavigationMesh::NavigationMesh() { region_merge_size = 20.0f; edge_max_length = 0.0f; edge_max_error = 1.3f; - verts_per_poly = 6.0f; + vertices_per_polyon = 6.0f; detail_sample_distance = 6.0f; detail_sample_max_error = 5.0f; @@ -659,18 +659,18 @@ NavigationMesh::NavigationMesh() { parsed_geometry_type = PARSED_GEOMETRY_MESH_INSTANCES; collision_mask = 0xFFFFFFFF; source_geometry_mode = SOURCE_GEOMETRY_ROOT_NODE_CHILDREN; - source_group_name = "navmesh"; + source_group_name = "navigation_mesh"; filter_low_hanging_obstacles = false; filter_ledge_spans = false; filter_walkable_low_height_spans = false; navigation_mesh_dirty = true; - //navmesh_rid = NavigationServer3D::get_singleton()->navmesh_create(); + //navigation_mesh_rid = NavigationServer3D::get_singleton()->navigation_mesh_create(); call_deferred("commit_changes"); } NavigationMesh::~NavigationMesh() { //ERR_FAIL_NULL(NavigationServer::get_singleton()); - //NavigationServer::get_singleton()->free(navmesh_rid); + //NavigationServer::get_singleton()->free(navigation_mesh_rid); } \ No newline at end of file diff --git a/scene/resources/navigation_mesh.h b/scene/resources/navigation_mesh.h index e0d5f102f..b8acef2b7 100644 --- a/scene/resources/navigation_mesh.h +++ b/scene/resources/navigation_mesh.h @@ -112,8 +112,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; @@ -178,7 +178,7 @@ protected: float region_merge_size; float edge_max_length; float edge_max_error; - float verts_per_poly; + float vertices_per_polyon; float detail_sample_distance; float detail_sample_max_error; @@ -196,7 +196,7 @@ protected: Vector3 filter_baking_aabb_offset; private: - RID navmesh_rid; + RID navigation_mesh_rid; PoolVector vertices; diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.h b/scene/resources/navigation_mesh_source_geometry_data_2d.h index 3400d9474..fb60e81d5 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_2d.h +++ b/scene/resources/navigation_mesh_source_geometry_data_2d.h @@ -55,7 +55,7 @@ public: // kept root node transform here on the geometry data // if we add this transform to all exposed functions we need to break comp on all functions later - // when navmesh changes from global transfrom to relative to navregion + // when navigation_mesh changes from global transfrom to relative to navregion // but if it stays here we can just remove it and change the internal functions only Transform2D root_node_transform; diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.h b/scene/resources/navigation_mesh_source_geometry_data_3d.h index e8cb4fb8f..11ae82a3f 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_3d.h +++ b/scene/resources/navigation_mesh_source_geometry_data_3d.h @@ -55,7 +55,7 @@ private: public: // kept root node transform here on the geometry data // if we add this transform to all exposed functions we need to break comp on all functions later - // when navmesh changes from global transfrom to relative to navregion + // when navigation_mesh changes from global transfrom to relative to navregion // but if it stays here we can just remove it and change the internal functions only Transform root_node_transform; diff --git a/scene/resources/navigation_polygon.h b/scene/resources/navigation_polygon.h index 79c36ef99..c6e5f7a9e 100644 --- a/scene/resources/navigation_polygon.h +++ b/scene/resources/navigation_polygon.h @@ -153,7 +153,7 @@ protected: static void _bind_methods(); private: - RID navmesh_rid; + RID navigation_mesh_rid; real_t agent_radius; diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 70bf0f20a..083264112 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -78,7 +78,7 @@ void Navigation2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("region_set_navigation_layers", "region", "navigation_layers"), &Navigation2DServer::region_set_navigation_layers); ClassDB::bind_method(D_METHOD("region_get_navigation_layers", "region"), &Navigation2DServer::region_get_navigation_layers); ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &Navigation2DServer::region_set_transform); - ClassDB::bind_method(D_METHOD("region_set_navpoly", "region", "nav_poly"), &Navigation2DServer::region_set_navpoly); + ClassDB::bind_method(D_METHOD("region_set_navigation_polygon", "region", "nav_poly"), &Navigation2DServer::region_set_navigation_polygon); ClassDB::bind_method(D_METHOD("region_get_connections_count", "region"), &Navigation2DServer::region_get_connections_count); ClassDB::bind_method(D_METHOD("region_get_connection_pathway_start", "region", "connection"), &Navigation2DServer::region_get_connection_pathway_start); ClassDB::bind_method(D_METHOD("region_get_connection_pathway_end", "region", "connection"), &Navigation2DServer::region_get_connection_pathway_end); diff --git a/servers/navigation_2d_server.h b/servers/navigation_2d_server.h index 8c9f92c75..40be2a391 100644 --- a/servers/navigation_2d_server.h +++ b/servers/navigation_2d_server.h @@ -134,7 +134,7 @@ public: virtual void region_set_transform(RID p_region, Transform2D p_transform) = 0; /// Set the navigation poly of this region. - virtual void region_set_navpoly(RID p_region, Ref p_nav_mesh) = 0; + virtual void region_set_navigation_polygon(RID p_region, Ref p_navigation_mesh) = 0; /// Get a list of a region's connection to other regions. virtual int region_get_connections_count(RID p_region) const = 0; diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index 75ceb618e..526a449a0 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -99,7 +99,7 @@ void NavigationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("region_get_navigation_layers", "region"), &NavigationServer::region_get_navigation_layers); ClassDB::bind_method(D_METHOD("region_set_transform", "region", "transform"), &NavigationServer::region_set_transform); - ClassDB::bind_method(D_METHOD("region_set_navmesh", "region", "nav_mesh"), &NavigationServer::region_set_navmesh); + ClassDB::bind_method(D_METHOD("region_set_navigation_mesh", "region", "navigation_mesh"), &NavigationServer::region_set_navigation_mesh); ClassDB::bind_method(D_METHOD("region_get_connections_count", "region"), &NavigationServer::region_get_connections_count); ClassDB::bind_method(D_METHOD("region_get_connection_pathway_start", "region", "connection"), &NavigationServer::region_get_connection_pathway_start); @@ -241,7 +241,7 @@ NavigationServer::NavigationServer() { _debug_navigation_avoidance_enable_obstacles_static = GLOBAL_DEF("debug/shapes/avoidance/enable_obstacles_static", true); if (Engine::get_singleton()->is_editor_hint()) { - // enable NavigationServer when in Editor or else navmesh edge connections are invisible + // enable NavigationServer when in Editor or else navigation_mesh edge connections are invisible // on runtime tests SceneTree has "Visible Navigation" set and main iteration takes care of this set_debug_enabled(true); set_debug_navigation_enabled(true); diff --git a/servers/navigation_server.h b/servers/navigation_server.h index d447bc134..12c7603e7 100644 --- a/servers/navigation_server.h +++ b/servers/navigation_server.h @@ -150,7 +150,7 @@ public: virtual void region_set_transform(RID p_region, Transform p_transform) = 0; /// Set the navigation mesh of this region. - virtual void region_set_navmesh(RID p_region, Ref p_nav_mesh) = 0; + virtual void region_set_navigation_mesh(RID p_region, Ref p_navigation_mesh) = 0; /// Get a list of a region's connection to other regions. virtual int region_get_connections_count(RID p_region) const = 0;