class_polygon2d.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Polygon2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Polygon2D:
  5. Polygon2D
  6. =========
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A 2D polygon.
  12. Properties
  13. ----------
  14. +-------------------------------------------------+---------------------------------------------------------------------------+
  15. | :ref:`bool<class_bool>` | :ref:`antialiased<class_Polygon2D_antialiased>` |
  16. +-------------------------------------------------+---------------------------------------------------------------------------+
  17. | :ref:`Array<class_Array>` | :ref:`bones<class_Polygon2D_bones>` |
  18. +-------------------------------------------------+---------------------------------------------------------------------------+
  19. | :ref:`Color<class_Color>` | :ref:`color<class_Polygon2D_color>` |
  20. +-------------------------------------------------+---------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`invert_border<class_Polygon2D_invert_border>` |
  22. +-------------------------------------------------+---------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`invert_enable<class_Polygon2D_invert_enable>` |
  24. +-------------------------------------------------+---------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_Polygon2D_offset>` |
  26. +-------------------------------------------------+---------------------------------------------------------------------------+
  27. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`polygon<class_Polygon2D_polygon>` |
  28. +-------------------------------------------------+---------------------------------------------------------------------------+
  29. | :ref:`NodePath<class_NodePath>` | :ref:`skeleton<class_Polygon2D_skeleton>` |
  30. +-------------------------------------------------+---------------------------------------------------------------------------+
  31. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`splits<class_Polygon2D_splits>` |
  32. +-------------------------------------------------+---------------------------------------------------------------------------+
  33. | :ref:`Texture<class_Texture>` | :ref:`texture<class_Polygon2D_texture>` |
  34. +-------------------------------------------------+---------------------------------------------------------------------------+
  35. | :ref:`Vector2<class_Vector2>` | :ref:`texture_offset<class_Polygon2D_texture_offset>` |
  36. +-------------------------------------------------+---------------------------------------------------------------------------+
  37. | :ref:`float<class_float>` | :ref:`texture_rotation<class_Polygon2D_texture_rotation>` |
  38. +-------------------------------------------------+---------------------------------------------------------------------------+
  39. | :ref:`float<class_float>` | :ref:`texture_rotation_degrees<class_Polygon2D_texture_rotation_degrees>` |
  40. +-------------------------------------------------+---------------------------------------------------------------------------+
  41. | :ref:`Vector2<class_Vector2>` | :ref:`texture_scale<class_Polygon2D_texture_scale>` |
  42. +-------------------------------------------------+---------------------------------------------------------------------------+
  43. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`uv<class_Polygon2D_uv>` |
  44. +-------------------------------------------------+---------------------------------------------------------------------------+
  45. | :ref:`PoolColorArray<class_PoolColorArray>` | :ref:`vertex_colors<class_Polygon2D_vertex_colors>` |
  46. +-------------------------------------------------+---------------------------------------------------------------------------+
  47. Methods
  48. -------
  49. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`add_bone<class_Polygon2D_add_bone>` **(** :ref:`NodePath<class_NodePath>` path, :ref:`PoolRealArray<class_PoolRealArray>` weights **)** |
  51. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`clear_bones<class_Polygon2D_clear_bones>` **(** **)** |
  53. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`erase_bone<class_Polygon2D_erase_bone>` **(** :ref:`int<class_int>` index **)** |
  55. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`int<class_int>` | :ref:`get_bone_count<class_Polygon2D_get_bone_count>` **(** **)** const |
  57. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`NodePath<class_NodePath>` | :ref:`get_bone_path<class_Polygon2D_get_bone_path>` **(** :ref:`int<class_int>` index **)** const |
  59. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`PoolRealArray<class_PoolRealArray>` | :ref:`get_bone_weights<class_Polygon2D_get_bone_weights>` **(** :ref:`int<class_int>` index **)** const |
  61. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_bone_path<class_Polygon2D_set_bone_path>` **(** :ref:`int<class_int>` index, :ref:`NodePath<class_NodePath>` path **)** |
  63. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_bone_weights<class_Polygon2D_set_bone_weights>` **(** :ref:`int<class_int>` index, :ref:`PoolRealArray<class_PoolRealArray>` weights **)** |
  65. +--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. Description
  67. -----------
  68. 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.
  69. Property Descriptions
  70. ---------------------
  71. .. _class_Polygon2D_antialiased:
  72. - :ref:`bool<class_bool>` **antialiased**
  73. +----------+------------------------+
  74. | *Setter* | set_antialiased(value) |
  75. +----------+------------------------+
  76. | *Getter* | get_antialiased() |
  77. +----------+------------------------+
  78. If ``true`` polygon edges will be anti-aliased. Default value: ``false``.
  79. .. _class_Polygon2D_bones:
  80. - :ref:`Array<class_Array>` **bones**
  81. .. _class_Polygon2D_color:
  82. - :ref:`Color<class_Color>` **color**
  83. +----------+------------------+
  84. | *Setter* | set_color(value) |
  85. +----------+------------------+
  86. | *Getter* | get_color() |
  87. +----------+------------------+
  88. The polygon's fill color. If ``texture`` is defined, it will be multiplied by this color. It will also be the default color for vertices not set in ``vertex_colors``.
  89. .. _class_Polygon2D_invert_border:
  90. - :ref:`float<class_float>` **invert_border**
  91. +----------+--------------------------+
  92. | *Setter* | set_invert_border(value) |
  93. +----------+--------------------------+
  94. | *Getter* | get_invert_border() |
  95. +----------+--------------------------+
  96. Added padding applied to the bounding box when using ``invert``. Setting this value too small may result in a "Bad Polygon" error. Default value: ``100``.
  97. .. _class_Polygon2D_invert_enable:
  98. - :ref:`bool<class_bool>` **invert_enable**
  99. +----------+-------------------+
  100. | *Setter* | set_invert(value) |
  101. +----------+-------------------+
  102. | *Getter* | get_invert() |
  103. +----------+-------------------+
  104. If ``true`` polygon will be inverted, containing the area outside the defined points and extending to the ``invert_border``. Default value: ``false``.
  105. .. _class_Polygon2D_offset:
  106. - :ref:`Vector2<class_Vector2>` **offset**
  107. +----------+-------------------+
  108. | *Setter* | set_offset(value) |
  109. +----------+-------------------+
  110. | *Getter* | get_offset() |
  111. +----------+-------------------+
  112. The offset applied to each vertex.
  113. .. _class_Polygon2D_polygon:
  114. - :ref:`PoolVector2Array<class_PoolVector2Array>` **polygon**
  115. +----------+--------------------+
  116. | *Setter* | set_polygon(value) |
  117. +----------+--------------------+
  118. | *Getter* | get_polygon() |
  119. +----------+--------------------+
  120. The polygon's list of vertices. The final point will be connected to the first.
  121. .. _class_Polygon2D_skeleton:
  122. - :ref:`NodePath<class_NodePath>` **skeleton**
  123. +----------+---------------------+
  124. | *Setter* | set_skeleton(value) |
  125. +----------+---------------------+
  126. | *Getter* | get_skeleton() |
  127. +----------+---------------------+
  128. .. _class_Polygon2D_splits:
  129. - :ref:`PoolIntArray<class_PoolIntArray>` **splits**
  130. +----------+-------------------+
  131. | *Setter* | set_splits(value) |
  132. +----------+-------------------+
  133. | *Getter* | get_splits() |
  134. +----------+-------------------+
  135. .. _class_Polygon2D_texture:
  136. - :ref:`Texture<class_Texture>` **texture**
  137. +----------+--------------------+
  138. | *Setter* | set_texture(value) |
  139. +----------+--------------------+
  140. | *Getter* | get_texture() |
  141. +----------+--------------------+
  142. The polygon's fill texture. Use ``uv`` to set texture coordinates.
  143. .. _class_Polygon2D_texture_offset:
  144. - :ref:`Vector2<class_Vector2>` **texture_offset**
  145. +----------+---------------------------+
  146. | *Setter* | set_texture_offset(value) |
  147. +----------+---------------------------+
  148. | *Getter* | get_texture_offset() |
  149. +----------+---------------------------+
  150. Amount to offset the polygon's ``texture``. If ``(0, 0)`` the texture's origin (its top-left corner) will be placed at the polygon's ``position``.
  151. .. _class_Polygon2D_texture_rotation:
  152. - :ref:`float<class_float>` **texture_rotation**
  153. +----------+-------------------------------------+
  154. | *Setter* | set_texture_rotation_degrees(value) |
  155. +----------+-------------------------------------+
  156. | *Getter* | get_texture_rotation_degrees() |
  157. +----------+-------------------------------------+
  158. The texture's rotation in radians.
  159. .. _class_Polygon2D_texture_rotation_degrees:
  160. - :ref:`float<class_float>` **texture_rotation_degrees**
  161. +----------+-------------------------------------+
  162. | *Setter* | set_texture_rotation_degrees(value) |
  163. +----------+-------------------------------------+
  164. | *Getter* | get_texture_rotation_degrees() |
  165. +----------+-------------------------------------+
  166. The texture's rotation in degrees.
  167. .. _class_Polygon2D_texture_scale:
  168. - :ref:`Vector2<class_Vector2>` **texture_scale**
  169. +----------+--------------------------+
  170. | *Setter* | set_texture_scale(value) |
  171. +----------+--------------------------+
  172. | *Getter* | get_texture_scale() |
  173. +----------+--------------------------+
  174. Amount to multiply the ``uv`` coordinates when using a ``texture``. Larger values make the texture smaller, and vice versa.
  175. .. _class_Polygon2D_uv:
  176. - :ref:`PoolVector2Array<class_PoolVector2Array>` **uv**
  177. +----------+---------------+
  178. | *Setter* | set_uv(value) |
  179. +----------+---------------+
  180. | *Getter* | get_uv() |
  181. +----------+---------------+
  182. Texture coordinates for each vertex of the polygon. There should be one ``uv`` per polygon vertex. If there are fewer, undefined vertices will use ``(0, 0)``.
  183. .. _class_Polygon2D_vertex_colors:
  184. - :ref:`PoolColorArray<class_PoolColorArray>` **vertex_colors**
  185. +----------+--------------------------+
  186. | *Setter* | set_vertex_colors(value) |
  187. +----------+--------------------------+
  188. | *Getter* | get_vertex_colors() |
  189. +----------+--------------------------+
  190. 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 ``color``.
  191. Method Descriptions
  192. -------------------
  193. .. _class_Polygon2D_add_bone:
  194. - void **add_bone** **(** :ref:`NodePath<class_NodePath>` path, :ref:`PoolRealArray<class_PoolRealArray>` weights **)**
  195. .. _class_Polygon2D_clear_bones:
  196. - void **clear_bones** **(** **)**
  197. .. _class_Polygon2D_erase_bone:
  198. - void **erase_bone** **(** :ref:`int<class_int>` index **)**
  199. .. _class_Polygon2D_get_bone_count:
  200. - :ref:`int<class_int>` **get_bone_count** **(** **)** const
  201. .. _class_Polygon2D_get_bone_path:
  202. - :ref:`NodePath<class_NodePath>` **get_bone_path** **(** :ref:`int<class_int>` index **)** const
  203. .. _class_Polygon2D_get_bone_weights:
  204. - :ref:`PoolRealArray<class_PoolRealArray>` **get_bone_weights** **(** :ref:`int<class_int>` index **)** const
  205. .. _class_Polygon2D_set_bone_path:
  206. - void **set_bone_path** **(** :ref:`int<class_int>` index, :ref:`NodePath<class_NodePath>` path **)**
  207. .. _class_Polygon2D_set_bone_weights:
  208. - void **set_bone_weights** **(** :ref:`int<class_int>` index, :ref:`PoolRealArray<class_PoolRealArray>` weights **)**