Skip to content

Commit 72db300

Browse files
authored
Merge pull request #23200 from santouits/navpoldocs
NavigationPolygon descriptions of the class and methods
2 parents ee858d0 + 1c14b01 commit 72db300

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

doc/classes/NavigationPolygon.xml

+33
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="NavigationPolygon" inherits="Resource" category="Core" version="3.1">
33
<brief_description>
4+
A node that has methods to draw outlines or use indices of vertices to create navigation polygons.
45
</brief_description>
56
<description>
7+
There are two ways to create polygons. Either by using the [method add_outline] method or using the [method add_polygon] method.
8+
Using [method add_outline]:
9+
[code]
10+
var polygon = NavigationPolygon.new()
11+
var outline = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
12+
polygon.add_outline(outline)
13+
polygon.make_polygons_from_outlines()
14+
$NavigationPolygonInstance.navpoly = polygon
15+
[/code]
16+
Using [method add_polygon] and indices of the vertices array.
17+
[code]
18+
var polygon = NavigationPolygon.new()
19+
var vertices = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
20+
polygon.set_vertices(vertices)
21+
var indices = PoolIntArray(0, 3, 1)
22+
polygon.add_polygon(indices)
23+
$NavigationPolygonInstance.navpoly = polygon
24+
[/code]
625
</description>
726
<tutorials>
827
</tutorials>
@@ -15,6 +34,7 @@
1534
<argument index="0" name="outline" type="PoolVector2Array">
1635
</argument>
1736
<description>
37+
Appends a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use.
1838
</description>
1939
</method>
2040
<method name="add_outline_at_index">
@@ -25,6 +45,7 @@
2545
<argument index="1" name="index" type="int">
2646
</argument>
2747
<description>
48+
Adds a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use.
2849
</description>
2950
</method>
3051
<method name="add_polygon">
@@ -33,18 +54,21 @@
3354
<argument index="0" name="polygon" type="PoolIntArray">
3455
</argument>
3556
<description>
57+
Adds a polygon using the indices of the vertices you get when calling [method get_vertices].
3658
</description>
3759
</method>
3860
<method name="clear_outlines">
3961
<return type="void">
4062
</return>
4163
<description>
64+
Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.
4265
</description>
4366
</method>
4467
<method name="clear_polygons">
4568
<return type="void">
4669
</return>
4770
<description>
71+
Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
4872
</description>
4973
</method>
5074
<method name="get_outline" qualifiers="const">
@@ -53,12 +77,14 @@
5377
<argument index="0" name="idx" type="int">
5478
</argument>
5579
<description>
80+
Returns a [PoolVector2Array] containing the vertices of an outline that was created in the editor or by script.
5681
</description>
5782
</method>
5883
<method name="get_outline_count" qualifiers="const">
5984
<return type="int">
6085
</return>
6186
<description>
87+
Returns the number of outlines that were created in the editor or by script.
6288
</description>
6389
</method>
6490
<method name="get_polygon">
@@ -67,24 +93,28 @@
6793
<argument index="0" name="idx" type="int">
6894
</argument>
6995
<description>
96+
Returns a [PoolIntArray] containing the indices of the vertices of a created polygon.
7097
</description>
7198
</method>
7299
<method name="get_polygon_count" qualifiers="const">
73100
<return type="int">
74101
</return>
75102
<description>
103+
Returns the count of all polygons.
76104
</description>
77105
</method>
78106
<method name="get_vertices" qualifiers="const">
79107
<return type="PoolVector2Array">
80108
</return>
81109
<description>
110+
Returns a [PoolVector2Array] containing all the vertices being used to create the polygons.
82111
</description>
83112
</method>
84113
<method name="make_polygons_from_outlines">
85114
<return type="void">
86115
</return>
87116
<description>
117+
Creates polygons from the outlines added in the editor or by script.
88118
</description>
89119
</method>
90120
<method name="remove_outline">
@@ -93,6 +123,7 @@
93123
<argument index="0" name="idx" type="int">
94124
</argument>
95125
<description>
126+
Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
96127
</description>
97128
</method>
98129
<method name="set_outline">
@@ -103,6 +134,7 @@
103134
<argument index="1" name="outline" type="PoolVector2Array">
104135
</argument>
105136
<description>
137+
Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
106138
</description>
107139
</method>
108140
<method name="set_vertices">
@@ -111,6 +143,7 @@
111143
<argument index="0" name="vertices" type="PoolVector2Array">
112144
</argument>
113145
<description>
146+
Sets the vertices that can be then indexed to create polygons with the [method add_polygon] method.
114147
</description>
115148
</method>
116149
</methods>

0 commit comments

Comments
 (0)