class_animationnodeblendspace2d.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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. Blends linearly between three :ref:`AnimationNode<class_AnimationNode>` of any type placed in a 2D space.
  11. Description
  12. -----------
  13. A resource to add to an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
  14. This node allows you to blend linearly between three animations using a :ref:`Vector2<class_Vector2>` weight.
  15. 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 create up the blend space by hand.
  16. Tutorials
  17. ---------
  18. - :doc:`AnimationTree <../tutorials/animation/animation_tree>`
  19. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  20. Properties
  21. ----------
  22. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  23. | :ref:`bool<class_bool>` | :ref:`auto_triangles<class_AnimationNodeBlendSpace2D_property_auto_triangles>` | ``true`` |
  24. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  25. | :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` | :ref:`blend_mode<class_AnimationNodeBlendSpace2D_property_blend_mode>` | ``0`` |
  26. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  27. | :ref:`Vector2<class_Vector2>` | :ref:`max_space<class_AnimationNodeBlendSpace2D_property_max_space>` | ``Vector2(1, 1)`` |
  28. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  29. | :ref:`Vector2<class_Vector2>` | :ref:`min_space<class_AnimationNodeBlendSpace2D_property_min_space>` | ``Vector2(-1, -1)`` |
  30. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  31. | :ref:`Vector2<class_Vector2>` | :ref:`snap<class_AnimationNodeBlendSpace2D_property_snap>` | ``Vector2(0.1, 0.1)`` |
  32. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  33. | :ref:`bool<class_bool>` | :ref:`sync<class_AnimationNodeBlendSpace2D_property_sync>` | ``false`` |
  34. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  35. | :ref:`String<class_String>` | :ref:`x_label<class_AnimationNodeBlendSpace2D_property_x_label>` | ``"x"`` |
  36. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  37. | :ref:`String<class_String>` | :ref:`y_label<class_AnimationNodeBlendSpace2D_property_y_label>` | ``"y"`` |
  38. +------------------------------------------------------------+--------------------------------------------------------------------------------+-----------------------+
  39. Methods
  40. -------
  41. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`add_blend_point<class_AnimationNodeBlendSpace2D_method_add_blend_point>` **(** :ref:`AnimationRootNode<class_AnimationRootNode>` node, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` at_index=-1 **)** |
  43. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`add_triangle<class_AnimationNodeBlendSpace2D_method_add_triangle>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` at_index=-1 **)** |
  45. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_blend_point_count<class_AnimationNodeBlendSpace2D_method_get_blend_point_count>` **(** **)** |const| |
  47. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`AnimationRootNode<class_AnimationRootNode>` | :ref:`get_blend_point_node<class_AnimationNodeBlendSpace2D_method_get_blend_point_node>` **(** :ref:`int<class_int>` point **)** |const| |
  49. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Vector2<class_Vector2>` | :ref:`get_blend_point_position<class_AnimationNodeBlendSpace2D_method_get_blend_point_position>` **(** :ref:`int<class_int>` point **)** |const| |
  51. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_triangle_count<class_AnimationNodeBlendSpace2D_method_get_triangle_count>` **(** **)** |const| |
  53. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`int<class_int>` | :ref:`get_triangle_point<class_AnimationNodeBlendSpace2D_method_get_triangle_point>` **(** :ref:`int<class_int>` triangle, :ref:`int<class_int>` point **)** |
  55. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`remove_blend_point<class_AnimationNodeBlendSpace2D_method_remove_blend_point>` **(** :ref:`int<class_int>` point **)** |
  57. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`remove_triangle<class_AnimationNodeBlendSpace2D_method_remove_triangle>` **(** :ref:`int<class_int>` triangle **)** |
  59. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_blend_point_node<class_AnimationNodeBlendSpace2D_method_set_blend_point_node>` **(** :ref:`int<class_int>` point, :ref:`AnimationRootNode<class_AnimationRootNode>` node **)** |
  61. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_blend_point_position<class_AnimationNodeBlendSpace2D_method_set_blend_point_position>` **(** :ref:`int<class_int>` point, :ref:`Vector2<class_Vector2>` pos **)** |
  63. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. Signals
  65. -------
  66. .. _class_AnimationNodeBlendSpace2D_signal_triangles_updated:
  67. - **triangles_updated** **(** **)**
  68. Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
  69. Enumerations
  70. ------------
  71. .. _enum_AnimationNodeBlendSpace2D_BlendMode:
  72. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_INTERPOLATED:
  73. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE:
  74. .. _class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE_CARRY:
  75. enum **BlendMode**:
  76. - **BLEND_MODE_INTERPOLATED** = **0** --- The interpolation between animations is linear.
  77. - **BLEND_MODE_DISCRETE** = **1** --- The blend space plays the animation of the node the blending position is closest to. Useful for frame-by-frame 2D animations.
  78. - **BLEND_MODE_DISCRETE_CARRY** = **2** --- Similar to :ref:`BLEND_MODE_DISCRETE<class_AnimationNodeBlendSpace2D_constant_BLEND_MODE_DISCRETE>`, but starts the new animation at the last animation's playback position.
  79. Property Descriptions
  80. ---------------------
  81. .. _class_AnimationNodeBlendSpace2D_property_auto_triangles:
  82. - :ref:`bool<class_bool>` **auto_triangles**
  83. +-----------+---------------------------+
  84. | *Default* | ``true`` |
  85. +-----------+---------------------------+
  86. | *Setter* | set_auto_triangles(value) |
  87. +-----------+---------------------------+
  88. | *Getter* | get_auto_triangles() |
  89. +-----------+---------------------------+
  90. 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>`.
  91. ----
  92. .. _class_AnimationNodeBlendSpace2D_property_blend_mode:
  93. - :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` **blend_mode**
  94. +-----------+-----------------------+
  95. | *Default* | ``0`` |
  96. +-----------+-----------------------+
  97. | *Setter* | set_blend_mode(value) |
  98. +-----------+-----------------------+
  99. | *Getter* | get_blend_mode() |
  100. +-----------+-----------------------+
  101. Controls the interpolation between animations. See :ref:`BlendMode<enum_AnimationNodeBlendSpace2D_BlendMode>` constants.
  102. ----
  103. .. _class_AnimationNodeBlendSpace2D_property_max_space:
  104. - :ref:`Vector2<class_Vector2>` **max_space**
  105. +-----------+----------------------+
  106. | *Default* | ``Vector2(1, 1)`` |
  107. +-----------+----------------------+
  108. | *Setter* | set_max_space(value) |
  109. +-----------+----------------------+
  110. | *Getter* | get_max_space() |
  111. +-----------+----------------------+
  112. 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>`.
  113. ----
  114. .. _class_AnimationNodeBlendSpace2D_property_min_space:
  115. - :ref:`Vector2<class_Vector2>` **min_space**
  116. +-----------+----------------------+
  117. | *Default* | ``Vector2(-1, -1)`` |
  118. +-----------+----------------------+
  119. | *Setter* | set_min_space(value) |
  120. +-----------+----------------------+
  121. | *Getter* | get_min_space() |
  122. +-----------+----------------------+
  123. 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>`.
  124. ----
  125. .. _class_AnimationNodeBlendSpace2D_property_snap:
  126. - :ref:`Vector2<class_Vector2>` **snap**
  127. +-----------+-----------------------+
  128. | *Default* | ``Vector2(0.1, 0.1)`` |
  129. +-----------+-----------------------+
  130. | *Setter* | set_snap(value) |
  131. +-----------+-----------------------+
  132. | *Getter* | get_snap() |
  133. +-----------+-----------------------+
  134. Position increment to snap to when moving a point.
  135. ----
  136. .. _class_AnimationNodeBlendSpace2D_property_sync:
  137. - :ref:`bool<class_bool>` **sync**
  138. +-----------+---------------------+
  139. | *Default* | ``false`` |
  140. +-----------+---------------------+
  141. | *Setter* | set_use_sync(value) |
  142. +-----------+---------------------+
  143. | *Getter* | is_using_sync() |
  144. +-----------+---------------------+
  145. If ``false``, the blended animations' frame are stopped when the blend value is ``0``.
  146. If ``true``, forcing the blended animations to advance frame.
  147. ----
  148. .. _class_AnimationNodeBlendSpace2D_property_x_label:
  149. - :ref:`String<class_String>` **x_label**
  150. +-----------+--------------------+
  151. | *Default* | ``"x"`` |
  152. +-----------+--------------------+
  153. | *Setter* | set_x_label(value) |
  154. +-----------+--------------------+
  155. | *Getter* | get_x_label() |
  156. +-----------+--------------------+
  157. Name of the blend space's X axis.
  158. ----
  159. .. _class_AnimationNodeBlendSpace2D_property_y_label:
  160. - :ref:`String<class_String>` **y_label**
  161. +-----------+--------------------+
  162. | *Default* | ``"y"`` |
  163. +-----------+--------------------+
  164. | *Setter* | set_y_label(value) |
  165. +-----------+--------------------+
  166. | *Getter* | get_y_label() |
  167. +-----------+--------------------+
  168. Name of the blend space's Y axis.
  169. Method Descriptions
  170. -------------------
  171. .. _class_AnimationNodeBlendSpace2D_method_add_blend_point:
  172. - void **add_blend_point** **(** :ref:`AnimationRootNode<class_AnimationRootNode>` node, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` at_index=-1 **)**
  173. 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.
  174. ----
  175. .. _class_AnimationNodeBlendSpace2D_method_add_triangle:
  176. - void **add_triangle** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` at_index=-1 **)**
  177. 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.
  178. ----
  179. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_count:
  180. - :ref:`int<class_int>` **get_blend_point_count** **(** **)** |const|
  181. Returns the number of points in the blend space.
  182. ----
  183. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_node:
  184. - :ref:`AnimationRootNode<class_AnimationRootNode>` **get_blend_point_node** **(** :ref:`int<class_int>` point **)** |const|
  185. Returns the :ref:`AnimationRootNode<class_AnimationRootNode>` referenced by the point at index ``point``.
  186. ----
  187. .. _class_AnimationNodeBlendSpace2D_method_get_blend_point_position:
  188. - :ref:`Vector2<class_Vector2>` **get_blend_point_position** **(** :ref:`int<class_int>` point **)** |const|
  189. Returns the position of the point at index ``point``.
  190. ----
  191. .. _class_AnimationNodeBlendSpace2D_method_get_triangle_count:
  192. - :ref:`int<class_int>` **get_triangle_count** **(** **)** |const|
  193. Returns the number of triangles in the blend space.
  194. ----
  195. .. _class_AnimationNodeBlendSpace2D_method_get_triangle_point:
  196. - :ref:`int<class_int>` **get_triangle_point** **(** :ref:`int<class_int>` triangle, :ref:`int<class_int>` point **)**
  197. Returns the position of the point at index ``point`` in the triangle of index ``triangle``.
  198. ----
  199. .. _class_AnimationNodeBlendSpace2D_method_remove_blend_point:
  200. - void **remove_blend_point** **(** :ref:`int<class_int>` point **)**
  201. Removes the point at index ``point`` from the blend space.
  202. ----
  203. .. _class_AnimationNodeBlendSpace2D_method_remove_triangle:
  204. - void **remove_triangle** **(** :ref:`int<class_int>` triangle **)**
  205. Removes the triangle at index ``triangle`` from the blend space.
  206. ----
  207. .. _class_AnimationNodeBlendSpace2D_method_set_blend_point_node:
  208. - void **set_blend_point_node** **(** :ref:`int<class_int>` point, :ref:`AnimationRootNode<class_AnimationRootNode>` node **)**
  209. Changes the :ref:`AnimationNode<class_AnimationNode>` referenced by the point at index ``point``.
  210. ----
  211. .. _class_AnimationNodeBlendSpace2D_method_set_blend_point_position:
  212. - void **set_blend_point_position** **(** :ref:`int<class_int>` point, :ref:`Vector2<class_Vector2>` pos **)**
  213. Updates the position of the point at index ``point`` on the blend axis.
  214. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  215. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  216. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  217. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  218. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  219. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`