summaryrefslogtreecommitdiff
path: root/scene/3d/navigation_region_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/navigation_region_3d.cpp')
-rw-r--r--scene/3d/navigation_region_3d.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index b15fa6166f..bc13b7097f 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -36,7 +36,6 @@
#include "servers/navigation_server_3d.h"
void NavigationRegion3D::set_enabled(bool p_enabled) {
-
if (enabled == p_enabled)
return;
enabled = p_enabled;
@@ -45,12 +44,9 @@ void NavigationRegion3D::set_enabled(bool p_enabled) {
return;
if (!enabled) {
-
NavigationServer3D::get_singleton()->region_set_map(region, RID());
} else {
-
if (navigation) {
-
NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
}
}
@@ -68,25 +64,19 @@ void NavigationRegion3D::set_enabled(bool p_enabled) {
}
bool NavigationRegion3D::is_enabled() const {
-
return enabled;
}
/////////////////////////////
void NavigationRegion3D::_notification(int p_what) {
-
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
-
Node3D *c = this;
while (c) {
-
navigation = Object::cast_to<Navigation3D>(c);
if (navigation) {
-
if (enabled) {
-
NavigationServer3D::get_singleton()->region_set_map(region, navigation->get_rid());
}
break;
@@ -96,7 +86,6 @@ void NavigationRegion3D::_notification(int p_what) {
}
if (navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) {
-
MeshInstance3D *dm = memnew(MeshInstance3D);
dm->set_mesh(navmesh->get_debug_mesh());
if (is_enabled()) {
@@ -110,14 +99,11 @@ void NavigationRegion3D::_notification(int p_what) {
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
-
NavigationServer3D::get_singleton()->region_set_transform(region, get_global_transform());
} break;
case NOTIFICATION_EXIT_TREE: {
-
if (navigation) {
-
NavigationServer3D::get_singleton()->region_set_map(region, RID());
}
@@ -131,7 +117,6 @@ void NavigationRegion3D::_notification(int p_what) {
}
void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh) {
-
if (p_navmesh == navmesh)
return;
@@ -158,7 +143,6 @@ void NavigationRegion3D::set_navigation_mesh(const Ref<NavigationMesh> &p_navmes
}
Ref<NavigationMesh> NavigationRegion3D::get_navigation_mesh() const {
-
return navmesh;
}
@@ -176,7 +160,6 @@ void _bake_navigation_mesh(void *p_user_data) {
args->nav_region->call_deferred("_bake_finished", nav_mesh);
memdelete(args);
} else {
-
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
args->nav_region->call_deferred("_bake_finished", Ref<NavigationMesh>());
memdelete(args);
@@ -199,7 +182,6 @@ void NavigationRegion3D::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
}
String NavigationRegion3D::get_configuration_warning() const {
-
if (!is_visible_in_tree() || !is_inside_tree())
return String();
@@ -208,7 +190,6 @@ String NavigationRegion3D::get_configuration_warning() const {
}
const Node3D *c = this;
while (c) {
-
if (Object::cast_to<Navigation3D>(c))
return String();
@@ -219,7 +200,6 @@ String NavigationRegion3D::get_configuration_warning() const {
}
void NavigationRegion3D::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationRegion3D::set_navigation_mesh);
ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationRegion3D::get_navigation_mesh);