| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AnimationNodeTransition" inherits="AnimationNodeSync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A transition within an [AnimationTree] connecting two [AnimationNode]s. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Simple state machine for cases which don't require a more advanced [AnimationNodeStateMachine]. Animations can be connected to the inputs and transition times can be specified. |
| 8 | After setting the request and changing the animation playback, the transition node automatically clears the request on the next process frame by setting its [code]transition_request[/code] value to empty. |
| 9 | [b]Note:[/b] When using a cross-fade, [code]current_state[/code] and [code]current_index[/code] change to the next state immediately after the cross-fade begins. |
| 10 | [codeblocks] |
| 11 | [gdscript] |
| 12 | # Play child animation connected to "state_2" port. |
| 13 | animation_tree.set("parameters/Transition/transition_request", "state_2") |
| 14 | # Alternative syntax (same result as above). |
| 15 | animation_tree["parameters/Transition/transition_request"] = "state_2" |
| 16 | |
| 17 | # Get current state name (read-only). |
| 18 | animation_tree.get("parameters/Transition/current_state") |
| 19 | # Alternative syntax (same result as above). |
| 20 | animation_tree["parameters/Transition/current_state"] |
| 21 | |
| 22 | # Get current state index (read-only). |
| 23 | animation_tree.get("parameters/Transition/current_index") |
| 24 | # Alternative syntax (same result as above). |
| 25 | animation_tree["parameters/Transition/current_index"] |
| 26 | [/gdscript] |
| 27 | [csharp] |
| 28 | // Play child animation connected to "state_2" port. |
| 29 | animationTree.Set("parameters/Transition/transition_request", "state_2"); |
| 30 | |
| 31 | // Get current state name (read-only). |
| 32 | animationTree.Get("parameters/Transition/current_state"); |
| 33 | |
| 34 | // Get current state index (read-only). |
| 35 | animationTree.Get("parameters/Transition/current_index"); |
| 36 | [/csharp] |
| 37 | [/codeblocks] |
| 38 | </description> |
| 39 | <tutorials> |
| 40 | <link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> |
| 41 | <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/2748</link> |
| 42 | <link title="Third Person Shooter (TPS) Demo">https://godotengine.org/asset-library/asset/2710</link> |
| 43 | </tutorials> |
| 44 | <methods> |
| 45 | <method name="is_input_loop_broken_at_end" qualifiers="const"> |
| 46 | <return type="bool" /> |
| 47 | <param index="0" name="input" type="int" /> |
| 48 | <description> |
| 49 | Returns whether the animation breaks the loop at the end of the loop cycle for transition. |
| 50 | </description> |
| 51 | </method> |
| 52 | <method name="is_input_reset" qualifiers="const"> |
| 53 | <return type="bool" /> |
| 54 | <param index="0" name="input" type="int" /> |
| 55 | <description> |
| 56 | Returns whether the animation restarts when the animation transitions from the other animation. |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="is_input_set_as_auto_advance" qualifiers="const"> |
| 60 | <return type="bool" /> |
| 61 | <param index="0" name="input" type="int" /> |
| 62 | <description> |
| 63 | Returns [code]true[/code] if auto-advance is enabled for the given [param input] index. |
| 64 | </description> |
| 65 | </method> |
| 66 | <method name="set_input_as_auto_advance"> |
| 67 | <return type="void" /> |
| 68 | <param index="0" name="input" type="int" /> |
| 69 | <param index="1" name="enable" type="bool" /> |
| 70 | <description> |
| 71 | Enables or disables auto-advance for the given [param input] index. If enabled, state changes to the next input after playing the animation once. If enabled for the last input state, it loops to the first. |
| 72 | </description> |
| 73 | </method> |
| 74 | <method name="set_input_break_loop_at_end"> |
| 75 | <return type="void" /> |
| 76 | <param index="0" name="input" type="int" /> |
| 77 | <param index="1" name="enable" type="bool" /> |
| 78 | <description> |
| 79 | If [code]true[/code], breaks the loop at the end of the loop cycle for transition, even if the animation is looping. |
| 80 | </description> |
| 81 | </method> |
| 82 | <method name="set_input_reset"> |
| 83 | <return type="void" /> |
| 84 | <param index="0" name="input" type="int" /> |
| 85 | <param index="1" name="enable" type="bool" /> |
| 86 | <description> |
| 87 | If [code]true[/code], the destination animation is restarted when the animation transitions. |
| 88 | </description> |
| 89 | </method> |
| 90 | </methods> |
| 91 | <members> |
| 92 | <member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false"> |
| 93 | If [code]true[/code], allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If [code]false[/code], nothing happens on the transition to the self state. |
| 94 | </member> |
| 95 | <member name="input_count" type="int" setter="set_input_count" getter="get_input_count" default="0"> |
| 96 | The number of enabled input ports for this animation node. |
| 97 | </member> |
| 98 | <member name="xfade_curve" type="Curve" setter="set_xfade_curve" getter="get_xfade_curve"> |
| 99 | Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit [Curve]. |
| 100 | </member> |
| 101 | <member name="xfade_time" type="float" setter="set_xfade_time" getter="get_xfade_time" default="0.0"> |
| 102 | Cross-fading time (in seconds) between each animation connected to the inputs. |
| 103 | [b]Note:[/b] [AnimationNodeTransition] transitions the current state immediately after the start of the fading. The precise remaining time can only be inferred from the main animation. When [AnimationNodeOutput] is considered as the most upstream, so the [member xfade_time] is not scaled depending on the downstream delta. See also [member AnimationNodeOneShot.fadeout_time]. |
| 104 | </member> |
| 105 | </members> |
| 106 | </class> |