| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AnimationNodeStateMachinePlayback" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Provides playback control for an [AnimationNodeStateMachine]. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code]. |
| 8 | [codeblocks] |
| 9 | [gdscript] |
| 10 | var state_machine = $AnimationTree.get("parameters/playback") |
| 11 | state_machine.travel("some_state") |
| 12 | [/gdscript] |
| 13 | [csharp] |
| 14 | var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>(); |
| 15 | stateMachine.Travel("some_state"); |
| 16 | [/csharp] |
| 17 | [/codeblocks] |
| 18 | </description> |
| 19 | <tutorials> |
| 20 | <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> |
| 21 | </tutorials> |
| 22 | <methods> |
| 23 | <method name="get_current_length" qualifiers="const"> |
| 24 | <return type="float" /> |
| 25 | <description> |
| 26 | Returns the current state length. |
| 27 | [b]Note:[/b] It is possible that any [AnimationRootNode] can be nodes as well as animations. This means that there can be multiple animations within a single state. Which animation length has priority depends on the nodes connected inside it. Also, if a transition does not reset, the remaining length at that point will be returned. |
| 28 | </description> |
| 29 | </method> |
| 30 | <method name="get_current_node" qualifiers="const"> |
| 31 | <return type="StringName" /> |
| 32 | <description> |
| 33 | Returns the currently playing animation state. |
| 34 | [b]Note:[/b] When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins. |
| 35 | </description> |
| 36 | </method> |
| 37 | <method name="get_current_play_position" qualifiers="const"> |
| 38 | <return type="float" /> |
| 39 | <description> |
| 40 | Returns the playback position within the current animation state. |
| 41 | </description> |
| 42 | </method> |
| 43 | <method name="get_fading_from_length" qualifiers="const"> |
| 44 | <return type="float" /> |
| 45 | <description> |
| 46 | Returns the playback state length of the node from [method get_fading_from_node]. Returns [code]0[/code] if no animation fade is occurring. |
| 47 | </description> |
| 48 | </method> |
| 49 | <method name="get_fading_from_node" qualifiers="const"> |
| 50 | <return type="StringName" /> |
| 51 | <description> |
| 52 | Returns the starting state of currently fading animation. |
| 53 | </description> |
| 54 | </method> |
| 55 | <method name="get_fading_from_play_position" qualifiers="const"> |
| 56 | <return type="float" /> |
| 57 | <description> |
| 58 | Returns the playback position of the node from [method get_fading_from_node]. Returns [code]0[/code] if no animation fade is occurring. |
| 59 | </description> |
| 60 | </method> |
| 61 | <method name="get_fading_length" qualifiers="const"> |
| 62 | <return type="float" /> |
| 63 | <description> |
| 64 | Returns the length of the current fade animation. Returns [code]0[/code] if no animation fade is occurring. |
| 65 | </description> |
| 66 | </method> |
| 67 | <method name="get_fading_position" qualifiers="const"> |
| 68 | <return type="float" /> |
| 69 | <description> |
| 70 | Returns the playback position of the current fade animation. Returns [code]0[/code] if no animation fade is occurring. |
| 71 | </description> |
| 72 | </method> |
| 73 | <method name="get_travel_path" qualifiers="const"> |
| 74 | <return type="StringName[]" /> |
| 75 | <description> |
| 76 | Returns the current travel path as computed internally by the A* algorithm. |
| 77 | </description> |
| 78 | </method> |
| 79 | <method name="is_playing" qualifiers="const"> |
| 80 | <return type="bool" /> |
| 81 | <description> |
| 82 | Returns [code]true[/code] if an animation is playing. |
| 83 | </description> |
| 84 | </method> |
| 85 | <method name="next"> |
| 86 | <return type="void" /> |
| 87 | <description> |
| 88 | If there is a next path by travel or auto advance, immediately transitions from the current state to the next state. |
| 89 | </description> |
| 90 | </method> |
| 91 | <method name="start"> |
| 92 | <return type="void" /> |
| 93 | <param index="0" name="node" type="StringName" /> |
| 94 | <param index="1" name="reset" type="bool" default="true" /> |
| 95 | <description> |
| 96 | Starts playing the given animation. |
| 97 | If [param reset] is [code]true[/code], the animation is played from the beginning. |
| 98 | </description> |
| 99 | </method> |
| 100 | <method name="stop"> |
| 101 | <return type="void" /> |
| 102 | <description> |
| 103 | Stops the currently playing animation. |
| 104 | </description> |
| 105 | </method> |
| 106 | <method name="travel"> |
| 107 | <return type="void" /> |
| 108 | <param index="0" name="to_node" type="StringName" /> |
| 109 | <param index="1" name="reset_on_teleport" type="bool" default="true" /> |
| 110 | <description> |
| 111 | Transitions from the current state to another one, following the shortest path. |
| 112 | If the path does not connect from the current state, the animation will play after the state teleports. |
| 113 | If [param reset_on_teleport] is [code]true[/code], the animation is played from the beginning when the travel cause a teleportation. |
| 114 | </description> |
| 115 | </method> |
| 116 | </methods> |
| 117 | <members> |
| 118 | <member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene" overrides="Resource" default="true" /> |
| 119 | </members> |
| 120 | <signals> |
| 121 | <signal name="state_finished"> |
| 122 | <param index="0" name="state" type="StringName" /> |
| 123 | <description> |
| 124 | Emitted when the [param state] finishes playback. If [param state] is a state machine set to grouped mode, its signals are passed through with its name prefixed. |
| 125 | If there is a crossfade, this will be fired when the influence of the [method get_fading_from_node] animation is no longer present. |
| 126 | </description> |
| 127 | </signal> |
| 128 | <signal name="state_started"> |
| 129 | <param index="0" name="state" type="StringName" /> |
| 130 | <description> |
| 131 | Emitted when the [param state] starts playback. If [param state] is a state machine set to grouped mode, its signals are passed through with its name prefixed. |
| 132 | </description> |
| 133 | </signal> |
| 134 | </signals> |
| 135 | </class> |