diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml
index 0000ca6bd57..93170bca4a8 100644
--- a/doc/classes/Navigation.xml
+++ b/doc/classes/Navigation.xml
@@ -4,7 +4,7 @@
Mesh-based navigation and pathfinding node.
- Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationMeshInstance] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
+ Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationRegion.xml
similarity index 75%
rename from doc/classes/NavigationMeshInstance.xml
rename to doc/classes/NavigationRegion.xml
index 75bd62e2784..41fac706540 100644
--- a/doc/classes/NavigationMeshInstance.xml
+++ b/doc/classes/NavigationRegion.xml
@@ -1,10 +1,10 @@
-
+
- An instance of a [NavigationMesh].
+ A region of the navigation map.
- An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node.
+ A region of the navigation map. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node (even not a direct child).
@@ -19,7 +19,7 @@
- Determines if the [NavigationMeshInstance] is enabled or disabled.
+ Determines if the [NavigationRegion] is enabled or disabled.
The [NavigationMesh] resource to use.
diff --git a/editor/icons/NavigationMeshInstance.svg b/editor/icons/NavigationMeshInstance.svg
deleted file mode 100644
index 737d9c319df..00000000000
--- a/editor/icons/NavigationMeshInstance.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/editor/icons/NavigationRegion.svg b/editor/icons/NavigationRegion.svg
new file mode 100644
index 00000000000..92cc9afd913
--- /dev/null
+++ b/editor/icons/NavigationRegion.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 9fb6be50d9c..dbd67d1e229 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -559,7 +559,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map[
Ref mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), NULL);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_name(_fixstr(name, "navmesh"));
Ref nmesh = memnew(NavigationMesh);
diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp
index 37cf16de58e..c285bb4e1ae 100644
--- a/editor/plugins/mesh_instance_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "editor/editor_scale.h"
#include "scene/3d/collision_shape.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
@@ -233,7 +233,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
nmesh->create_from_mesh(mesh);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_navigation_mesh(nmesh);
Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index ea8842a56f6..863ea451b5b 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -34,7 +34,7 @@
#include "editor/editor_settings.h"
#include "main/main.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
@@ -152,9 +152,9 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library,
Transform navmesh_transform;
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
- if (!Object::cast_to(child2))
+ if (!Object::cast_to(child2))
continue;
- NavigationMeshInstance *sb = Object::cast_to(child2);
+ NavigationRegion *sb = Object::cast_to(child2);
navmesh = sb->get_navigation_mesh();
navmesh_transform = sb->get_transform();
if (!navmesh.is_null())
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 40e1be665c7..f2406544870 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -41,7 +41,7 @@
#include "scene/3d/light.h"
#include "scene/3d/listener.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/particles.h"
#include "scene/3d/physics_joint.h"
#include "scene/3d/position_3d.h"
@@ -3720,11 +3720,11 @@ NavigationMeshSpatialGizmoPlugin::NavigationMeshSpatialGizmoPlugin() {
}
bool NavigationMeshSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
- return Object::cast_to(p_spatial) != NULL;
+ return Object::cast_to(p_spatial) != NULL;
}
String NavigationMeshSpatialGizmoPlugin::get_name() const {
- return "NavigationMeshInstance";
+ return "NavigationRegion";
}
int NavigationMeshSpatialGizmoPlugin::get_priority() const {
@@ -3733,7 +3733,7 @@ int NavigationMeshSpatialGizmoPlugin::get_priority() const {
void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
- NavigationMeshInstance *navmesh = Object::cast_to(p_gizmo->get_spatial_node());
+ NavigationRegion *navmesh = Object::cast_to(p_gizmo->get_spatial_node());
Ref edge_material = get_material("navigation_edge_material", p_gizmo);
Ref edge_material_disabled = get_material("navigation_edge_material_disabled", p_gizmo);
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
index 28fe0bfd06c..4ab90ac7ebe 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
@@ -84,7 +84,7 @@ void NavigationMeshEditor::_clear_pressed() {
}
}
-void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) {
+void NavigationMeshEditor::edit(NavigationRegion *p_nav_mesh_instance) {
if (p_nav_mesh_instance == NULL || node == p_nav_mesh_instance) {
return;
@@ -128,12 +128,12 @@ NavigationMeshEditor::~NavigationMeshEditor() {
void NavigationMeshEditorPlugin::edit(Object *p_object) {
- navigation_mesh_editor->edit(Object::cast_to(p_object));
+ navigation_mesh_editor->edit(Object::cast_to(p_object));
}
bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("NavigationMeshInstance");
+ return p_object->is_class("NavigationRegion");
}
void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.h b/modules/gdnavigation/navigation_mesh_editor_plugin.h
index f5833f3d7ff..7c3faebf577 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.h
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.h
@@ -36,7 +36,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
-class NavigationMeshInstance;
+class NavigationRegion;
class NavigationMeshEditor : public Control {
friend class NavigationMeshEditorPlugin;
@@ -50,7 +50,7 @@ class NavigationMeshEditor : public Control {
ToolButton *button_reset;
Label *bake_info;
- NavigationMeshInstance *node;
+ NavigationRegion *node;
void _bake_pressed();
void _clear_pressed();
@@ -61,7 +61,7 @@ protected:
void _notification(int p_option);
public:
- void edit(NavigationMeshInstance *p_nav_mesh_instance);
+ void edit(NavigationRegion *p_nav_mesh_instance);
NavigationMeshEditor();
~NavigationMeshEditor();
};
diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h
index 27a56e1d7ad..d1f2e4b56f1 100644
--- a/modules/gdnavigation/navigation_mesh_generator.h
+++ b/modules/gdnavigation/navigation_mesh_generator.h
@@ -33,7 +33,7 @@
#ifndef _3D_DISABLED
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include
diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h
index 85887651fff..08f306611f6 100644
--- a/scene/3d/navigation.h
+++ b/scene/3d/navigation.h
@@ -31,7 +31,7 @@
#ifndef NAVIGATION_H
#define NAVIGATION_H
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/spatial.h"
class Navigation : public Spatial {
diff --git a/scene/3d/navigation_mesh_instance.cpp b/scene/3d/navigation_region.cpp
similarity index 84%
rename from scene/3d/navigation_mesh_instance.cpp
rename to scene/3d/navigation_region.cpp
index 8f8574ba2de..d96d0957976 100644
--- a/scene/3d/navigation_mesh_instance.cpp
+++ b/scene/3d/navigation_region.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* navigation_mesh_instance.cpp */
+/* navigation_region.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,13 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "navigation_mesh_instance.h"
+#include "navigation_region.h"
#include "core/os/thread.h"
#include "mesh_instance.h"
#include "navigation.h"
#include "servers/navigation_server.h"
-void NavigationMeshInstance::set_enabled(bool p_enabled) {
+void NavigationRegion::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
return;
@@ -66,14 +66,14 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
update_gizmo();
}
-bool NavigationMeshInstance::is_enabled() const {
+bool NavigationRegion::is_enabled() const {
return enabled;
}
/////////////////////////////
-void NavigationMeshInstance::_notification(int p_what) {
+void NavigationRegion::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -129,7 +129,7 @@ void NavigationMeshInstance::_notification(int p_what) {
}
}
-void NavigationMeshInstance::set_navigation_mesh(const Ref &p_navmesh) {
+void NavigationRegion::set_navigation_mesh(const Ref &p_navmesh) {
if (p_navmesh == navmesh)
return;
@@ -156,13 +156,13 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref &p_na
update_configuration_warning();
}
-Ref NavigationMeshInstance::get_navigation_mesh() const {
+Ref NavigationRegion::get_navigation_mesh() const {
return navmesh;
}
struct BakeThreadsArgs {
- NavigationMeshInstance *nav_mesh_instance;
+ NavigationRegion *nav_mesh_instance;
};
void _bake_navigation_mesh(void *p_user_data) {
@@ -182,7 +182,7 @@ void _bake_navigation_mesh(void *p_user_data) {
}
}
-void NavigationMeshInstance::bake_navigation_mesh() {
+void NavigationRegion::bake_navigation_mesh() {
ERR_FAIL_COND(bake_thread != NULL);
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
@@ -192,12 +192,12 @@ void NavigationMeshInstance::bake_navigation_mesh() {
ERR_FAIL_COND(bake_thread == NULL);
}
-void NavigationMeshInstance::_bake_finished(Ref p_nav_mesh) {
+void NavigationRegion::_bake_finished(Ref p_nav_mesh) {
set_navigation_mesh(p_nav_mesh);
bake_thread = NULL;
}
-String NavigationMeshInstance::get_configuration_warning() const {
+String NavigationRegion::get_configuration_warning() const {
if (!is_visible_in_tree() || !is_inside_tree())
return String();
@@ -214,19 +214,19 @@ String NavigationMeshInstance::get_configuration_warning() const {
c = Object::cast_to(c->get_parent());
}
- return TTR("NavigationMeshInstance must be a child or grandchild to a Navigation node. It only provides navigation data.");
+ return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data.");
}
-void NavigationMeshInstance::_bind_methods() {
+void NavigationRegion::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh);
- ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationRegion::set_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationRegion::get_navigation_mesh);
- ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled);
- ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled);
+ ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion::set_enabled);
+ ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion::is_enabled);
- ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationMeshInstance::bake_navigation_mesh);
- ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationMeshInstance::_bake_finished);
+ ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationRegion::bake_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationRegion::_bake_finished);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"), "set_navigation_mesh", "get_navigation_mesh");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
@@ -235,12 +235,12 @@ void NavigationMeshInstance::_bind_methods() {
ADD_SIGNAL(MethodInfo("bake_finished"));
}
-void NavigationMeshInstance::_changed_callback(Object *p_changed, const char *p_prop) {
+void NavigationRegion::_changed_callback(Object *p_changed, const char *p_prop) {
update_gizmo();
update_configuration_warning();
}
-NavigationMeshInstance::NavigationMeshInstance() {
+NavigationRegion::NavigationRegion() {
enabled = true;
set_notify_transform(true);
@@ -251,7 +251,7 @@ NavigationMeshInstance::NavigationMeshInstance() {
bake_thread = NULL;
}
-NavigationMeshInstance::~NavigationMeshInstance() {
+NavigationRegion::~NavigationRegion() {
if (navmesh.is_valid())
navmesh->remove_change_receptor(this);
NavigationServer::get_singleton()->free(region);
diff --git a/scene/3d/navigation_mesh_instance.h b/scene/3d/navigation_region.h
similarity index 90%
rename from scene/3d/navigation_mesh_instance.h
rename to scene/3d/navigation_region.h
index 1135bf47d20..c6b2ea350ff 100644
--- a/scene/3d/navigation_mesh_instance.h
+++ b/scene/3d/navigation_region.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* navigation_mesh_instance.h */
+/* navigation_region.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef NAVIGATION_MESH_INSTANCE_H
-#define NAVIGATION_MESH_INSTANCE_H
+#ifndef navigation_region_H
+#define navigation_region_H
#include "scene/3d/spatial.h"
#include "scene/resources/mesh.h"
@@ -37,9 +37,9 @@
class Navigation;
-class NavigationMeshInstance : public Spatial {
+class NavigationRegion : public Spatial {
- GDCLASS(NavigationMeshInstance, Spatial);
+ GDCLASS(NavigationRegion, Spatial);
bool enabled;
RID region;
@@ -68,8 +68,8 @@ public:
String get_configuration_warning() const;
- NavigationMeshInstance();
- ~NavigationMeshInstance();
+ NavigationRegion();
+ ~NavigationRegion();
};
-#endif // NAVIGATION_MESH_INSTANCE_H
+#endif // navigation_region_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 6288598ce2b..f11d0a21d46 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -190,7 +190,7 @@
#include "scene/3d/multimesh_instance.h"
#include "scene/3d/navigation.h"
#include "scene/3d/navigation_agent.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/navigation_obstacle.h"
#include "scene/3d/particles.h"
#include "scene/3d/path.h"
@@ -470,7 +470,7 @@ void register_scene_types() {
ClassDB::register_class();
ClassDB::register_class();
- ClassDB::register_class();
+ ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h
index 9155975f478..b256e86b966 100644
--- a/scene/resources/mesh_library.h
+++ b/scene/resources/mesh_library.h
@@ -34,7 +34,7 @@
#include "core/map.h"
#include "core/resource.h"
#include "mesh.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "shape.h"
class MeshLibrary : public Resource {
diff --git a/servers/navigation_server.h b/servers/navigation_server.h
index 2587e53ab27..7c9b6ba5951 100644
--- a/servers/navigation_server.h
+++ b/servers/navigation_server.h
@@ -37,7 +37,7 @@
#include "core/object.h"
#include "core/rid.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
/// This server uses the concept of internal mutability.
/// All the constant functions can be called in multithread because internally
]