class_animationnodeblendspace2d.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendSpace2D.xml.
  6. .. _class_AnimationNodeBlendSpace2D:
  7. AnimationNodeBlendSpace2D
  8. =========================
  9. **Inherits:** :ref:`AnimationRootNode<class_AnimationRootNode>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A set of :ref:`AnimationRootNode<class_AnimationRootNode>`\ s placed on 2D coordinates, crossfading between the three adjacent ones. Used by :ref:`AnimationTree<class_AnimationTree>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A resource used by :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
  15. \ **AnimationNodeBlendSpace2D** represents a virtual 2D space on which :ref:`AnimationRootNode<class_AnimationRootNode>`\ s are placed. Outputs the linear blend of the three adjacent animations using a :ref:`Vector2<class_Vector2>` weight. Adjacent in this context means the three :ref:`AnimationRootNode<class_AnimationRootNode>`\ s making up the triangle that contains the current value.
  16. You can add vertices to the blend space with :ref:`add_blend_point()<class_AnimationNodeBlendSpace2D_method_add_blend_point>` and automatically triangulate it by setting :ref:`auto_triangles<class_AnimationNodeBlendSpace2D_property_auto_triangles>` to ``true``. Otherwise, use :ref:`add_triangle()<class_AnimationNodeBlendSpace2D_method_add_triangle>` and :ref:`remove_triangle()<class_AnimationNodeBlendSpace2D_method_remove_triangle>` to triangulate the blend space by hand.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  21. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  28. | :ref:`bool<class_bool>` | :ref:`auto_triangles<class_AnimationNodeBlendSpace2D_property_auto_triangles>` | ``true`` |
  29. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  30. | :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` | :ref:`blend_mode<class_AnimationNodeBlendSpace2D_property_blend_mode>` | ``0`` |
  31. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  32. | :ref:`Vector2<class_Vector2>` | :ref:`max_space<class_AnimationNodeBlendSpace2D_property_max_space>` | ``Vector2(1, 1)`` |
  33. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  34. | :ref:`Vector2<class_Vector2>` | :ref:`min_space<class_AnimationNodeBlendSpace2D_property_min_space>` | ``Vector2(-1, -1)`` |
  35. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  36. | :ref:`Vector2<class_Vector2>` | :ref:`snap<class_AnimationNodeBlendSpace2D_property_snap>` | ``Vector2(0.1, 0.1)`` |
  37. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  38. | :ref:`bool<class_bool>` | :ref:`sync<class_AnimationNodeBlendSpace2D_property_sync>` | ``false`` |
  39. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  40. | :ref:`String<class_String>` | :ref:`x_label<class_AnimationNodeBlendSpace2D_property_x_label>` | ``"x"`` |
  41. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  42. | :ref:`String<class_String>` | :ref:`y_label<class_AnimationNodeBlendSpace2D_property_y_label>` | ``"y"`` |
  43. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  44. .. rst-class:: classref-reftable-group
  45. Methods
  46. -------
  47. .. table::
  48. :widths: auto
  49. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | |void| | :ref:`add_blend_point<class_AnimationNodeBlendSpace2D_method_add_blend_point>`\ (\ node\: :ref:`AnimationRootNode<class_AnimationRootNode>`, pos\: :ref:`Vector2<class_Vector2>`, at_index\: :ref:`int<class_int>` = -1\ ) |
  51. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | |void| | :ref:`add_triangle<class_AnimationNodeBlendSpace2D_method_add_triangle>`\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`, z\: :ref:`int<class_int>`, at_index\: :ref:`int<class_int>` = -1\ ) |
  53. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`int<class_int>` | :ref:`get_blend_point_count<class_AnimationNodeBlendSpace2D_method_get_blend_point_count>`\ (\ ) |const| |
  55. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`AnimationRootNode<class_AnimationRootNode>` | :ref:`get_blend_point_node<class_AnimationNodeBlendSpace2D_method_get_blend_point_node>`\ (\ point\: :ref:`int<class_int>`\ ) |const| |
  57. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Vector2<class_Vector2>` | :ref:`get_blend_point_position<class_AnimationNodeBlendSpace2D_method_get_blend_point_position>`\ (\ point\: :ref:`int<class_int>`\ ) |const| |
  59. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`int<class_int>` | :ref:`get_triangle_count<class_AnimationNodeBlendSpace2D_method_get_triangle_count>`\ (\ ) |const| |
  61. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`int<class_int>` | :ref:`get_triangle_point<class_AnimationNodeBlendSpace2D_method_get_triangle_point>`\ (\ triangle\: :ref:`int<class_int>`, point\: :ref:`int<class_int>`\ ) |
  63. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | |void| | :ref:`remove_blend_point<class_AnimationNodeBlendSpace2D_method_remove_blend_point>`\ (\ point\: :ref:`int<class_int>`\ ) |
  65. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | |void| | :ref:`remove_triangle<class_AnimationNodeBlendSpace2D_method_remove_triangle>`\ (\ triangle\: :ref:`int<class_int>`\ ) |
  67. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | |void| | :ref:`set_blend_point_node<class_AnimationNodeBlendSpace2D_method_set_blend_point_node>`\ (\ point\: :ref:`int<class_int>`, node\: :ref:`AnimationRootNode<class_AnimationRootNode>`\ ) |
  69. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | |void| | :ref:`set_blend_point_position<class_AnimationNodeBlendSpace2D_method_set_blend_point_position>`\ (\ point\: :ref:`int<class_int>`, pos\: :ref:`Vector2<class_Vector2>`\ ) |
  71. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. .. rst-class:: classref-section-separator
  73. ----
  74. .. rst-class:: classref-descriptions-group
  75. Signals
  76. -------
  77. .. _class_AnimationNodeBlendSpace2D_signal_triangles_updated:
  78. .. rst-class:: classref-signal
  79. **triangles_updated**\ (\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_signal_triangles_updated>`
  80. Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
  81. .. rst-class:: classref-section-separator
  82. ----
  83. .. rst-class:: classref-descriptions-group
  84. Enumerations
  85. ------------
  86. .. _enum_AnimationNodeBlendSpace2D_BlendMode:
  87. .. rst-class:: classref-enumeration
  88. enum **BlendMode**: :ref:`🔗<enum_AnimationNodeBlendSpace2D_BlendMode>`
  89. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_INTERPOLATED:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **BLEND_MODE_INTERPOLATED** = ``0``
  92. The interpolation between animations is linear.
  93. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **BLEND_MODE_DISCRETE** = ``1``
  96. The blend space plays the animation of the animation node which blending position is closest to. Useful for frame-by-frame 2D animations.
  97. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE_CARRY:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **BLEND_MODE_DISCRETE_CARRY** = ``2``
  100. Similar to :ref:`BLEND_MODE_DISCRETE<class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE>`, but starts the new animation at the last animation's playback position.
  101. .. rst-class:: classref-section-separator
  102. ----
  103. .. rst-class:: classref-descriptions-group
  104. Property Descriptions
  105. ---------------------
  106. .. _class_AnimationNodeBlendSpace2D_property_auto_triangles:
  107. .. rst-class:: classref-property
  108. :ref:`bool<class_bool>` **auto_triangles** = ``true`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_auto_triangles>`
  109. .. rst-class:: classref-property-setget
  110. - |void| **set_auto_triangles**\ (\ value\: :ref:`bool<class_bool>`\ )
  111. - :ref:`bool<class_bool>` **get_auto_triangles**\ (\ )
  112. If ``true``, the blend space is triangulated automatically. The mesh updates every time you add or remove points with :ref:`add_blend_point()<class_AnimationNodeBlendSpace2D_method_add_blend_point>` and :ref:`remove_blend_point()<class_AnimationNodeBlendSpace2D_method_remove_blend_point>`.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_AnimationNodeBlendSpace2D_property_blend_mode:
  116. .. rst-class:: classref-property
  117. :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **blend_mode** = ``0`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_blend_mode>`
  118. .. rst-class:: classref-property-setget
  119. - |void| **set_blend_mode**\ (\ value\: :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>`\ )
  120. - :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **get_blend_mode**\ (\ )
  121. Controls the interpolation between animations. See :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` constants.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_AnimationNodeBlendSpace2D_property_max_space:
  125. .. rst-class:: classref-property
  126. :ref:`Vector2<class_Vector2>` **max_space** = ``Vector2(1, 1)`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_max_space>`
  127. .. rst-class:: classref-property-setget
  128. - |void| **set_max_space**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  129. - :ref:`Vector2<class_Vector2>` **get_max_space**\ (\ )
  130. The blend space's X and Y axes' upper limit for the points' position. See :ref:`add_blend_point()<class_AnimationNodeBlendSpace2D_method_add_blend_point>`.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_AnimationNodeBlendSpace2D_property_min_space:
  134. .. rst-class:: classref-property
  135. :ref:`Vector2<class_Vector2>` **min_space** = ``Vector2(-1, -1)`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_min_space>`
  136. .. rst-class:: classref-property-setget
  137. - |void| **set_min_space**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  138. - :ref:`Vector2<class_Vector2>` **get_min_space**\ (\ )
  139. The blend space's X and Y axes' lower limit for the points' position. See :ref:`add_blend_point()<class_AnimationNodeBlendSpace2D_method_add_blend_point>`.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_AnimationNodeBlendSpace2D_property_snap:
  143. .. rst-class:: classref-property
  144. :ref:`Vector2<class_Vector2>` **snap** = ``Vector2(0.1, 0.1)`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_snap>`
  145. .. rst-class:: classref-property-setget
  146. - |void| **set_snap**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  147. - :ref:`Vector2<class_Vector2>` **get_snap**\ (\ )
  148. Position increment to snap to when moving a point.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_AnimationNodeBlendSpace2D_property_sync:
  152. .. rst-class:: classref-property
  153. :ref:`bool<class_bool>` **sync** = ``false`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_sync>`
  154. .. rst-class:: classref-property-setget
  155. - |void| **set_use_sync**\ (\ value\: :ref:`bool<class_bool>`\ )
  156. - :ref:`bool<class_bool>` **is_using_sync**\ (\ )
  157. If ``false``, the blended animations' frame are stopped when the blend value is ``0``.
  158. If ``true``, forcing the blended animations to advance frame.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_AnimationNodeBlendSpace2D_property_x_label:
  162. .. rst-class:: classref-property
  163. :ref:`String<class_String>` **x_label** = ``"x"`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_x_label>`
  164. .. rst-class:: classref-property-setget
  165. - |void| **set_x_label**\ (\ value\: :ref:`String<class_String>`\ )
  166. - :ref:`String<class_String>` **get_x_label**\ (\ )
  167. Name of the blend space's X axis.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_AnimationNodeBlendSpace2D_property_y_label:
  171. .. rst-class:: classref-property
  172. :ref:`String<class_String>` **y_label** = ``"y"`` :ref:`🔗<class_AnimationNodeBlendSpace2D_property_y_label>`
  173. .. rst-class:: classref-property-setget
  174. - |void| **set_y_label**\ (\ value\: :ref:`String<class_String>`\ )
  175. - :ref:`String<class_String>` **get_y_label**\ (\ )
  176. Name of the blend space's Y axis.
  177. .. rst-class:: classref-section-separator
  178. ----
  179. .. rst-class:: classref-descriptions-group
  180. Method Descriptions
  181. -------------------
  182. .. _class_AnimationNodeBlendSpace2D_method_add_blend_point:
  183. .. rst-class:: classref-method
  184. |void| **add_blend_point**\ (\ node\: :ref:`AnimationRootNode<class_AnimationRootNode>`, pos\: :ref:`Vector2<class_Vector2>`, at_index\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_add_blend_point>`
  185. Adds a new point that represents a ``node`` at the position set by ``pos``. You can insert it at a specific index using the ``at_index`` argument. If you use the default value for ``at_index``, the point is inserted at the end of the blend points array.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_AnimationNodeBlendSpace2D_method_add_triangle:
  189. .. rst-class:: classref-method
  190. |void| **add_triangle**\ (\ x\: :ref:`int<class_int>`, y\: :ref:`int<class_int>`, z\: :ref:`int<class_int>`, at_index\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_add_triangle>`
  191. Creates a new triangle using three points ``x``, ``y``, and ``z``. Triangles can overlap. You can insert the triangle at a specific index using the ``at_index`` argument. If you use the default value for ``at_index``, the point is inserted at the end of the blend points array.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_count:
  195. .. rst-class:: classref-method
  196. :ref:`int<class_int>` **get_blend_point_count**\ (\ ) |const| :ref:`🔗<class_AnimationNodeBlendSpace2D_method_get_blend_point_count>`
  197. Returns the number of points in the blend space.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_node:
  201. .. rst-class:: classref-method
  202. :ref:`AnimationRootNode<class_AnimationRootNode>` **get_blend_point_node**\ (\ point\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AnimationNodeBlendSpace2D_method_get_blend_point_node>`
  203. Returns the :ref:`AnimationRootNode<class_AnimationRootNode>` referenced by the point at index ``point``.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_position:
  207. .. rst-class:: classref-method
  208. :ref:`Vector2<class_Vector2>` **get_blend_point_position**\ (\ point\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AnimationNodeBlendSpace2D_method_get_blend_point_position>`
  209. Returns the position of the point at index ``point``.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_AnimationNodeBlendSpace2D_method_get_triangle_count:
  213. .. rst-class:: classref-method
  214. :ref:`int<class_int>` **get_triangle_count**\ (\ ) |const| :ref:`🔗<class_AnimationNodeBlendSpace2D_method_get_triangle_count>`
  215. Returns the number of triangles in the blend space.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_AnimationNodeBlendSpace2D_method_get_triangle_point:
  219. .. rst-class:: classref-method
  220. :ref:`int<class_int>` **get_triangle_point**\ (\ triangle\: :ref:`int<class_int>`, point\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_get_triangle_point>`
  221. Returns the position of the point at index ``point`` in the triangle of index ``triangle``.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_AnimationNodeBlendSpace2D_method_remove_blend_point:
  225. .. rst-class:: classref-method
  226. |void| **remove_blend_point**\ (\ point\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_remove_blend_point>`
  227. Removes the point at index ``point`` from the blend space.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_AnimationNodeBlendSpace2D_method_remove_triangle:
  231. .. rst-class:: classref-method
  232. |void| **remove_triangle**\ (\ triangle\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_remove_triangle>`
  233. Removes the triangle at index ``triangle`` from the blend space.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_AnimationNodeBlendSpace2D_method_set_blend_point_node:
  237. .. rst-class:: classref-method
  238. |void| **set_blend_point_node**\ (\ point\: :ref:`int<class_int>`, node\: :ref:`AnimationRootNode<class_AnimationRootNode>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_set_blend_point_node>`
  239. Changes the :ref:`AnimationNode<class_AnimationNode>` referenced by the point at index ``point``.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_AnimationNodeBlendSpace2D_method_set_blend_point_position:
  243. .. rst-class:: classref-method
  244. |void| **set_blend_point_position**\ (\ point\: :ref:`int<class_int>`, pos\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_set_blend_point_position>`
  245. Updates the position of the point at index ``point`` in the blend space.
  246. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  247. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  248. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  249. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  250. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  251. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  252. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  253. .. |void| replace:: :abbr:`void (No return value.)`