Merge pull request #73198 from TokageItLab/anim-docs-state
Add document about animation read-only props and state length
This commit is contained in:
commit
95183c2808
3 changed files with 16 additions and 4 deletions
|
@ -17,6 +17,11 @@
|
||||||
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
|
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
|
||||||
# Alternative syntax (same result as above).
|
# Alternative syntax (same result as above).
|
||||||
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT
|
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT
|
||||||
|
|
||||||
|
# Get current state (read-only).
|
||||||
|
animation_tree.get("parameters/OneShot/active"))
|
||||||
|
# Alternative syntax (same result as above).
|
||||||
|
animation_tree["parameters/OneShot/active"]
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
// Play child animation connected to "shot" port.
|
// Play child animation connected to "shot" port.
|
||||||
|
@ -24,6 +29,9 @@
|
||||||
|
|
||||||
// Abort child animation connected to "shot" port.
|
// Abort child animation connected to "shot" port.
|
||||||
animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT);
|
animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT);
|
||||||
|
|
||||||
|
// Get current state (read-only).
|
||||||
|
animationTree.Get("parameters/OneShot/active");
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
</description>
|
</description>
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
<method name="get_current_length" qualifiers="const">
|
<method name="get_current_length" qualifiers="const">
|
||||||
<return type="float" />
|
<return type="float" />
|
||||||
<description>
|
<description>
|
||||||
|
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.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_current_node" qualifiers="const">
|
<method name="get_current_node" qualifiers="const">
|
||||||
<return type="StringName" />
|
<return type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
Returns the currently playing animation state.
|
Returns the currently playing animation state.
|
||||||
|
[b]Note:[/b] When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_current_play_position" qualifiers="const">
|
<method name="get_current_play_position" qualifiers="const">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<description>
|
<description>
|
||||||
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.
|
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.
|
||||||
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.
|
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.
|
||||||
|
[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.
|
||||||
[codeblocks]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
# Play child animation connected to "state_2" port.
|
# Play child animation connected to "state_2" port.
|
||||||
|
@ -13,12 +14,12 @@
|
||||||
# Alternative syntax (same result as above).
|
# Alternative syntax (same result as above).
|
||||||
animation_tree["parameters/Transition/transition_request"] = "state_2"
|
animation_tree["parameters/Transition/transition_request"] = "state_2"
|
||||||
|
|
||||||
# Get current state name.
|
# Get current state name (read-only).
|
||||||
animation_tree.get("parameters/Transition/current_state")
|
animation_tree.get("parameters/Transition/current_state")
|
||||||
# Alternative syntax (same result as above).
|
# Alternative syntax (same result as above).
|
||||||
animation_tree["parameters/Transition/current_state"]
|
animation_tree["parameters/Transition/current_state"]
|
||||||
|
|
||||||
# Get current state index.
|
# Get current state index (read-only).
|
||||||
animation_tree.get("parameters/Transition/current_index"))
|
animation_tree.get("parameters/Transition/current_index"))
|
||||||
# Alternative syntax (same result as above).
|
# Alternative syntax (same result as above).
|
||||||
animation_tree["parameters/Transition/current_index"]
|
animation_tree["parameters/Transition/current_index"]
|
||||||
|
@ -27,10 +28,10 @@
|
||||||
// Play child animation connected to "state_2" port.
|
// Play child animation connected to "state_2" port.
|
||||||
animationTree.Set("parameters/Transition/transition_request", "state_2");
|
animationTree.Set("parameters/Transition/transition_request", "state_2");
|
||||||
|
|
||||||
// Get current state name.
|
// Get current state name (read-only).
|
||||||
animationTree.Get("parameters/Transition/current_state");
|
animationTree.Get("parameters/Transition/current_state");
|
||||||
|
|
||||||
// Get current state index.
|
// Get current state index (read-only).
|
||||||
animationTree.Get("parameters/Transition/current_index");
|
animationTree.Get("parameters/Transition/current_index");
|
||||||
[/csharp]
|
[/csharp]
|
||||||
[/codeblocks]
|
[/codeblocks]
|
||||||
|
|
Loading…
Reference in a new issue