2018-08-21 06:35:30 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 08:44:37 +08:00
<class name= "AnimationNodeStateMachinePlayback" inherits= "Resource" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2018-08-21 06:35:30 +08:00
<brief_description >
2020-01-23 18:14:14 +08:00
Playback control for [AnimationNodeStateMachine].
2018-08-21 06:35:30 +08:00
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code].
[b]Example:[/b]
2020-07-31 22:07:26 +08:00
[codeblocks]
[gdscript]
2019-05-21 10:45:23 +08:00
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
2020-07-31 22:07:26 +08:00
[/gdscript]
[csharp]
var stateMachine = GetNode< AnimationTree> ("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
stateMachine.Travel("some_state");
[/csharp]
[/codeblocks]
2018-08-21 06:35:30 +08:00
</description>
<tutorials >
2021-11-15 17:43:07 +08:00
<link title= "AnimationTree" > $DOCS_URL/tutorials/animation/animation_tree.html</link>
2018-08-21 06:35:30 +08:00
</tutorials>
<methods >
2021-01-04 21:33:44 +08:00
<method name= "get_current_length" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2018-08-21 06:35:30 +08:00
<description >
2023-02-13 13:16:40 +08:00
Returns the current state length.
[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.
2018-08-21 06:35:30 +08:00
</description>
</method>
2021-01-04 21:33:44 +08:00
<method name= "get_current_node" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "StringName" />
2018-08-21 06:35:30 +08:00
<description >
2021-01-04 21:33:44 +08:00
Returns the currently playing animation state.
2023-02-13 13:16:40 +08:00
[b]Note:[/b] When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
2018-08-21 06:35:30 +08:00
</description>
</method>
2020-09-19 10:59:25 +08:00
<method name= "get_current_play_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "float" />
2020-09-19 10:59:25 +08:00
<description >
Returns the playback position within the current animation state.
</description>
</method>
2023-01-22 14:50:53 +08:00
<method name= "get_fading_from_node" qualifiers= "const" >
<return type= "StringName" />
<description >
Returns the starting state of currently fading animation.
</description>
</method>
2021-01-04 21:33:44 +08:00
<method name= "get_travel_path" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "PackedStringArray" />
2021-01-04 21:33:44 +08:00
<description >
Returns the current travel path as computed internally by the A* algorithm.
</description>
</method>
2018-08-21 06:35:30 +08:00
<method name= "is_playing" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2018-08-21 06:35:30 +08:00
<description >
2019-05-21 10:45:23 +08:00
Returns [code]true[/code] if an animation is playing.
2018-08-21 06:35:30 +08:00
</description>
</method>
2023-01-10 17:15:16 +08:00
<method name= "next" >
<return type= "void" />
<description >
If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
</description>
</method>
2018-08-21 06:35:30 +08:00
<method name= "start" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "node" type= "StringName" />
2023-01-10 17:15:16 +08:00
<param index= "1" name= "reset" type= "bool" default= "true" />
2018-08-21 06:35:30 +08:00
<description >
2019-05-21 10:45:23 +08:00
Starts playing the given animation.
2023-01-10 17:15:16 +08:00
If [param reset] is [code]true[/code], the animation is played from the beginning.
2018-08-21 06:35:30 +08:00
</description>
</method>
<method name= "stop" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2018-08-21 06:35:30 +08:00
<description >
2019-05-21 10:45:23 +08:00
Stops the currently playing animation.
2018-08-21 06:35:30 +08:00
</description>
</method>
<method name= "travel" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "to_node" type= "StringName" />
2023-01-10 17:15:16 +08:00
<param index= "1" name= "reset_on_teleport" type= "bool" default= "true" />
2018-08-21 06:35:30 +08:00
<description >
2019-05-21 10:45:23 +08:00
Transitions from the current state to another one, following the shortest path.
2023-01-10 17:15:16 +08:00
If the path does not connect from the current state, the animation will play after the state teleports.
If [param reset_on_teleport] is [code]true[/code], the animation is played from the beginning when the travel cause a teleportation.
2018-08-21 06:35:30 +08:00
</description>
</method>
</methods>
2019-09-03 18:44:58 +08:00
<members >
2021-12-03 03:38:49 +08:00
<member name= "resource_local_to_scene" type= "bool" setter= "set_local_to_scene" getter= "is_local_to_scene" overrides= "Resource" default= "true" />
2019-09-03 18:44:58 +08:00
</members>
2018-08-21 06:35:30 +08:00
</class>