summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/navigation_polygon.cpp36
-rw-r--r--scene/2d/navigation_polygon.h8
-rw-r--r--scene/3d/navigation_region.h6
-rw-r--r--scene/register_scene_types.cpp5
-rw-r--r--scene/resources/world_margin_shape.h6
5 files changed, 32 insertions, 29 deletions
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 6754c1c9a6..19ac4ccee8 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -370,7 +370,7 @@ NavigationPolygon::~NavigationPolygon() {
memdelete(navmesh_generation);
}
-void NavigationPolygonInstance::set_enabled(bool p_enabled) {
+void NavigationRegion2D::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
return;
@@ -394,25 +394,25 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
update();
}
-bool NavigationPolygonInstance::is_enabled() const {
+bool NavigationRegion2D::is_enabled() const {
return enabled;
}
/////////////////////////////
#ifdef TOOLS_ENABLED
-Rect2 NavigationPolygonInstance::_edit_get_rect() const {
+Rect2 NavigationRegion2D::_edit_get_rect() const {
return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2();
}
-bool NavigationPolygonInstance::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
+bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
return navpoly.is_valid() ? navpoly->_edit_is_selected_on_click(p_point, p_tolerance) : false;
}
#endif
-void NavigationPolygonInstance::_notification(int p_what) {
+void NavigationRegion2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -496,7 +496,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
}
}
-void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) {
+void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) {
if (p_navpoly == navpoly) {
return;
@@ -518,18 +518,18 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolyg
update_configuration_warning();
}
-Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const {
+Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const {
return navpoly;
}
-void NavigationPolygonInstance::_navpoly_changed() {
+void NavigationRegion2D::_navpoly_changed() {
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
update();
}
-String NavigationPolygonInstance::get_configuration_warning() const {
+String NavigationRegion2D::get_configuration_warning() const {
if (!is_visible_in_tree() || !is_inside_tree())
return String();
@@ -547,24 +547,24 @@ String NavigationPolygonInstance::get_configuration_warning() const {
c = Object::cast_to<Node2D>(c->get_parent());
}
- return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
+ return TTR("NavigationRegion2D must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
}
-void NavigationPolygonInstance::_bind_methods() {
+void NavigationRegion2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon);
- ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon);
+ ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationRegion2D::set_navigation_polygon);
+ ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationRegion2D::get_navigation_polygon);
- ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled);
- ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationPolygonInstance::is_enabled);
+ ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion2D::set_enabled);
+ ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion2D::is_enabled);
- ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationPolygonInstance::_navpoly_changed);
+ ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
}
-NavigationPolygonInstance::NavigationPolygonInstance() {
+NavigationRegion2D::NavigationRegion2D() {
enabled = true;
set_notify_transform(true);
@@ -573,6 +573,6 @@ NavigationPolygonInstance::NavigationPolygonInstance() {
navigation = NULL;
}
-NavigationPolygonInstance::~NavigationPolygonInstance() {
+NavigationRegion2D::~NavigationRegion2D() {
Navigation2DServer::get_singleton()->free(region);
}
diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h
index 557ce4b3e7..ac7ec58021 100644
--- a/scene/2d/navigation_polygon.h
+++ b/scene/2d/navigation_polygon.h
@@ -96,9 +96,9 @@ public:
class Navigation2D;
-class NavigationPolygonInstance : public Node2D {
+class NavigationRegion2D : public Node2D {
- GDCLASS(NavigationPolygonInstance, Node2D);
+ GDCLASS(NavigationRegion2D, Node2D);
bool enabled;
RID region;
@@ -125,8 +125,8 @@ public:
String get_configuration_warning() const;
- NavigationPolygonInstance();
- ~NavigationPolygonInstance();
+ NavigationRegion2D();
+ ~NavigationRegion2D();
};
#endif // NAVIGATIONPOLYGON_H
diff --git a/scene/3d/navigation_region.h b/scene/3d/navigation_region.h
index c6b2ea350f..f215e92c97 100644
--- a/scene/3d/navigation_region.h
+++ b/scene/3d/navigation_region.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef navigation_region_H
-#define navigation_region_H
+#ifndef NAVIGATION_REGION_H
+#define NAVIGATION_REGION_H
#include "scene/3d/spatial.h"
#include "scene/resources/mesh.h"
@@ -72,4 +72,4 @@ public:
~NavigationRegion();
};
-#endif // navigation_region_H
+#endif // NAVIGATION_REGION_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index ae365a5064..dd00565929 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -726,7 +726,7 @@ void register_scene_types() {
ClassDB::register_class<Navigation2D>();
ClassDB::register_class<NavigationPolygon>();
- ClassDB::register_class<NavigationPolygonInstance>();
+ ClassDB::register_class<NavigationRegion2D>();
ClassDB::register_class<NavigationAgent2D>();
ClassDB::register_class<NavigationObstacle2D>();
@@ -746,6 +746,9 @@ void register_scene_types() {
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
+ ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion");
+ ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
+ ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape");
#endif
OS::get_singleton()->yield(); //may take time to init
diff --git a/scene/resources/world_margin_shape.h b/scene/resources/world_margin_shape.h
index 055107c956..78ea570212 100644
--- a/scene/resources/world_margin_shape.h
+++ b/scene/resources/world_margin_shape.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef world_margin_shape_H
-#define world_margin_shape_H
+#ifndef WORLD_MARGIN_SHAPE_H
+#define WORLD_MARGIN_SHAPE_H
#include "scene/resources/shape.h"
@@ -54,4 +54,4 @@ public:
WorldMarginShape();
};
-#endif // world_margin_shape_H
+#endif // WORLD_MARGIN_SHAPE_H