AnimationNodeBlendSpace2D.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimationNodeBlendSpace2D" inherits="AnimationRootNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. A set of [AnimationRootNode]s placed on 2D coordinates, crossfading between the three adjacent ones. Used by [AnimationTree].
  5. </brief_description>
  6. <description>
  7. A resource used by [AnimationNodeBlendTree].
  8. [AnimationNodeBlendSpace1D] represents a virtual 2D space on which [AnimationRootNode]s are placed. Outputs the linear blend of the three adjacent animations using a [Vector2] weight. Adjacent in this context means the three [AnimationRootNode]s making up the triangle that contains the current value.
  9. You can add vertices to the blend space with [method add_blend_point] and automatically triangulate it by setting [member auto_triangles] to [code]true[/code]. Otherwise, use [method add_triangle] and [method remove_triangle] to triangulate the blend space by hand.
  10. </description>
  11. <tutorials>
  12. <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link>
  13. <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
  14. </tutorials>
  15. <methods>
  16. <method name="add_blend_point">
  17. <return type="void" />
  18. <param index="0" name="node" type="AnimationRootNode" />
  19. <param index="1" name="pos" type="Vector2" />
  20. <param index="2" name="at_index" type="int" default="-1" />
  21. <description>
  22. Adds a new point that represents a [param node] at the position set by [param pos]. You can insert it at a specific index using the [param at_index] argument. If you use the default value for [param at_index], the point is inserted at the end of the blend points array.
  23. </description>
  24. </method>
  25. <method name="add_triangle">
  26. <return type="void" />
  27. <param index="0" name="x" type="int" />
  28. <param index="1" name="y" type="int" />
  29. <param index="2" name="z" type="int" />
  30. <param index="3" name="at_index" type="int" default="-1" />
  31. <description>
  32. Creates a new triangle using three points [param x], [param y], and [param z]. Triangles can overlap. You can insert the triangle at a specific index using the [param at_index] argument. If you use the default value for [param at_index], the point is inserted at the end of the blend points array.
  33. </description>
  34. </method>
  35. <method name="get_blend_point_count" qualifiers="const">
  36. <return type="int" />
  37. <description>
  38. Returns the number of points in the blend space.
  39. </description>
  40. </method>
  41. <method name="get_blend_point_node" qualifiers="const">
  42. <return type="AnimationRootNode" />
  43. <param index="0" name="point" type="int" />
  44. <description>
  45. Returns the [AnimationRootNode] referenced by the point at index [param point].
  46. </description>
  47. </method>
  48. <method name="get_blend_point_position" qualifiers="const">
  49. <return type="Vector2" />
  50. <param index="0" name="point" type="int" />
  51. <description>
  52. Returns the position of the point at index [param point].
  53. </description>
  54. </method>
  55. <method name="get_triangle_count" qualifiers="const">
  56. <return type="int" />
  57. <description>
  58. Returns the number of triangles in the blend space.
  59. </description>
  60. </method>
  61. <method name="get_triangle_point">
  62. <return type="int" />
  63. <param index="0" name="triangle" type="int" />
  64. <param index="1" name="point" type="int" />
  65. <description>
  66. Returns the position of the point at index [param point] in the triangle of index [param triangle].
  67. </description>
  68. </method>
  69. <method name="remove_blend_point">
  70. <return type="void" />
  71. <param index="0" name="point" type="int" />
  72. <description>
  73. Removes the point at index [param point] from the blend space.
  74. </description>
  75. </method>
  76. <method name="remove_triangle">
  77. <return type="void" />
  78. <param index="0" name="triangle" type="int" />
  79. <description>
  80. Removes the triangle at index [param triangle] from the blend space.
  81. </description>
  82. </method>
  83. <method name="set_blend_point_node">
  84. <return type="void" />
  85. <param index="0" name="point" type="int" />
  86. <param index="1" name="node" type="AnimationRootNode" />
  87. <description>
  88. Changes the [AnimationNode] referenced by the point at index [param point].
  89. </description>
  90. </method>
  91. <method name="set_blend_point_position">
  92. <return type="void" />
  93. <param index="0" name="point" type="int" />
  94. <param index="1" name="pos" type="Vector2" />
  95. <description>
  96. Updates the position of the point at index [param point] on the blend axis.
  97. </description>
  98. </method>
  99. </methods>
  100. <members>
  101. <member name="auto_triangles" type="bool" setter="set_auto_triangles" getter="get_auto_triangles" default="true">
  102. If [code]true[/code], the blend space is triangulated automatically. The mesh updates every time you add or remove points with [method add_blend_point] and [method remove_blend_point].
  103. </member>
  104. <member name="blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="AnimationNodeBlendSpace2D.BlendMode" default="0">
  105. Controls the interpolation between animations. See [enum BlendMode] constants.
  106. </member>
  107. <member name="max_space" type="Vector2" setter="set_max_space" getter="get_max_space" default="Vector2(1, 1)">
  108. The blend space's X and Y axes' upper limit for the points' position. See [method add_blend_point].
  109. </member>
  110. <member name="min_space" type="Vector2" setter="set_min_space" getter="get_min_space" default="Vector2(-1, -1)">
  111. The blend space's X and Y axes' lower limit for the points' position. See [method add_blend_point].
  112. </member>
  113. <member name="snap" type="Vector2" setter="set_snap" getter="get_snap" default="Vector2(0.1, 0.1)">
  114. Position increment to snap to when moving a point.
  115. </member>
  116. <member name="sync" type="bool" setter="set_use_sync" getter="is_using_sync" default="false">
  117. If [code]false[/code], the blended animations' frame are stopped when the blend value is [code]0[/code].
  118. If [code]true[/code], forcing the blended animations to advance frame.
  119. </member>
  120. <member name="x_label" type="String" setter="set_x_label" getter="get_x_label" default="&quot;x&quot;">
  121. Name of the blend space's X axis.
  122. </member>
  123. <member name="y_label" type="String" setter="set_y_label" getter="get_y_label" default="&quot;y&quot;">
  124. Name of the blend space's Y axis.
  125. </member>
  126. </members>
  127. <signals>
  128. <signal name="triangles_updated">
  129. <description>
  130. Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.
  131. </description>
  132. </signal>
  133. </signals>
  134. <constants>
  135. <constant name="BLEND_MODE_INTERPOLATED" value="0" enum="BlendMode">
  136. The interpolation between animations is linear.
  137. </constant>
  138. <constant name="BLEND_MODE_DISCRETE" value="1" enum="BlendMode">
  139. The blend space plays the animation of the animation node which blending position is closest to. Useful for frame-by-frame 2D animations.
  140. </constant>
  141. <constant name="BLEND_MODE_DISCRETE_CARRY" value="2" enum="BlendMode">
  142. Similar to [constant BLEND_MODE_DISCRETE], but starts the new animation at the last animation's playback position.
  143. </constant>
  144. </constants>
  145. </class>