AnimationNode.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimationNode" inherits="Resource" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Base resource for [AnimationTree] nodes.
  5. </brief_description>
  6. <description>
  7. Base resource for [AnimationTree] nodes. In general, it's not used directly, but you can create custom ones with custom blending formulas.
  8. Inherit this when creating nodes mainly for use in [AnimationNodeBlendTree], otherwise [AnimationRootNode] should be used instead.
  9. </description>
  10. <tutorials>
  11. <link>$DOCS_URL/tutorials/animation/animation_tree.html</link>
  12. </tutorials>
  13. <methods>
  14. <method name="add_input">
  15. <return type="void" />
  16. <argument index="0" name="name" type="String" />
  17. <description>
  18. Adds an input to the node. This is only useful for nodes created for use in an [AnimationNodeBlendTree].
  19. </description>
  20. </method>
  21. <method name="blend_animation">
  22. <return type="void" />
  23. <argument index="0" name="animation" type="String" />
  24. <argument index="1" name="time" type="float" />
  25. <argument index="2" name="delta" type="float" />
  26. <argument index="3" name="seeked" type="bool" />
  27. <argument index="4" name="blend" type="float" />
  28. <description>
  29. Blend an animation by [code]blend[/code] amount (name must be valid in the linked [AnimationPlayer]). A [code]time[/code] and [code]delta[/code] may be passed, as well as whether [code]seek[/code] happened.
  30. </description>
  31. </method>
  32. <method name="blend_input">
  33. <return type="float" />
  34. <argument index="0" name="input_index" type="int" />
  35. <argument index="1" name="time" type="float" />
  36. <argument index="2" name="seek" type="bool" />
  37. <argument index="3" name="blend" type="float" />
  38. <argument index="4" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" />
  39. <argument index="5" name="optimize" type="bool" default="true" />
  40. <description>
  41. Blend an input. This is only useful for nodes created for an [AnimationNodeBlendTree]. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute. A filter mode may be optionally passed (see [enum FilterAction] for options).
  42. </description>
  43. </method>
  44. <method name="blend_node">
  45. <return type="float" />
  46. <argument index="0" name="name" type="String" />
  47. <argument index="1" name="node" type="AnimationNode" />
  48. <argument index="2" name="time" type="float" />
  49. <argument index="3" name="seek" type="bool" />
  50. <argument index="4" name="blend" type="float" />
  51. <argument index="5" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" />
  52. <argument index="6" name="optimize" type="bool" default="true" />
  53. <description>
  54. Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition.
  55. </description>
  56. </method>
  57. <method name="get_caption" qualifiers="virtual">
  58. <return type="String" />
  59. <description>
  60. When inheriting from [AnimationRootNode], implement this virtual method to override the text caption for this node.
  61. </description>
  62. </method>
  63. <method name="get_child_by_name" qualifiers="virtual">
  64. <return type="Object" />
  65. <argument index="0" name="name" type="String" />
  66. <description>
  67. When inheriting from [AnimationRootNode], implement this virtual method to return a child node by its [code]name[/code].
  68. </description>
  69. </method>
  70. <method name="get_child_nodes" qualifiers="virtual">
  71. <return type="Dictionary" />
  72. <description>
  73. When inheriting from [AnimationRootNode], implement this virtual method to return all children nodes in order as a [code]name: node[/code] dictionary.
  74. </description>
  75. </method>
  76. <method name="get_input_count" qualifiers="const">
  77. <return type="int" />
  78. <description>
  79. Amount of inputs in this node, only useful for nodes that go into [AnimationNodeBlendTree].
  80. </description>
  81. </method>
  82. <method name="get_input_name">
  83. <return type="String" />
  84. <argument index="0" name="input" type="int" />
  85. <description>
  86. Gets the name of an input by index.
  87. </description>
  88. </method>
  89. <method name="get_parameter" qualifiers="const">
  90. <return type="Variant" />
  91. <argument index="0" name="name" type="String" />
  92. <description>
  93. Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
  94. </description>
  95. </method>
  96. <method name="get_parameter_default_value" qualifiers="virtual">
  97. <return type="Variant" />
  98. <argument index="0" name="name" type="String" />
  99. <description>
  100. When inheriting from [AnimationRootNode], implement this virtual method to return the default value of parameter "[code]name[/code]". Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
  101. </description>
  102. </method>
  103. <method name="get_parameter_list" qualifiers="virtual">
  104. <return type="Array" />
  105. <description>
  106. When inheriting from [AnimationRootNode], implement this virtual method to return a list of the properties on this node. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list].
  107. </description>
  108. </method>
  109. <method name="has_filter" qualifiers="virtual">
  110. <return type="bool" />
  111. <description>
  112. When inheriting from [AnimationRootNode], implement this virtual method to return whether the blend tree editor should display filter editing on this node.
  113. </description>
  114. </method>
  115. <method name="is_path_filtered" qualifiers="const">
  116. <return type="bool" />
  117. <argument index="0" name="path" type="NodePath" />
  118. <description>
  119. Returns whether the given path is filtered.
  120. </description>
  121. </method>
  122. <method name="process" qualifiers="virtual">
  123. <return type="void" />
  124. <argument index="0" name="time" type="float" />
  125. <argument index="1" name="seek" type="bool" />
  126. <description>
  127. When inheriting from [AnimationRootNode], implement this virtual method to run some code when this node is processed. The [code]time[/code] parameter is a relative delta, unless [code]seek[/code] is [code]true[/code], in which case it is absolute.
  128. Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory.
  129. This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).
  130. </description>
  131. </method>
  132. <method name="remove_input">
  133. <return type="void" />
  134. <argument index="0" name="index" type="int" />
  135. <description>
  136. Removes an input, call this only when inactive.
  137. </description>
  138. </method>
  139. <method name="set_filter_path">
  140. <return type="void" />
  141. <argument index="0" name="path" type="NodePath" />
  142. <argument index="1" name="enable" type="bool" />
  143. <description>
  144. Adds or removes a path for the filter.
  145. </description>
  146. </method>
  147. <method name="set_parameter">
  148. <return type="void" />
  149. <argument index="0" name="name" type="String" />
  150. <argument index="1" name="value" type="Variant" />
  151. <description>
  152. Sets a custom parameter. These are used as local memory, because resources can be reused across the tree or scenes.
  153. </description>
  154. </method>
  155. </methods>
  156. <members>
  157. <member name="filter_enabled" type="bool" setter="set_filter_enabled" getter="is_filter_enabled">
  158. If [code]true[/code], filtering is enabled.
  159. </member>
  160. </members>
  161. <signals>
  162. <signal name="removed_from_graph">
  163. <description>
  164. Emitted when the node was removed from the graph.
  165. </description>
  166. </signal>
  167. <signal name="tree_changed">
  168. <description>
  169. Emitted by nodes that inherit from this class and that have an internal tree when one of their nodes changes. The nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and [AnimationNodeBlendTree].
  170. </description>
  171. </signal>
  172. </signals>
  173. <constants>
  174. <constant name="FILTER_IGNORE" value="0" enum="FilterAction">
  175. Do not use filtering.
  176. </constant>
  177. <constant name="FILTER_PASS" value="1" enum="FilterAction">
  178. Paths matching the filter will be allowed to pass.
  179. </constant>
  180. <constant name="FILTER_STOP" value="2" enum="FilterAction">
  181. Paths matching the filter will be discarded.
  182. </constant>
  183. <constant name="FILTER_BLEND" value="3" enum="FilterAction">
  184. Paths matching the filter will be blended (by the blend value).
  185. </constant>
  186. </constants>
  187. </class>