| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AnimationNode" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Base class for [AnimationTree] nodes. Not related to scene 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 animation nodes mainly for use in [AnimationNodeBlendTree], otherwise [AnimationRootNode] should be used instead. |
| 9 | You can access the time information as read-only parameter which is processed and stored in the previous frame for all nodes except [AnimationNodeOutput]. |
| 10 | [b]Note:[/b] If multiple inputs exist in the [AnimationNode], which time information takes precedence depends on the type of [AnimationNode]. |
| 11 | [codeblock] |
| 12 | var current_length = $AnimationTree["parameters/AnimationNodeName/current_length"] |
| 13 | var current_position = $AnimationTree["parameters/AnimationNodeName/current_position"] |
| 14 | var current_delta = $AnimationTree["parameters/AnimationNodeName/current_delta"] |
| 15 | [/codeblock] |
| 16 | </description> |
| 17 | <tutorials> |
| 18 | <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> |
| 19 | </tutorials> |
| 20 | <methods> |
| 21 | <method name="_get_caption" qualifiers="virtual const"> |
| 22 | <return type="String" /> |
| 23 | <description> |
| 24 | When inheriting from [AnimationRootNode], implement this virtual method to override the text caption for this animation node. |
| 25 | </description> |
| 26 | </method> |
| 27 | <method name="_get_child_by_name" qualifiers="virtual const"> |
| 28 | <return type="AnimationNode" /> |
| 29 | <param index="0" name="name" type="StringName" /> |
| 30 | <description> |
| 31 | When inheriting from [AnimationRootNode], implement this virtual method to return a child animation node by its [param name]. |
| 32 | </description> |
| 33 | </method> |
| 34 | <method name="_get_child_nodes" qualifiers="virtual const"> |
| 35 | <return type="Dictionary" /> |
| 36 | <description> |
| 37 | When inheriting from [AnimationRootNode], implement this virtual method to return all child animation nodes in order as a [code]name: node[/code] dictionary. |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="_get_parameter_default_value" qualifiers="virtual const"> |
| 41 | <return type="Variant" /> |
| 42 | <param index="0" name="parameter" type="StringName" /> |
| 43 | <description> |
| 44 | When inheriting from [AnimationRootNode], implement this virtual method to return the default value of a [param parameter]. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. |
| 45 | </description> |
| 46 | </method> |
| 47 | <method name="_get_parameter_list" qualifiers="virtual const"> |
| 48 | <return type="Array" /> |
| 49 | <description> |
| 50 | When inheriting from [AnimationRootNode], implement this virtual method to return a list of the properties on this animation node. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. Format is similar to [method Object.get_property_list]. |
| 51 | </description> |
| 52 | </method> |
| 53 | <method name="_has_filter" qualifiers="virtual const"> |
| 54 | <return type="bool" /> |
| 55 | <description> |
| 56 | When inheriting from [AnimationRootNode], implement this virtual method to return whether the blend tree editor should display filter editing on this animation node. |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="_is_parameter_read_only" qualifiers="virtual const"> |
| 60 | <return type="bool" /> |
| 61 | <param index="0" name="parameter" type="StringName" /> |
| 62 | <description> |
| 63 | When inheriting from [AnimationRootNode], implement this virtual method to return whether the [param parameter] is read-only. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. |
| 64 | </description> |
| 65 | </method> |
| 66 | <method name="_process" qualifiers="virtual" deprecated="Currently this is mostly useless as there is a lack of many APIs to extend AnimationNode by GDScript. It is planned that a more flexible API using structures will be provided in the future."> |
| 67 | <return type="float" /> |
| 68 | <param index="0" name="time" type="float" /> |
| 69 | <param index="1" name="seek" type="bool" /> |
| 70 | <param index="2" name="is_external_seeking" type="bool" /> |
| 71 | <param index="3" name="test_only" type="bool" /> |
| 72 | <description> |
| 73 | When inheriting from [AnimationRootNode], implement this virtual method to run some code when this animation node is processed. The [param time] parameter is a relative delta, unless [param seek] is [code]true[/code], in which case it is absolute. |
| 74 | 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. |
| 75 | This function should return the delta. |
| 76 | </description> |
| 77 | </method> |
| 78 | <method name="add_input"> |
| 79 | <return type="bool" /> |
| 80 | <param index="0" name="name" type="String" /> |
| 81 | <description> |
| 82 | Adds an input to the animation node. This is only useful for animation nodes created for use in an [AnimationNodeBlendTree]. If the addition fails, returns [code]false[/code]. |
| 83 | </description> |
| 84 | </method> |
| 85 | <method name="blend_animation"> |
| 86 | <return type="void" /> |
| 87 | <param index="0" name="animation" type="StringName" /> |
| 88 | <param index="1" name="time" type="float" /> |
| 89 | <param index="2" name="delta" type="float" /> |
| 90 | <param index="3" name="seeked" type="bool" /> |
| 91 | <param index="4" name="is_external_seeking" type="bool" /> |
| 92 | <param index="5" name="blend" type="float" /> |
| 93 | <param index="6" name="looped_flag" type="int" enum="Animation.LoopedFlag" default="0" /> |
| 94 | <description> |
| 95 | Blends an animation by [param blend] amount (name must be valid in the linked [AnimationPlayer]). A [param time] and [param delta] may be passed, as well as whether [param seeked] happened. |
| 96 | A [param looped_flag] is used by internal processing immediately after the loop. |
| 97 | </description> |
| 98 | </method> |
| 99 | <method name="blend_input"> |
| 100 | <return type="float" /> |
| 101 | <param index="0" name="input_index" type="int" /> |
| 102 | <param index="1" name="time" type="float" /> |
| 103 | <param index="2" name="seek" type="bool" /> |
| 104 | <param index="3" name="is_external_seeking" type="bool" /> |
| 105 | <param index="4" name="blend" type="float" /> |
| 106 | <param index="5" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" /> |
| 107 | <param index="6" name="sync" type="bool" default="true" /> |
| 108 | <param index="7" name="test_only" type="bool" default="false" /> |
| 109 | <description> |
| 110 | Blends an input. This is only useful for animation nodes created for an [AnimationNodeBlendTree]. The [param time] parameter is a relative delta, unless [param seek] is [code]true[/code], in which case it is absolute. A filter mode may be optionally passed. |
| 111 | </description> |
| 112 | </method> |
| 113 | <method name="blend_node"> |
| 114 | <return type="float" /> |
| 115 | <param index="0" name="name" type="StringName" /> |
| 116 | <param index="1" name="node" type="AnimationNode" /> |
| 117 | <param index="2" name="time" type="float" /> |
| 118 | <param index="3" name="seek" type="bool" /> |
| 119 | <param index="4" name="is_external_seeking" type="bool" /> |
| 120 | <param index="5" name="blend" type="float" /> |
| 121 | <param index="6" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" /> |
| 122 | <param index="7" name="sync" type="bool" default="true" /> |
| 123 | <param index="8" name="test_only" type="bool" default="false" /> |
| 124 | <description> |
| 125 | Blend another animation node (in case this animation node contains child animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, otherwise editors will not display your animation node for addition. |
| 126 | </description> |
| 127 | </method> |
| 128 | <method name="find_input" qualifiers="const"> |
| 129 | <return type="int" /> |
| 130 | <param index="0" name="name" type="String" /> |
| 131 | <description> |
| 132 | Returns the input index which corresponds to [param name]. If not found, returns [code]-1[/code]. |
| 133 | </description> |
| 134 | </method> |
| 135 | <method name="get_input_count" qualifiers="const"> |
| 136 | <return type="int" /> |
| 137 | <description> |
| 138 | Amount of inputs in this animation node, only useful for animation nodes that go into [AnimationNodeBlendTree]. |
| 139 | </description> |
| 140 | </method> |
| 141 | <method name="get_input_name" qualifiers="const"> |
| 142 | <return type="String" /> |
| 143 | <param index="0" name="input" type="int" /> |
| 144 | <description> |
| 145 | Gets the name of an input by index. |
| 146 | </description> |
| 147 | </method> |
| 148 | <method name="get_parameter" qualifiers="const"> |
| 149 | <return type="Variant" /> |
| 150 | <param index="0" name="name" type="StringName" /> |
| 151 | <description> |
| 152 | Gets the value of a parameter. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. |
| 153 | </description> |
| 154 | </method> |
| 155 | <method name="get_processing_animation_tree_instance_id" qualifiers="const"> |
| 156 | <return type="int" /> |
| 157 | <description> |
| 158 | Returns the object id of the [AnimationTree] that owns this node. |
| 159 | [b]Note:[/b] This method should only be called from within the [method AnimationNodeExtension._process_animation_node] method, and will return an invalid id otherwise. |
| 160 | </description> |
| 161 | </method> |
| 162 | <method name="is_path_filtered" qualifiers="const"> |
| 163 | <return type="bool" /> |
| 164 | <param index="0" name="path" type="NodePath" /> |
| 165 | <description> |
| 166 | Returns [code]true[/code] if the given path is filtered. |
| 167 | </description> |
| 168 | </method> |
| 169 | <method name="is_process_testing" qualifiers="const"> |
| 170 | <return type="bool" /> |
| 171 | <description> |
| 172 | Returns [code]true[/code] if this animation node is being processed in test-only mode. |
| 173 | </description> |
| 174 | </method> |
| 175 | <method name="remove_input"> |
| 176 | <return type="void" /> |
| 177 | <param index="0" name="index" type="int" /> |
| 178 | <description> |
| 179 | Removes an input, call this only when inactive. |
| 180 | </description> |
| 181 | </method> |
| 182 | <method name="set_filter_path"> |
| 183 | <return type="void" /> |
| 184 | <param index="0" name="path" type="NodePath" /> |
| 185 | <param index="1" name="enable" type="bool" /> |
| 186 | <description> |
| 187 | Adds or removes a path for the filter. |
| 188 | </description> |
| 189 | </method> |
| 190 | <method name="set_input_name"> |
| 191 | <return type="bool" /> |
| 192 | <param index="0" name="input" type="int" /> |
| 193 | <param index="1" name="name" type="String" /> |
| 194 | <description> |
| 195 | Sets the name of the input at the given [param input] index. If the setting fails, returns [code]false[/code]. |
| 196 | </description> |
| 197 | </method> |
| 198 | <method name="set_parameter"> |
| 199 | <return type="void" /> |
| 200 | <param index="0" name="name" type="StringName" /> |
| 201 | <param index="1" name="value" type="Variant" /> |
| 202 | <description> |
| 203 | Sets a custom parameter. These are used as local memory, because resources can be reused across the tree or scenes. |
| 204 | </description> |
| 205 | </method> |
| 206 | </methods> |
| 207 | <members> |
| 208 | <member name="filter_enabled" type="bool" setter="set_filter_enabled" getter="is_filter_enabled"> |
| 209 | If [code]true[/code], filtering is enabled. |
| 210 | </member> |
| 211 | </members> |
| 212 | <signals> |
| 213 | <signal name="animation_node_removed"> |
| 214 | <param index="0" name="object_id" type="int" /> |
| 215 | <param index="1" name="name" type="String" /> |
| 216 | <description> |
| 217 | Emitted by nodes that inherit from this class and that have an internal tree when one of their animation nodes removes. The animation nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and [AnimationNodeBlendTree]. |
| 218 | </description> |
| 219 | </signal> |
| 220 | <signal name="animation_node_renamed"> |
| 221 | <param index="0" name="object_id" type="int" /> |
| 222 | <param index="1" name="old_name" type="String" /> |
| 223 | <param index="2" name="new_name" type="String" /> |
| 224 | <description> |
| 225 | Emitted by nodes that inherit from this class and that have an internal tree when one of their animation node names changes. The animation nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], and [AnimationNodeBlendTree]. |
| 226 | </description> |
| 227 | </signal> |
| 228 | <signal name="tree_changed"> |
| 229 | <description> |
| 230 | Emitted by nodes that inherit from this class and that have an internal tree when one of their animation nodes changes. The animation nodes that emit this signal are [AnimationNodeBlendSpace1D], [AnimationNodeBlendSpace2D], [AnimationNodeStateMachine], [AnimationNodeBlendTree] and [AnimationNodeTransition]. |
| 231 | </description> |
| 232 | </signal> |
| 233 | </signals> |
| 234 | <constants> |
| 235 | <constant name="FILTER_IGNORE" value="0" enum="FilterAction"> |
| 236 | Do not use filtering. |
| 237 | </constant> |
| 238 | <constant name="FILTER_PASS" value="1" enum="FilterAction"> |
| 239 | Paths matching the filter will be allowed to pass. |
| 240 | </constant> |
| 241 | <constant name="FILTER_STOP" value="2" enum="FilterAction"> |
| 242 | Paths matching the filter will be discarded. |
| 243 | </constant> |
| 244 | <constant name="FILTER_BLEND" value="3" enum="FilterAction"> |
| 245 | Paths matching the filter will be blended (by the blend value). |
| 246 | </constant> |
| 247 | </constants> |
| 248 | </class> |