Skip to content

Commit

Permalink
Merge pull request #75759 from TokageItLab/reimplement-grouped-statem…
Browse files Browse the repository at this point in the history
…achine

Rework for nested `AnimationNodeStateMachine`
  • Loading branch information
akien-mga committed Apr 24, 2023
2 parents 4970c52 + 991e6e9 commit 13544fb
Show file tree
Hide file tree
Showing 15 changed files with 1,252 additions and 1,137 deletions.
3 changes: 3 additions & 0 deletions doc/classes/AnimationNode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<param index="0" name="time" type="float" />
<param index="1" name="seek" type="bool" />
<param index="2" name="is_external_seeking" type="bool" />
<param index="3" name="test_only" type="bool" />
<description>
When inheriting from [AnimationRootNode], implement this virtual method to run some code when this node is processed. The [param time] parameter is a relative delta, unless [param seek] is [code]true[/code], in which case it is absolute.
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.
Expand Down Expand Up @@ -97,6 +98,7 @@
<param index="4" name="blend" type="float" />
<param index="5" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" />
<param index="6" name="sync" type="bool" default="true" />
<param index="7" name="test_only" type="bool" default="false" />
<description>
Blend an input. This is only useful for 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 (see [enum FilterAction] for options).
</description>
Expand All @@ -111,6 +113,7 @@
<param index="5" name="blend" type="float" />
<param index="6" name="filter" type="int" enum="AnimationNode.FilterAction" default="0" />
<param index="7" name="sync" type="bool" default="true" />
<param index="8" name="test_only" type="bool" default="false" />
<description>
Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition.
</description>
Expand Down
18 changes: 18 additions & 0 deletions doc/classes/AnimationNodeStateMachine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,23 @@
<member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false">
If [code]true[/code], allows teleport to the self state with [method AnimationNodeStateMachinePlayback.travel]. When the reset option is enabled in [method AnimationNodeStateMachinePlayback.travel], the animation is restarted. If [code]false[/code], nothing happens on the teleportation to the self state.
</member>
<member name="reset_ends" type="bool" setter="set_reset_ends" getter="are_ends_reset" default="false">
If [code]true[/code], treat the cross-fade to the start and end nodes as a blend with the RESET animation.
In most cases, when additional cross-fades are performed in the parent [AnimationNode] of the state machine, setting this property to [code]false[/code] and matching the cross-fade time of the parent [AnimationNode] and the state machine's start node and end node gives good results.
</member>
<member name="state_machine_type" type="int" setter="set_state_machine_type" getter="get_state_machine_type" enum="AnimationNodeStateMachine.StateMachineType" default="0">
This property can define the process of transitions for different use cases. See also [enum AnimationNodeStateMachine.StateMachineType].
</member>
</members>
<constants>
<constant name="STATE_MACHINE_TYPE_ROOT" value="0" enum="StateMachineType">
Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine.
</constant>
<constant name="STATE_MACHINE_TYPE_NESTED" value="1" enum="StateMachineType">
Seeking to the beginning is treated as seeking to the beginning of the animation in the current state. Transition to the end state, or the absence of transitions in each state, is treated as exiting the state machine.
</constant>
<constant name="STATE_MACHINE_TYPE_GROUPED" value="2" enum="StateMachineType">
This is a grouped state machine that can be controlled from a parent state machine. It does not work on standalone. There must be a state machine with [member state_machine_type] of [constant STATE_MACHINE_TYPE_ROOT] or [constant STATE_MACHINE_TYPE_NESTED] in the parent or ancestor.
</constant>
</constants>
</class>
Loading

0 comments on commit 13544fb

Please sign in to comment.