Skip to content
0.2.0-dev Download ZIP
117 lines ·6.3 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="Polygon2D" inherits="Node2D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A 2D polygon.
5 </brief_description>
6 <description>
7 A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.
8 </description>
9 <tutorials>
10 </tutorials>
11 <methods>
12 <method name="add_bone">
13 <return type="void" />
14 <param index="0" name="path" type="NodePath" />
15 <param index="1" name="weights" type="PackedFloat32Array" />
16 <description>
17 Adds a bone with the specified [param path] and [param weights].
18 </description>
19 </method>
20 <method name="clear_bones">
21 <return type="void" />
22 <description>
23 Removes all bones from this [Polygon2D].
24 </description>
25 </method>
26 <method name="erase_bone">
27 <return type="void" />
28 <param index="0" name="index" type="int" />
29 <description>
30 Removes the specified bone from this [Polygon2D].
31 </description>
32 </method>
33 <method name="get_bone_count" qualifiers="const">
34 <return type="int" />
35 <description>
36 Returns the number of bones in this [Polygon2D].
37 </description>
38 </method>
39 <method name="get_bone_path" qualifiers="const">
40 <return type="NodePath" />
41 <param index="0" name="index" type="int" />
42 <description>
43 Returns the path to the node associated with the specified bone.
44 </description>
45 </method>
46 <method name="get_bone_weights" qualifiers="const">
47 <return type="PackedFloat32Array" />
48 <param index="0" name="index" type="int" />
49 <description>
50 Returns the weight values of the specified bone.
51 </description>
52 </method>
53 <method name="set_bone_path">
54 <return type="void" />
55 <param index="0" name="index" type="int" />
56 <param index="1" name="path" type="NodePath" />
57 <description>
58 Sets the path to the node associated with the specified bone.
59 </description>
60 </method>
61 <method name="set_bone_weights">
62 <return type="void" />
63 <param index="0" name="index" type="int" />
64 <param index="1" name="weights" type="PackedFloat32Array" />
65 <description>
66 Sets the weight values for the specified bone.
67 </description>
68 </method>
69 </methods>
70 <members>
71 <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased" default="false">
72 If [code]true[/code], polygon edges will be anti-aliased.
73 </member>
74 <member name="color" type="Color" setter="set_color" getter="get_color" default="Color(1, 1, 1, 1)" keywords="colour">
75 The polygon's fill color. If [member texture] is set, it will be multiplied by this color. It will also be the default color for vertices not set in [member vertex_colors].
76 </member>
77 <member name="internal_vertex_count" type="int" setter="set_internal_vertex_count" getter="get_internal_vertex_count" default="0">
78 Number of internal vertices, used for UV mapping.
79 </member>
80 <member name="invert_border" type="float" setter="set_invert_border" getter="get_invert_border" default="100.0">
81 Added padding applied to the bounding box when [member invert_enabled] is set to [code]true[/code]. Setting this value too small may result in a "Bad Polygon" error.
82 </member>
83 <member name="invert_enabled" type="bool" setter="set_invert_enabled" getter="get_invert_enabled" default="false">
84 If [code]true[/code], the polygon will be inverted, containing the area outside the defined points and extending to the [member invert_border].
85 </member>
86 <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)">
87 The offset applied to each vertex.
88 </member>
89 <member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array()">
90 The polygon's list of vertices. The final point will be connected to the first.
91 </member>
92 <member name="polygons" type="Array" setter="set_polygons" getter="get_polygons" default="[]">
93 The list of polygons, in case more than one is being represented. Every individual polygon is stored as a [PackedInt32Array] where each [int] is an index to a point in [member polygon]. If empty, this property will be ignored, and the resulting single polygon will be composed of all points in [member polygon], using the order they are stored in.
94 </member>
95 <member name="skeleton" type="NodePath" setter="set_skeleton" getter="get_skeleton" default="NodePath(&quot;&quot;)">
96 Path to a [Skeleton2D] node used for skeleton-based deformations of this polygon. If empty or invalid, skeletal deformations will not be used.
97 </member>
98 <member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
99 The polygon's fill texture. Use [member uv] to set texture coordinates.
100 </member>
101 <member name="texture_offset" type="Vector2" setter="set_texture_offset" getter="get_texture_offset" default="Vector2(0, 0)">
102 Amount to offset the polygon's [member texture]. If set to [code]Vector2(0, 0)[/code], the texture's origin (its top-left corner) will be placed at the polygon's position.
103 </member>
104 <member name="texture_rotation" type="float" setter="set_texture_rotation" getter="get_texture_rotation" default="0.0">
105 The texture's rotation in radians.
106 </member>
107 <member name="texture_scale" type="Vector2" setter="set_texture_scale" getter="get_texture_scale" default="Vector2(1, 1)">
108 Amount to multiply the [member uv] coordinates when using [member texture]. Larger values make the texture smaller, and vice versa.
109 </member>
110 <member name="uv" type="PackedVector2Array" setter="set_uv" getter="get_uv" default="PackedVector2Array()">
111 Texture coordinates for each vertex of the polygon. There should be one UV value per polygon vertex. If there are fewer, undefined vertices will use [code]Vector2(0, 0)[/code].
112 </member>
113 <member name="vertex_colors" type="PackedColorArray" setter="set_vertex_colors" getter="get_vertex_colors" default="PackedColorArray()">
114 Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use [member color].
115 </member>
116 </members>
117</class>