Polygon2D.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Polygon2D" inherits="Node2D" 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. [b]Note:[/b] By default, Godot can only draw up to 4,096 polygon points at a time. To increase this limit, open the Project Settings and increase [member ProjectSettings.rendering/limits/buffers/canvas_polygon_buffer_size_kb] and [member ProjectSettings.rendering/limits/buffers/canvas_polygon_index_buffer_size_kb].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_bone">
  14. <return type="void" />
  15. <argument index="0" name="path" type="NodePath" />
  16. <argument index="1" name="weights" type="PoolRealArray" />
  17. <description>
  18. Adds a bone with the specified [code]path[/code] and [code]weights[/code].
  19. </description>
  20. </method>
  21. <method name="clear_bones">
  22. <return type="void" />
  23. <description>
  24. Removes all bones from this [Polygon2D].
  25. </description>
  26. </method>
  27. <method name="erase_bone">
  28. <return type="void" />
  29. <argument index="0" name="index" type="int" />
  30. <description>
  31. Removes the specified bone from this [Polygon2D].
  32. </description>
  33. </method>
  34. <method name="get_bone_count" qualifiers="const">
  35. <return type="int" />
  36. <description>
  37. Returns the number of bones in this [Polygon2D].
  38. </description>
  39. </method>
  40. <method name="get_bone_path" qualifiers="const">
  41. <return type="NodePath" />
  42. <argument index="0" name="index" type="int" />
  43. <description>
  44. Returns the path to the node associated with the specified bone.
  45. </description>
  46. </method>
  47. <method name="get_bone_weights" qualifiers="const">
  48. <return type="PoolRealArray" />
  49. <argument index="0" name="index" type="int" />
  50. <description>
  51. Returns the height values of the specified bone.
  52. </description>
  53. </method>
  54. <method name="set_bone_path">
  55. <return type="void" />
  56. <argument index="0" name="index" type="int" />
  57. <argument index="1" name="path" type="NodePath" />
  58. <description>
  59. Sets the path to the node associated with the specified bone.
  60. </description>
  61. </method>
  62. <method name="set_bone_weights">
  63. <return type="void" />
  64. <argument index="0" name="index" type="int" />
  65. <argument index="1" name="weights" type="PoolRealArray" />
  66. <description>
  67. Sets the weight values for the specified bone.
  68. </description>
  69. </method>
  70. </methods>
  71. <members>
  72. <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased" default="false">
  73. If [code]true[/code], attempts to perform antialiasing for polygon edges by drawing a thin OpenGL smooth line on the edges.
  74. [b]Note:[/b] Due to how it works, built-in antialiasing will not look correct for translucent polygons and may not work on certain platforms. As a workaround, install the [url=https://github.com/godot-extended-libraries/godot-antialiased-line2d]Antialiased Line2D[/url] add-on then create an AntialiasedPolygon2D node. That node relies on a texture with custom mipmaps to perform antialiasing.
  75. </member>
  76. <member name="bones" type="Array" setter="_set_bones" getter="_get_bones" default="[ ]">
  77. </member>
  78. <member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
  79. The polygon's fill color. If [code]texture[/code] is defined, it will be multiplied by this color. It will also be the default color for vertices not set in [code]vertex_colors[/code].
  80. </member>
  81. <member name="internal_vertex_count" type="int" setter="set_internal_vertex_count" getter="get_internal_vertex_count" default="0">
  82. </member>
  83. <member name="invert_border" type="float" setter="set_invert_border" getter="get_invert_border" default="100.0">
  84. Added padding applied to the bounding box when using [code]invert[/code]. Setting this value too small may result in a "Bad Polygon" error.
  85. </member>
  86. <member name="invert_enable" type="bool" setter="set_invert" getter="get_invert" default="false">
  87. If [code]true[/code], polygon will be inverted, containing the area outside the defined points and extending to the [code]invert_border[/code].
  88. </member>
  89. <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )">
  90. The offset applied to each vertex.
  91. </member>
  92. <member name="polygon" type="PoolVector2Array" setter="set_polygon" getter="get_polygon" default="PoolVector2Array( )">
  93. The polygon's list of vertices. The final point will be connected to the first.
  94. [b]Note:[/b] This returns a copy of the [PoolVector2Array] rather than a reference.
  95. </member>
  96. <member name="polygons" type="Array" setter="set_polygons" getter="get_polygons" default="[ ]">
  97. The list of polygons, in case more than one is being represented. Every individual polygon is stored as a [PoolIntArray] 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.
  98. </member>
  99. <member name="skeleton" type="NodePath" setter="set_skeleton" getter="get_skeleton" default="NodePath(&quot;&quot;)">
  100. </member>
  101. <member name="texture" type="Texture" setter="set_texture" getter="get_texture">
  102. The polygon's fill texture. Use [code]uv[/code] to set texture coordinates.
  103. </member>
  104. <member name="texture_offset" type="Vector2" setter="set_texture_offset" getter="get_texture_offset" default="Vector2( 0, 0 )">
  105. Amount to offset the polygon's [code]texture[/code]. If [code](0, 0)[/code] the texture's origin (its top-left corner) will be placed at the polygon's [code]position[/code].
  106. </member>
  107. <member name="texture_rotation" type="float" setter="set_texture_rotation" getter="get_texture_rotation">
  108. The texture's rotation in radians.
  109. </member>
  110. <member name="texture_rotation_degrees" type="float" setter="set_texture_rotation_degrees" getter="get_texture_rotation_degrees" default="0.0">
  111. The texture's rotation in degrees.
  112. </member>
  113. <member name="texture_scale" type="Vector2" setter="set_texture_scale" getter="get_texture_scale" default="Vector2( 1, 1 )">
  114. Amount to multiply the [code]uv[/code] coordinates when using a [code]texture[/code]. Larger values make the texture smaller, and vice versa.
  115. </member>
  116. <member name="uv" type="PoolVector2Array" setter="set_uv" getter="get_uv" default="PoolVector2Array( )">
  117. Texture coordinates for each vertex of the polygon. There should be one [code]uv[/code] per polygon vertex. If there are fewer, undefined vertices will use [code](0, 0)[/code].
  118. </member>
  119. <member name="vertex_colors" type="PoolColorArray" setter="set_vertex_colors" getter="get_vertex_colors" default="PoolColorArray( )">
  120. 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 [code]color[/code].
  121. </member>
  122. </members>
  123. <constants>
  124. </constants>
  125. </class>