diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml index 1dfe7317f..8c8f8bbe9 100644 --- a/doc/classes/Navigation2D.xml +++ b/doc/classes/Navigation2D.xml @@ -4,7 +4,7 @@ 2D navigation and pathfinding node. - Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. By default, these are automatically collected from child [NavigationRegion2D] nodes. + Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. By default, these are automatically collected from child [NavigationPolygonInstance] nodes. https://godotengine.org/asset-library/asset/117 @@ -21,7 +21,7 @@ - Returns the owner of the [NavigationPolygon] which contains the navigation point closest to the point given. This is usually a [NavigationRegion2D]. + Returns the owner of the [NavigationPolygon] which contains the navigation point closest to the point given. This is usually a [NavigationPolygonInstance]. diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationPolygonInstance.xml index 669e4e23a..acf8d813c 100644 --- a/doc/classes/NavigationPolygonInstance.xml +++ b/doc/classes/NavigationPolygonInstance.xml @@ -1,5 +1,5 @@ - + A region of the 2D navigation map. @@ -18,13 +18,13 @@ - Returns the [RID] of this region on the [Navigation2DServer]. Combined with [method Navigation2DServer.map_get_closest_point_owner] can be used to identify the [NavigationRegion2D] closest to a point on the merged navigation map. + Returns the [RID] of this region on the [Navigation2DServer]. Combined with [method Navigation2DServer.map_get_closest_point_owner] can be used to identify the [NavigationPolygonInstance] closest to a point on the merged navigation map. - Determines if the [NavigationRegion2D] is enabled or disabled. + 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. diff --git a/doc/classes/NavigationRegion2D.xml b/doc/classes/NavigationRegion2D.xml index 6c972689f..6c1fab3b5 100644 --- a/doc/classes/NavigationRegion2D.xml +++ b/doc/classes/NavigationRegion2D.xml @@ -11,7 +11,7 @@ var outline = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) polygon.add_outline(outline) polygon.make_polygons_from_outlines() - $NavigationRegion2D.navpoly = polygon + $NavigationPolygonInstance.navpoly = polygon [/codeblock] Using [method add_polygon] and indices of the vertices array. [codeblock] @@ -20,7 +20,7 @@ polygon.set_vertices(vertices) var indices = PoolIntArray([0, 1, 2, 3]) polygon.add_polygon(indices) - $NavigationRegion2D.navpoly = polygon + $NavigationPolygonInstance.navpoly = polygon [/codeblock] diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index a66212324..5e3adb9b9 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -35748,7 +35748,7 @@ msgid "" "Navigation2DServer.map_get_path] instead.\n" "Navigation2D provides navigation and pathfinding within a 2D area, specified " "as a collection of [NavigationPolygon] resources. By default, these are " -"automatically collected from child [NavigationRegion2D] nodes." +"automatically collected from child [NavigationPolygonInstance] nodes." msgstr "" #: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml @@ -35760,7 +35760,7 @@ msgstr "" msgid "" "Returns the owner of the [NavigationPolygon] which contains the navigation " "point closest to the point given. This is usually a " -"[NavigationRegion2D]." +"[NavigationPolygonInstance]." msgstr "" #: doc/classes/Navigation2D.xml @@ -36781,7 +36781,7 @@ msgid "Determines if the [NavigationMeshInstance] is enabled or disabled." msgstr "" #: doc/classes/NavigationMeshInstance.xml -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "When pathfinding enters this region's navmesh from another regions navmesh " "the [code]enter_cost[/code] value is added to the path distance for " @@ -36801,7 +36801,7 @@ msgid "The [NavigationMesh] resource to use." msgstr "" #: doc/classes/NavigationMeshInstance.xml -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "When pathfinding moves inside this region's navmesh the traveled distances " "are multiplied with [code]travel_cost[/code] for determining the shortest " @@ -36905,7 +36905,7 @@ msgid "" "50), Vector2(50, 0)])\n" "polygon.add_outline(outline)\n" "polygon.make_polygons_from_outlines()\n" -"$NavigationRegion2D.navpoly = polygon\n" +"$NavigationPolygonInstance.navpoly = polygon\n" "[/codeblock]\n" "Using [method add_polygon] and indices of the vertices array.\n" "[codeblock]\n" @@ -36915,7 +36915,7 @@ msgid "" "polygon.set_vertices(vertices)\n" "var indices = PoolIntArray([0, 1, 2, 3])\n" "polygon.add_polygon(indices)\n" -"$NavigationRegion2D.navpoly = polygon\n" +"$NavigationPolygonInstance.navpoly = polygon\n" "[/codeblock]" msgstr "" @@ -36992,11 +36992,11 @@ msgid "" "[method make_polygons_from_outlines] for the polygons to update." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "A region of the 2D navigation map." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "A region of the navigation map. It tells the [Navigation2DServer] what can " "be navigated and what cannot, based on its [NavigationPolygon] resource.\n" @@ -37016,19 +37016,19 @@ msgid "" "controlled with the [member travel_cost] multiplier." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "Returns the [RID] of this region on the [Navigation2DServer]. Combined with " "[method Navigation2DServer.map_get_closest_point_owner] can be used to " -"identify the [NavigationRegion2D] closest to a point on the merged " +"identify the [NavigationPolygonInstance] closest to a point on the merged " "navigation map." msgstr "" -#: doc/classes/NavigationRegion2D.xml -msgid "Determines if the [NavigationRegion2D] is enabled or disabled." +#: doc/classes/NavigationPolygonInstance.xml +msgid "Determines if the [NavigationPolygonInstance] is enabled or disabled." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "A bitfield determining all navigation map layers the [NavigationPolygon] " "belongs to. On path requests with [method Navigation2DServer.map_get_path] " @@ -37036,7 +37036,7 @@ msgid "" "will only proximity merge different navmeshes with matching layers." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "The [NavigationPolygon] resource to use." msgstr "" diff --git a/doc/translations/hu.po b/doc/translations/hu.po index 252e067e4..d7273a09d 100644 --- a/doc/translations/hu.po +++ b/doc/translations/hu.po @@ -35825,7 +35825,7 @@ msgid "" "Navigation2DServer.map_get_path] instead.\n" "Navigation2D provides navigation and pathfinding within a 2D area, specified " "as a collection of [NavigationPolygon] resources. By default, these are " -"automatically collected from child [NavigationRegion2D] nodes." +"automatically collected from child [NavigationPolygonInstance] nodes." msgstr "" #: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml @@ -35837,7 +35837,7 @@ msgstr "" msgid "" "Returns the owner of the [NavigationPolygon] which contains the navigation " "point closest to the point given. This is usually a " -"[NavigationRegion2D]." +"[NavigationPolygonInstance]." msgstr "" #: doc/classes/Navigation2D.xml @@ -36864,7 +36864,7 @@ msgid "Determines if the [NavigationMeshInstance] is enabled or disabled." msgstr "" #: doc/classes/NavigationMeshInstance.xml -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "When pathfinding enters this region's navmesh from another regions navmesh " "the [code]enter_cost[/code] value is added to the path distance for " @@ -36884,7 +36884,7 @@ msgid "The [NavigationMesh] resource to use." msgstr "" #: doc/classes/NavigationMeshInstance.xml -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "When pathfinding moves inside this region's navmesh the traveled distances " "are multiplied with [code]travel_cost[/code] for determining the shortest " @@ -36988,7 +36988,7 @@ msgid "" "50), Vector2(50, 0)])\n" "polygon.add_outline(outline)\n" "polygon.make_polygons_from_outlines()\n" -"$NavigationRegion2D.navpoly = polygon\n" +"$NavigationPolygonInstance.navpoly = polygon\n" "[/codeblock]\n" "Using [method add_polygon] and indices of the vertices array.\n" "[codeblock]\n" @@ -36998,7 +36998,7 @@ msgid "" "polygon.set_vertices(vertices)\n" "var indices = PoolIntArray([0, 1, 2, 3])\n" "polygon.add_polygon(indices)\n" -"$NavigationRegion2D.navpoly = polygon\n" +"$NavigationPolygonInstance.navpoly = polygon\n" "[/codeblock]" msgstr "" @@ -37075,11 +37075,11 @@ msgid "" "[method make_polygons_from_outlines] for the polygons to update." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "A region of the 2D navigation map." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "A region of the navigation map. It tells the [Navigation2DServer] what can " "be navigated and what cannot, based on its [NavigationPolygon] resource.\n" @@ -37099,19 +37099,19 @@ msgid "" "controlled with the [member travel_cost] multiplier." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "Returns the [RID] of this region on the [Navigation2DServer]. Combined with " "[method Navigation2DServer.map_get_closest_point_owner] can be used to " -"identify the [NavigationRegion2D] closest to a point on the merged " +"identify the [NavigationPolygonInstance] closest to a point on the merged " "navigation map." msgstr "" -#: doc/classes/NavigationRegion2D.xml -msgid "Determines if the [NavigationRegion2D] is enabled or disabled." +#: doc/classes/NavigationPolygonInstance.xml +msgid "Determines if the [NavigationPolygonInstance] is enabled or disabled." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "" "A bitfield determining all navigation map layers the [NavigationPolygon] " "belongs to. On path requests with [method Navigation2DServer.map_get_path] " @@ -37119,7 +37119,7 @@ msgid "" "will only proximity merge different navmeshes with matching layers." msgstr "" -#: doc/classes/NavigationRegion2D.xml +#: doc/classes/NavigationPolygonInstance.xml msgid "The [NavigationPolygon] resource to use." msgstr "" diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp index 1034eed35..741958aaf 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "core/object/undo_redo.h" #include "core/string/ustring.h" #include "core/containers/vector.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "scene/resources/navigation_polygon.h" #include "scene/main/node.h" @@ -56,7 +56,7 @@ Node2D *NavigationPolygonEditor::_get_node() const { } void NavigationPolygonEditor::_set_node(Node *p_polygon) { - node = Object::cast_to(p_polygon); + node = Object::cast_to(p_polygon); } int NavigationPolygonEditor::_get_polygon_count() const { @@ -130,5 +130,5 @@ NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) : } NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) : - AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationRegion2D") { + AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") { } diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h index 4e6e624cd..62be87ced 100644 --- a/editor/plugins/navigation_polygon_editor_plugin.h +++ b/editor/plugins/navigation_polygon_editor_plugin.h @@ -38,14 +38,14 @@ class EditorNode; class NavigationPolygon; -class NavigationRegion2D; +class NavigationPolygonInstance; class Node2D; class Node; class NavigationPolygonEditor : public AbstractPolygon2DEditor { GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor); - NavigationRegion2D *node; + NavigationPolygonInstance *node; Ref _ensure_navpoly() const; 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 1369dff6f..3a5d94ac7 100644 --- a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp +++ b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.cpp @@ -56,7 +56,7 @@ Node2D *NavigationPolygonEditor::_get_node() const { } void NavigationPolygonEditor::_set_node(Node *p_polygon) { - node = Object::cast_to(p_polygon); + node = Object::cast_to(p_polygon); } int NavigationPolygonEditor::_get_polygon_count() const { @@ -206,5 +206,5 @@ void NavigationPolygonEditor::_update_polygon_editing_state() { } NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin() : - AbstractPolygon2DEditorPlugin(memnew(NavigationPolygonEditor), "NavigationRegion2D") { + AbstractPolygon2DEditorPlugin(memnew(NavigationPolygonEditor), "NavigationPolygonInstance") { } 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 9a333d142..83247a13c 100644 --- a/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h +++ b/modules/navigation_mesh_generator/editor/navigation_polygon_editor_plugin.h @@ -32,7 +32,7 @@ #define NAVIGATION_POLYGON_EDITOR_PLUGIN_H #include "editor/plugins/abstract_polygon_2d_editor.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "editor/editor_plugin.h" @@ -45,7 +45,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor { GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor); - NavigationRegion2D *node = nullptr; + NavigationPolygonInstance *node = nullptr; Ref _ensure_navpoly() const; diff --git a/modules/tile_map/tile_set.h b/modules/tile_map/tile_set.h index 91beb2a3b..6317d09e3 100644 --- a/modules/tile_map/tile_set.h +++ b/modules/tile_map/tile_set.h @@ -35,7 +35,7 @@ #include "core/variant/array.h" #include "core/object/resource.h" #include "scene/2d/light_occluder_2d.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "scene/resources/navigation_polygon.h" #include "scene/resources/convex_polygon_shape_2d.h" #include "scene/resources/shape_2d.h" diff --git a/modules/tile_map/tile_set_editor_plugin.cpp b/modules/tile_map/tile_set_editor_plugin.cpp index cad5da442..cf1b3f22f 100644 --- a/modules/tile_map/tile_set_editor_plugin.cpp +++ b/modules/tile_map/tile_set_editor_plugin.cpp @@ -123,8 +123,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref p_library) { for (int j = 0; j < mi->get_child_count(); j++) { Node *child2 = mi->get_child(j); - if (Object::cast_to(child2)) { - nav_poly = Object::cast_to(child2)->get_navigation_polygon(); + if (Object::cast_to(child2)) { + nav_poly = Object::cast_to(child2)->get_navigation_polygon(); } if (Object::cast_to(child2)) { diff --git a/scene/2d/navigation_2d.cpp b/scene/2d/navigation_2d.cpp index d8b1454e0..1fdff7850 100644 --- a/scene/2d/navigation_2d.cpp +++ b/scene/2d/navigation_2d.cpp @@ -30,7 +30,7 @@ #include "navigation_2d.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "scene/resources/navigation_polygon.h" #include "servers/navigation_2d_server.h" diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_polygon_instance.cpp similarity index 83% rename from scene/2d/navigation_region_2d.cpp rename to scene/2d/navigation_polygon_instance.cpp index 257d7490c..fe1727762 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_polygon_instance.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "navigation_region_2d.h" +#include "navigation_polygon_instance.h" #include "core/config/engine.h" #include "core/core_string_names.h" @@ -42,7 +42,7 @@ #include "thirdparty/misc/triangulator.h" -void NavigationRegion2D::set_enabled(bool p_enabled) { +void NavigationPolygonInstance::set_enabled(bool p_enabled) { if (enabled == p_enabled) { return; } @@ -71,55 +71,55 @@ void NavigationRegion2D::set_enabled(bool p_enabled) { #endif // DEBUG_ENABLED } -bool NavigationRegion2D::is_enabled() const { +bool NavigationPolygonInstance::is_enabled() const { return enabled; } -void NavigationRegion2D::set_navigation_layers(uint32_t p_navigation_layers) { +void NavigationPolygonInstance::set_navigation_layers(uint32_t p_navigation_layers) { navigation_layers = p_navigation_layers; Navigation2DServer::get_singleton()->region_set_navigation_layers(region, navigation_layers); } -uint32_t NavigationRegion2D::get_navigation_layers() const { +uint32_t NavigationPolygonInstance::get_navigation_layers() const { return navigation_layers; } -void NavigationRegion2D::set_enter_cost(real_t p_enter_cost) { +void NavigationPolygonInstance::set_enter_cost(real_t p_enter_cost) { ERR_FAIL_COND_MSG(p_enter_cost < 0.0, "The enter_cost must be positive."); enter_cost = MAX(p_enter_cost, 0.0); Navigation2DServer::get_singleton()->region_set_enter_cost(region, p_enter_cost); } -real_t NavigationRegion2D::get_enter_cost() const { +real_t NavigationPolygonInstance::get_enter_cost() const { return enter_cost; } -void NavigationRegion2D::set_travel_cost(real_t p_travel_cost) { +void NavigationPolygonInstance::set_travel_cost(real_t p_travel_cost) { ERR_FAIL_COND_MSG(p_travel_cost < 0.0, "The travel_cost must be positive."); travel_cost = MAX(p_travel_cost, 0.0); Navigation2DServer::get_singleton()->region_set_enter_cost(region, travel_cost); } -real_t NavigationRegion2D::get_travel_cost() const { +real_t NavigationPolygonInstance::get_travel_cost() const { return travel_cost; } -RID NavigationRegion2D::get_region_rid() const { +RID NavigationPolygonInstance::get_region_rid() const { return region; } ///////////////////////////// #ifdef TOOLS_ENABLED -Rect2 NavigationRegion2D::_edit_get_rect() const { +Rect2 NavigationPolygonInstance::_edit_get_rect() const { return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2(); } -bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { +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; } #endif -void NavigationRegion2D::_notification(int p_what) { +void NavigationPolygonInstance::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { Node2D *c = this; @@ -225,7 +225,7 @@ void NavigationRegion2D::_notification(int p_what) { } } -void NavigationRegion2D::set_navigation_polygon(const Ref &p_navpoly) { +void NavigationPolygonInstance::set_navigation_polygon(const Ref &p_navpoly) { if (p_navpoly == navpoly) { return; } @@ -246,11 +246,11 @@ void NavigationRegion2D::set_navigation_polygon(const Ref &p_ update_configuration_warning(); } -Ref NavigationRegion2D::get_navigation_polygon() const { +Ref NavigationPolygonInstance::get_navigation_polygon() const { return navpoly; } -void NavigationRegion2D::_navpoly_changed() { +void NavigationPolygonInstance::_navpoly_changed() { if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) { update(); } @@ -259,7 +259,7 @@ void NavigationRegion2D::_navpoly_changed() { } } -void NavigationRegion2D::_map_changed(RID p_map) { +void NavigationPolygonInstance::_map_changed(RID p_map) { #ifdef DEBUG_ENABLED if (navigation != nullptr && enabled && (navigation->get_rid() == p_map)) { update(); @@ -269,7 +269,7 @@ void NavigationRegion2D::_map_changed(RID p_map) { #endif // DEBUG_ENABLED } -String NavigationRegion2D::get_configuration_warning() const { +String NavigationPolygonInstance::get_configuration_warning() const { if (!is_visible_in_tree() || !is_inside_tree()) { return String(); } @@ -285,25 +285,25 @@ String NavigationRegion2D::get_configuration_warning() const { return warning; } -void NavigationRegion2D::_bind_methods() { - 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); +void NavigationPolygonInstance::_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_enabled", "enabled"), &NavigationRegion2D::set_enabled); - ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion2D::is_enabled); + 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_navigation_layers", "navigation_layers"), &NavigationRegion2D::set_navigation_layers); - ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationRegion2D::get_navigation_layers); + ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &NavigationPolygonInstance::set_navigation_layers); + ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationPolygonInstance::get_navigation_layers); - ClassDB::bind_method(D_METHOD("get_region_rid"), &NavigationRegion2D::get_region_rid); + ClassDB::bind_method(D_METHOD("get_region_rid"), &NavigationPolygonInstance::get_region_rid); - ClassDB::bind_method(D_METHOD("set_enter_cost", "enter_cost"), &NavigationRegion2D::set_enter_cost); - ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationRegion2D::get_enter_cost); + ClassDB::bind_method(D_METHOD("set_enter_cost", "enter_cost"), &NavigationPolygonInstance::set_enter_cost); + ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationPolygonInstance::get_enter_cost); - ClassDB::bind_method(D_METHOD("set_travel_cost", "travel_cost"), &NavigationRegion2D::set_travel_cost); - ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationRegion2D::get_travel_cost); + ClassDB::bind_method(D_METHOD("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("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed); + ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationPolygonInstance::_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"); @@ -311,10 +311,10 @@ void NavigationRegion2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "enter_cost"), "set_enter_cost", "get_enter_cost"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "travel_cost"), "set_travel_cost", "get_travel_cost"); - ClassDB::bind_method(D_METHOD("_map_changed"), &NavigationRegion2D::_map_changed); + ClassDB::bind_method(D_METHOD("_map_changed"), &NavigationPolygonInstance::_map_changed); } -NavigationRegion2D::NavigationRegion2D() { +NavigationPolygonInstance::NavigationPolygonInstance() { enabled = true; set_notify_transform(true); region = Navigation2DServer::get_singleton()->region_create(); @@ -335,7 +335,7 @@ NavigationRegion2D::NavigationRegion2D() { #endif // DEBUG_ENABLED } -NavigationRegion2D::~NavigationRegion2D() { +NavigationPolygonInstance::~NavigationPolygonInstance() { Navigation2DServer::get_singleton()->free(region); #ifdef DEBUG_ENABLED diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_polygon_instance.h similarity index 95% rename from scene/2d/navigation_region_2d.h rename to scene/2d/navigation_polygon_instance.h index 3f4cef068..0b254cd53 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_polygon_instance.h @@ -38,8 +38,8 @@ class NavigationMesh; class Navigation2D; class NavigationPolygon; -class NavigationRegion2D : public Node2D { - GDCLASS(NavigationRegion2D, Node2D); +class NavigationPolygonInstance : public Node2D { + GDCLASS(NavigationPolygonInstance, Node2D); bool enabled; RID region; @@ -83,8 +83,8 @@ public: String get_configuration_warning() const; - NavigationRegion2D(); - ~NavigationRegion2D(); + NavigationPolygonInstance(); + ~NavigationPolygonInstance(); }; #endif // NAVIGATIONPOLYGON_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index c8017c98a..1d9f6c5d4 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -55,7 +55,7 @@ #include "scene/2d/navigation_agent_2d.h" #include "scene/2d/navigation_geometry_parser_2d.h" #include "scene/2d/navigation_obstacle_2d.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "scene/2d/parallax_background.h" #include "scene/2d/parallax_layer.h" #include "scene/2d/path_2d.h" @@ -686,7 +686,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/servers/navigation_2d_server.h b/servers/navigation_2d_server.h index 652242209..98fe3048a 100644 --- a/servers/navigation_2d_server.h +++ b/servers/navigation_2d_server.h @@ -34,7 +34,7 @@ #include "core/containers/rid.h" #include "core/object/object.h" -#include "scene/2d/navigation_region_2d.h" +#include "scene/2d/navigation_polygon_instance.h" #include "scene/resources/navigation_polygon.h" // This server exposes the 3D `NavigationServer` features in the 2D world.