mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-02 22:35:55 +01:00
Renamed NavigationRegion2D back to NavigationPolygonInstance, as I think it fits the engine better.
This commit is contained in:
parent
68b9f4c90e
commit
654cfb81b7
@ -4,7 +4,7 @@
|
||||
2D navigation and pathfinding node.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
<link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link>
|
||||
@ -21,7 +21,7 @@
|
||||
<return type="RID" />
|
||||
<argument index="0" name="to_point" type="Vector2" />
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_rid" qualifiers="const">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="NavigationRegion2D" inherits="Node2D" version="3.11">
|
||||
<class name="NavigationPolygonInstance" inherits="Node2D" version="3.11">
|
||||
<brief_description>
|
||||
A region of the 2D navigation map.
|
||||
</brief_description>
|
||||
@ -18,13 +18,13 @@
|
||||
<method name="get_region_rid" qualifiers="const">
|
||||
<return type="RID" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
|
||||
Determines if the [NavigationRegion2D] is enabled or disabled.
|
||||
Determines if the [NavigationPolygonInstance] is enabled or disabled.
|
||||
</member>
|
||||
<member name="enter_cost" type="float" setter="set_enter_cost" getter="get_enter_cost" default="0.0">
|
||||
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.
|
||||
|
@ -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]
|
||||
</description>
|
||||
<tutorials>
|
||||
|
@ -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 ""
|
||||
|
||||
|
@ -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 ""
|
||||
|
||||
|
@ -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<NavigationRegion2D>(p_polygon);
|
||||
node = Object::cast_to<NavigationPolygonInstance>(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") {
|
||||
}
|
||||
|
@ -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<NavigationPolygon> _ensure_navpoly() const;
|
||||
|
||||
|
@ -56,7 +56,7 @@ Node2D *NavigationPolygonEditor::_get_node() const {
|
||||
}
|
||||
|
||||
void NavigationPolygonEditor::_set_node(Node *p_polygon) {
|
||||
node = Object::cast_to<NavigationRegion2D>(p_polygon);
|
||||
node = Object::cast_to<NavigationPolygonInstance>(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") {
|
||||
}
|
||||
|
@ -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<NavigationPolygon> _ensure_navpoly() const;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -123,8 +123,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
|
||||
for (int j = 0; j < mi->get_child_count(); j++) {
|
||||
Node *child2 = mi->get_child(j);
|
||||
|
||||
if (Object::cast_to<NavigationRegion2D>(child2)) {
|
||||
nav_poly = Object::cast_to<NavigationRegion2D>(child2)->get_navigation_polygon();
|
||||
if (Object::cast_to<NavigationPolygonInstance>(child2)) {
|
||||
nav_poly = Object::cast_to<NavigationPolygonInstance>(child2)->get_navigation_polygon();
|
||||
}
|
||||
|
||||
if (Object::cast_to<LightOccluder2D>(child2)) {
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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<NavigationPolygon> &p_navpoly) {
|
||||
void NavigationPolygonInstance::set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly) {
|
||||
if (p_navpoly == navpoly) {
|
||||
return;
|
||||
}
|
||||
@ -246,11 +246,11 @@ void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_
|
||||
update_configuration_warning();
|
||||
}
|
||||
|
||||
Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const {
|
||||
Ref<NavigationPolygon> 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
|
@ -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
|
@ -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<Navigation2D>();
|
||||
ClassDB::register_class<NavigationPolygon>();
|
||||
ClassDB::register_class<NavigationRegion2D>();
|
||||
ClassDB::register_class<NavigationPolygonInstance>();
|
||||
ClassDB::register_class<NavigationAgent2D>();
|
||||
ClassDB::register_class<NavigationObstacle2D>();
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user