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.
|
2D navigation and pathfinding node.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<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>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
<link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link>
|
<link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<return type="RID" />
|
<return type="RID" />
|
||||||
<argument index="0" name="to_point" type="Vector2" />
|
<argument index="0" name="to_point" type="Vector2" />
|
||||||
<description>
|
<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>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_rid" qualifiers="const">
|
<method name="get_rid" qualifiers="const">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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>
|
<brief_description>
|
||||||
A region of the 2D navigation map.
|
A region of the 2D navigation map.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
@ -18,13 +18,13 @@
|
|||||||
<method name="get_region_rid" qualifiers="const">
|
<method name="get_region_rid" qualifiers="const">
|
||||||
<return type="RID" />
|
<return type="RID" />
|
||||||
<description>
|
<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>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
|
<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>
|
||||||
<member name="enter_cost" type="float" setter="set_enter_cost" getter="get_enter_cost" default="0.0">
|
<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.
|
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)])
|
var outline = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
|
||||||
polygon.add_outline(outline)
|
polygon.add_outline(outline)
|
||||||
polygon.make_polygons_from_outlines()
|
polygon.make_polygons_from_outlines()
|
||||||
$NavigationRegion2D.navpoly = polygon
|
$NavigationPolygonInstance.navpoly = polygon
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
Using [method add_polygon] and indices of the vertices array.
|
Using [method add_polygon] and indices of the vertices array.
|
||||||
[codeblock]
|
[codeblock]
|
||||||
@ -20,7 +20,7 @@
|
|||||||
polygon.set_vertices(vertices)
|
polygon.set_vertices(vertices)
|
||||||
var indices = PoolIntArray([0, 1, 2, 3])
|
var indices = PoolIntArray([0, 1, 2, 3])
|
||||||
polygon.add_polygon(indices)
|
polygon.add_polygon(indices)
|
||||||
$NavigationRegion2D.navpoly = polygon
|
$NavigationPolygonInstance.navpoly = polygon
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
|
@ -35748,7 +35748,7 @@ msgid ""
|
|||||||
"Navigation2DServer.map_get_path] instead.\n"
|
"Navigation2DServer.map_get_path] instead.\n"
|
||||||
"Navigation2D provides navigation and pathfinding within a 2D area, specified "
|
"Navigation2D provides navigation and pathfinding within a 2D area, specified "
|
||||||
"as a collection of [NavigationPolygon] resources. By default, these are "
|
"as a collection of [NavigationPolygon] resources. By default, these are "
|
||||||
"automatically collected from child [NavigationRegion2D] nodes."
|
"automatically collected from child [NavigationPolygonInstance] nodes."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml
|
#: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml
|
||||||
@ -35760,7 +35760,7 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Returns the owner of the [NavigationPolygon] which contains the navigation "
|
"Returns the owner of the [NavigationPolygon] which contains the navigation "
|
||||||
"point closest to the point given. This is usually a "
|
"point closest to the point given. This is usually a "
|
||||||
"[NavigationRegion2D]."
|
"[NavigationPolygonInstance]."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Navigation2D.xml
|
#: doc/classes/Navigation2D.xml
|
||||||
@ -36781,7 +36781,7 @@ msgid "Determines if the [NavigationMeshInstance] is enabled or disabled."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationMeshInstance.xml
|
#: doc/classes/NavigationMeshInstance.xml
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"When pathfinding enters this region's navmesh from another regions navmesh "
|
"When pathfinding enters this region's navmesh from another regions navmesh "
|
||||||
"the [code]enter_cost[/code] value is added to the path distance for "
|
"the [code]enter_cost[/code] value is added to the path distance for "
|
||||||
@ -36801,7 +36801,7 @@ msgid "The [NavigationMesh] resource to use."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationMeshInstance.xml
|
#: doc/classes/NavigationMeshInstance.xml
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"When pathfinding moves inside this region's navmesh the traveled distances "
|
"When pathfinding moves inside this region's navmesh the traveled distances "
|
||||||
"are multiplied with [code]travel_cost[/code] for determining the shortest "
|
"are multiplied with [code]travel_cost[/code] for determining the shortest "
|
||||||
@ -36905,7 +36905,7 @@ msgid ""
|
|||||||
"50), Vector2(50, 0)])\n"
|
"50), Vector2(50, 0)])\n"
|
||||||
"polygon.add_outline(outline)\n"
|
"polygon.add_outline(outline)\n"
|
||||||
"polygon.make_polygons_from_outlines()\n"
|
"polygon.make_polygons_from_outlines()\n"
|
||||||
"$NavigationRegion2D.navpoly = polygon\n"
|
"$NavigationPolygonInstance.navpoly = polygon\n"
|
||||||
"[/codeblock]\n"
|
"[/codeblock]\n"
|
||||||
"Using [method add_polygon] and indices of the vertices array.\n"
|
"Using [method add_polygon] and indices of the vertices array.\n"
|
||||||
"[codeblock]\n"
|
"[codeblock]\n"
|
||||||
@ -36915,7 +36915,7 @@ msgid ""
|
|||||||
"polygon.set_vertices(vertices)\n"
|
"polygon.set_vertices(vertices)\n"
|
||||||
"var indices = PoolIntArray([0, 1, 2, 3])\n"
|
"var indices = PoolIntArray([0, 1, 2, 3])\n"
|
||||||
"polygon.add_polygon(indices)\n"
|
"polygon.add_polygon(indices)\n"
|
||||||
"$NavigationRegion2D.navpoly = polygon\n"
|
"$NavigationPolygonInstance.navpoly = polygon\n"
|
||||||
"[/codeblock]"
|
"[/codeblock]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -36992,11 +36992,11 @@ msgid ""
|
|||||||
"[method make_polygons_from_outlines] for the polygons to update."
|
"[method make_polygons_from_outlines] for the polygons to update."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "A region of the 2D navigation map."
|
msgid "A region of the 2D navigation map."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"A region of the navigation map. It tells the [Navigation2DServer] what can "
|
"A region of the navigation map. It tells the [Navigation2DServer] what can "
|
||||||
"be navigated and what cannot, based on its [NavigationPolygon] resource.\n"
|
"be navigated and what cannot, based on its [NavigationPolygon] resource.\n"
|
||||||
@ -37016,19 +37016,19 @@ msgid ""
|
|||||||
"controlled with the [member travel_cost] multiplier."
|
"controlled with the [member travel_cost] multiplier."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns the [RID] of this region on the [Navigation2DServer]. Combined with "
|
"Returns the [RID] of this region on the [Navigation2DServer]. Combined with "
|
||||||
"[method Navigation2DServer.map_get_closest_point_owner] can be used to "
|
"[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."
|
"navigation map."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "Determines if the [NavigationRegion2D] is enabled or disabled."
|
msgid "Determines if the [NavigationPolygonInstance] is enabled or disabled."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"A bitfield determining all navigation map layers the [NavigationPolygon] "
|
"A bitfield determining all navigation map layers the [NavigationPolygon] "
|
||||||
"belongs to. On path requests with [method Navigation2DServer.map_get_path] "
|
"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."
|
"will only proximity merge different navmeshes with matching layers."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "The [NavigationPolygon] resource to use."
|
msgid "The [NavigationPolygon] resource to use."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -35825,7 +35825,7 @@ msgid ""
|
|||||||
"Navigation2DServer.map_get_path] instead.\n"
|
"Navigation2DServer.map_get_path] instead.\n"
|
||||||
"Navigation2D provides navigation and pathfinding within a 2D area, specified "
|
"Navigation2D provides navigation and pathfinding within a 2D area, specified "
|
||||||
"as a collection of [NavigationPolygon] resources. By default, these are "
|
"as a collection of [NavigationPolygon] resources. By default, these are "
|
||||||
"automatically collected from child [NavigationRegion2D] nodes."
|
"automatically collected from child [NavigationPolygonInstance] nodes."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml
|
#: doc/classes/Navigation2D.xml doc/classes/Navigation2DServer.xml
|
||||||
@ -35837,7 +35837,7 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Returns the owner of the [NavigationPolygon] which contains the navigation "
|
"Returns the owner of the [NavigationPolygon] which contains the navigation "
|
||||||
"point closest to the point given. This is usually a "
|
"point closest to the point given. This is usually a "
|
||||||
"[NavigationRegion2D]."
|
"[NavigationPolygonInstance]."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/Navigation2D.xml
|
#: doc/classes/Navigation2D.xml
|
||||||
@ -36864,7 +36864,7 @@ msgid "Determines if the [NavigationMeshInstance] is enabled or disabled."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationMeshInstance.xml
|
#: doc/classes/NavigationMeshInstance.xml
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"When pathfinding enters this region's navmesh from another regions navmesh "
|
"When pathfinding enters this region's navmesh from another regions navmesh "
|
||||||
"the [code]enter_cost[/code] value is added to the path distance for "
|
"the [code]enter_cost[/code] value is added to the path distance for "
|
||||||
@ -36884,7 +36884,7 @@ msgid "The [NavigationMesh] resource to use."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationMeshInstance.xml
|
#: doc/classes/NavigationMeshInstance.xml
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"When pathfinding moves inside this region's navmesh the traveled distances "
|
"When pathfinding moves inside this region's navmesh the traveled distances "
|
||||||
"are multiplied with [code]travel_cost[/code] for determining the shortest "
|
"are multiplied with [code]travel_cost[/code] for determining the shortest "
|
||||||
@ -36988,7 +36988,7 @@ msgid ""
|
|||||||
"50), Vector2(50, 0)])\n"
|
"50), Vector2(50, 0)])\n"
|
||||||
"polygon.add_outline(outline)\n"
|
"polygon.add_outline(outline)\n"
|
||||||
"polygon.make_polygons_from_outlines()\n"
|
"polygon.make_polygons_from_outlines()\n"
|
||||||
"$NavigationRegion2D.navpoly = polygon\n"
|
"$NavigationPolygonInstance.navpoly = polygon\n"
|
||||||
"[/codeblock]\n"
|
"[/codeblock]\n"
|
||||||
"Using [method add_polygon] and indices of the vertices array.\n"
|
"Using [method add_polygon] and indices of the vertices array.\n"
|
||||||
"[codeblock]\n"
|
"[codeblock]\n"
|
||||||
@ -36998,7 +36998,7 @@ msgid ""
|
|||||||
"polygon.set_vertices(vertices)\n"
|
"polygon.set_vertices(vertices)\n"
|
||||||
"var indices = PoolIntArray([0, 1, 2, 3])\n"
|
"var indices = PoolIntArray([0, 1, 2, 3])\n"
|
||||||
"polygon.add_polygon(indices)\n"
|
"polygon.add_polygon(indices)\n"
|
||||||
"$NavigationRegion2D.navpoly = polygon\n"
|
"$NavigationPolygonInstance.navpoly = polygon\n"
|
||||||
"[/codeblock]"
|
"[/codeblock]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -37075,11 +37075,11 @@ msgid ""
|
|||||||
"[method make_polygons_from_outlines] for the polygons to update."
|
"[method make_polygons_from_outlines] for the polygons to update."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "A region of the 2D navigation map."
|
msgid "A region of the 2D navigation map."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"A region of the navigation map. It tells the [Navigation2DServer] what can "
|
"A region of the navigation map. It tells the [Navigation2DServer] what can "
|
||||||
"be navigated and what cannot, based on its [NavigationPolygon] resource.\n"
|
"be navigated and what cannot, based on its [NavigationPolygon] resource.\n"
|
||||||
@ -37099,19 +37099,19 @@ msgid ""
|
|||||||
"controlled with the [member travel_cost] multiplier."
|
"controlled with the [member travel_cost] multiplier."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"Returns the [RID] of this region on the [Navigation2DServer]. Combined with "
|
"Returns the [RID] of this region on the [Navigation2DServer]. Combined with "
|
||||||
"[method Navigation2DServer.map_get_closest_point_owner] can be used to "
|
"[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."
|
"navigation map."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "Determines if the [NavigationRegion2D] is enabled or disabled."
|
msgid "Determines if the [NavigationPolygonInstance] is enabled or disabled."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid ""
|
msgid ""
|
||||||
"A bitfield determining all navigation map layers the [NavigationPolygon] "
|
"A bitfield determining all navigation map layers the [NavigationPolygon] "
|
||||||
"belongs to. On path requests with [method Navigation2DServer.map_get_path] "
|
"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."
|
"will only proximity merge different navmeshes with matching layers."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: doc/classes/NavigationRegion2D.xml
|
#: doc/classes/NavigationPolygonInstance.xml
|
||||||
msgid "The [NavigationPolygon] resource to use."
|
msgid "The [NavigationPolygon] resource to use."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "core/object/undo_redo.h"
|
#include "core/object/undo_redo.h"
|
||||||
#include "core/string/ustring.h"
|
#include "core/string/ustring.h"
|
||||||
#include "core/containers/vector.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/resources/navigation_polygon.h"
|
||||||
#include "scene/main/node.h"
|
#include "scene/main/node.h"
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ Node2D *NavigationPolygonEditor::_get_node() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPolygonEditor::_set_node(Node *p_polygon) {
|
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 {
|
int NavigationPolygonEditor::_get_polygon_count() const {
|
||||||
@ -130,5 +130,5 @@ NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) :
|
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 EditorNode;
|
||||||
class NavigationPolygon;
|
class NavigationPolygon;
|
||||||
class NavigationRegion2D;
|
class NavigationPolygonInstance;
|
||||||
class Node2D;
|
class Node2D;
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
class NavigationPolygonEditor : public AbstractPolygon2DEditor {
|
class NavigationPolygonEditor : public AbstractPolygon2DEditor {
|
||||||
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
|
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
|
||||||
|
|
||||||
NavigationRegion2D *node;
|
NavigationPolygonInstance *node;
|
||||||
|
|
||||||
Ref<NavigationPolygon> _ensure_navpoly() const;
|
Ref<NavigationPolygon> _ensure_navpoly() const;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Node2D *NavigationPolygonEditor::_get_node() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPolygonEditor::_set_node(Node *p_polygon) {
|
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 {
|
int NavigationPolygonEditor::_get_polygon_count() const {
|
||||||
@ -206,5 +206,5 @@ void NavigationPolygonEditor::_update_polygon_editing_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin() :
|
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin() :
|
||||||
AbstractPolygon2DEditorPlugin(memnew(NavigationPolygonEditor), "NavigationRegion2D") {
|
AbstractPolygon2DEditorPlugin(memnew(NavigationPolygonEditor), "NavigationPolygonInstance") {
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#define NAVIGATION_POLYGON_EDITOR_PLUGIN_H
|
#define NAVIGATION_POLYGON_EDITOR_PLUGIN_H
|
||||||
|
|
||||||
#include "editor/plugins/abstract_polygon_2d_editor.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"
|
#include "editor/editor_plugin.h"
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor {
|
|||||||
|
|
||||||
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
|
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
|
||||||
|
|
||||||
NavigationRegion2D *node = nullptr;
|
NavigationPolygonInstance *node = nullptr;
|
||||||
|
|
||||||
Ref<NavigationPolygon> _ensure_navpoly() const;
|
Ref<NavigationPolygon> _ensure_navpoly() const;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "core/variant/array.h"
|
#include "core/variant/array.h"
|
||||||
#include "core/object/resource.h"
|
#include "core/object/resource.h"
|
||||||
#include "scene/2d/light_occluder_2d.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/navigation_polygon.h"
|
||||||
#include "scene/resources/convex_polygon_shape_2d.h"
|
#include "scene/resources/convex_polygon_shape_2d.h"
|
||||||
#include "scene/resources/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++) {
|
for (int j = 0; j < mi->get_child_count(); j++) {
|
||||||
Node *child2 = mi->get_child(j);
|
Node *child2 = mi->get_child(j);
|
||||||
|
|
||||||
if (Object::cast_to<NavigationRegion2D>(child2)) {
|
if (Object::cast_to<NavigationPolygonInstance>(child2)) {
|
||||||
nav_poly = Object::cast_to<NavigationRegion2D>(child2)->get_navigation_polygon();
|
nav_poly = Object::cast_to<NavigationPolygonInstance>(child2)->get_navigation_polygon();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object::cast_to<LightOccluder2D>(child2)) {
|
if (Object::cast_to<LightOccluder2D>(child2)) {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include "navigation_2d.h"
|
#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 "scene/resources/navigation_polygon.h"
|
||||||
#include "servers/navigation_2d_server.h"
|
#include "servers/navigation_2d_server.h"
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* 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/config/engine.h"
|
||||||
#include "core/core_string_names.h"
|
#include "core/core_string_names.h"
|
||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#include "thirdparty/misc/triangulator.h"
|
#include "thirdparty/misc/triangulator.h"
|
||||||
|
|
||||||
void NavigationRegion2D::set_enabled(bool p_enabled) {
|
void NavigationPolygonInstance::set_enabled(bool p_enabled) {
|
||||||
if (enabled == p_enabled) {
|
if (enabled == p_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -71,55 +71,55 @@ void NavigationRegion2D::set_enabled(bool p_enabled) {
|
|||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NavigationRegion2D::is_enabled() const {
|
bool NavigationPolygonInstance::is_enabled() const {
|
||||||
return enabled;
|
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;
|
navigation_layers = p_navigation_layers;
|
||||||
Navigation2DServer::get_singleton()->region_set_navigation_layers(region, 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;
|
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.");
|
ERR_FAIL_COND_MSG(p_enter_cost < 0.0, "The enter_cost must be positive.");
|
||||||
enter_cost = MAX(p_enter_cost, 0.0);
|
enter_cost = MAX(p_enter_cost, 0.0);
|
||||||
Navigation2DServer::get_singleton()->region_set_enter_cost(region, p_enter_cost);
|
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;
|
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.");
|
ERR_FAIL_COND_MSG(p_travel_cost < 0.0, "The travel_cost must be positive.");
|
||||||
travel_cost = MAX(p_travel_cost, 0.0);
|
travel_cost = MAX(p_travel_cost, 0.0);
|
||||||
Navigation2DServer::get_singleton()->region_set_enter_cost(region, travel_cost);
|
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;
|
return travel_cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
RID NavigationRegion2D::get_region_rid() const {
|
RID NavigationPolygonInstance::get_region_rid() const {
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
Rect2 NavigationRegion2D::_edit_get_rect() const {
|
Rect2 NavigationPolygonInstance::_edit_get_rect() const {
|
||||||
return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2();
|
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;
|
return navpoly.is_valid() ? navpoly->_edit_is_selected_on_click(p_point, p_tolerance) : false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void NavigationRegion2D::_notification(int p_what) {
|
void NavigationPolygonInstance::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
Node2D *c = this;
|
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) {
|
if (p_navpoly == navpoly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -246,11 +246,11 @@ void NavigationRegion2D::set_navigation_polygon(const Ref<NavigationPolygon> &p_
|
|||||||
update_configuration_warning();
|
update_configuration_warning();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<NavigationPolygon> NavigationRegion2D::get_navigation_polygon() const {
|
Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const {
|
||||||
return navpoly;
|
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())) {
|
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) {
|
||||||
update();
|
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
|
#ifdef DEBUG_ENABLED
|
||||||
if (navigation != nullptr && enabled && (navigation->get_rid() == p_map)) {
|
if (navigation != nullptr && enabled && (navigation->get_rid() == p_map)) {
|
||||||
update();
|
update();
|
||||||
@ -269,7 +269,7 @@ void NavigationRegion2D::_map_changed(RID p_map) {
|
|||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
String NavigationRegion2D::get_configuration_warning() const {
|
String NavigationPolygonInstance::get_configuration_warning() const {
|
||||||
if (!is_visible_in_tree() || !is_inside_tree()) {
|
if (!is_visible_in_tree() || !is_inside_tree()) {
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
@ -285,25 +285,25 @@ String NavigationRegion2D::get_configuration_warning() const {
|
|||||||
return warning;
|
return warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationRegion2D::_bind_methods() {
|
void NavigationPolygonInstance::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationRegion2D::set_navigation_polygon);
|
ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon);
|
||||||
ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationRegion2D::get_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("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled);
|
||||||
ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion2D::is_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("set_navigation_layers", "navigation_layers"), &NavigationPolygonInstance::set_navigation_layers);
|
||||||
ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationRegion2D::get_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("set_enter_cost", "enter_cost"), &NavigationPolygonInstance::set_enter_cost);
|
||||||
ClassDB::bind_method(D_METHOD("get_enter_cost"), &NavigationRegion2D::get_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("set_travel_cost", "travel_cost"), &NavigationPolygonInstance::set_travel_cost);
|
||||||
ClassDB::bind_method(D_METHOD("get_travel_cost"), &NavigationRegion2D::get_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::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
|
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, "enter_cost"), "set_enter_cost", "get_enter_cost");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "travel_cost"), "set_travel_cost", "get_travel_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;
|
enabled = true;
|
||||||
set_notify_transform(true);
|
set_notify_transform(true);
|
||||||
region = Navigation2DServer::get_singleton()->region_create();
|
region = Navigation2DServer::get_singleton()->region_create();
|
||||||
@ -335,7 +335,7 @@ NavigationRegion2D::NavigationRegion2D() {
|
|||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationRegion2D::~NavigationRegion2D() {
|
NavigationPolygonInstance::~NavigationPolygonInstance() {
|
||||||
Navigation2DServer::get_singleton()->free(region);
|
Navigation2DServer::get_singleton()->free(region);
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
@ -38,8 +38,8 @@ class NavigationMesh;
|
|||||||
class Navigation2D;
|
class Navigation2D;
|
||||||
class NavigationPolygon;
|
class NavigationPolygon;
|
||||||
|
|
||||||
class NavigationRegion2D : public Node2D {
|
class NavigationPolygonInstance : public Node2D {
|
||||||
GDCLASS(NavigationRegion2D, Node2D);
|
GDCLASS(NavigationPolygonInstance, Node2D);
|
||||||
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
RID region;
|
RID region;
|
||||||
@ -83,8 +83,8 @@ public:
|
|||||||
|
|
||||||
String get_configuration_warning() const;
|
String get_configuration_warning() const;
|
||||||
|
|
||||||
NavigationRegion2D();
|
NavigationPolygonInstance();
|
||||||
~NavigationRegion2D();
|
~NavigationPolygonInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NAVIGATIONPOLYGON_H
|
#endif // NAVIGATIONPOLYGON_H
|
@ -55,7 +55,7 @@
|
|||||||
#include "scene/2d/navigation_agent_2d.h"
|
#include "scene/2d/navigation_agent_2d.h"
|
||||||
#include "scene/2d/navigation_geometry_parser_2d.h"
|
#include "scene/2d/navigation_geometry_parser_2d.h"
|
||||||
#include "scene/2d/navigation_obstacle_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_background.h"
|
||||||
#include "scene/2d/parallax_layer.h"
|
#include "scene/2d/parallax_layer.h"
|
||||||
#include "scene/2d/path_2d.h"
|
#include "scene/2d/path_2d.h"
|
||||||
@ -686,7 +686,7 @@ void register_scene_types() {
|
|||||||
|
|
||||||
ClassDB::register_class<Navigation2D>();
|
ClassDB::register_class<Navigation2D>();
|
||||||
ClassDB::register_class<NavigationPolygon>();
|
ClassDB::register_class<NavigationPolygon>();
|
||||||
ClassDB::register_class<NavigationRegion2D>();
|
ClassDB::register_class<NavigationPolygonInstance>();
|
||||||
ClassDB::register_class<NavigationAgent2D>();
|
ClassDB::register_class<NavigationAgent2D>();
|
||||||
ClassDB::register_class<NavigationObstacle2D>();
|
ClassDB::register_class<NavigationObstacle2D>();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "core/containers/rid.h"
|
#include "core/containers/rid.h"
|
||||||
#include "core/object/object.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"
|
#include "scene/resources/navigation_polygon.h"
|
||||||
|
|
||||||
// This server exposes the 3D `NavigationServer` features in the 2D world.
|
// This server exposes the 3D `NavigationServer` features in the 2D world.
|
||||||
|
Loading…
Reference in New Issue
Block a user