From fd4a65df7b4b0e8241361eff6bdae5a5b494e3f8 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sun, 7 Apr 2019 07:21:31 -0400 Subject: [PATCH] Fill out some of the AnimationNode docs. The API docs for various animation nodes are pretty empty, yet the tutorial at https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html contains some details. These details should be included in the API docs so looking up a particular class actually provides some information rather than requiring the user to hunt for a different tutorial. This also links the AnimationTree tutorial and demo in the docs. I've found the TPS demo to be the best resource so far for learning how to use the AnimationTree. This should be easy to find if someone looks up the AnimationTree API docs. Finally, this fixes a param typo in AnimationNodeStateMachine. (cherry picked from commit 584288a32c49afa02e69178381ef1e2abfb5371b) --- doc/classes/AnimationNodeBlendSpace2D.xml | 2 ++ doc/classes/AnimationNodeStateMachine.xml | 7 ++++++- doc/classes/AnimationNodeStateMachinePlayback.xml | 1 + doc/classes/AnimationNodeStateMachineTransition.xml | 9 +++++++++ doc/classes/AnimationTree.xml | 2 ++ scene/animation/animation_node_state_machine.cpp | 2 +- 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/classes/AnimationNodeBlendSpace2D.xml b/doc/classes/AnimationNodeBlendSpace2D.xml index b205c01468c..1608550888f 100644 --- a/doc/classes/AnimationNodeBlendSpace2D.xml +++ b/doc/classes/AnimationNodeBlendSpace2D.xml @@ -136,8 +136,10 @@ + Useful for frame-by-frame 2D animations. + Keep the current play position when switching between discrete animations. diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml index ed4098d938e..a15efeea40b 100644 --- a/doc/classes/AnimationNodeStateMachine.xml +++ b/doc/classes/AnimationNodeStateMachine.xml @@ -3,6 +3,11 @@ + Contains multiple root nodes as children in a graph. Each node is used as a state, and provides multiple functions to alternate between states. Retrieve the AnimationNodeStateMachinePlayback object from the [AnimationTree] node to control it programatically. + [codeblock] + var state_machine = anim_tree["parameters/StateMachine/playback"] + state_machine.travel("SomeState") + [codeblock] @@ -170,7 +175,7 @@ - + diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index 6bf9504efbd..69dc7711d4c 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -47,6 +47,7 @@ + Transition from the current state to another one, while visiting all the intermediate ones. This is done via the A* algorithm. diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index e07a9fc9804..d22d417a034 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -12,16 +12,22 @@ + Turn on auto advance when this condition is set. This is a custom text field that can be filled with a variable name. The variable can be modified from code. + Turn on the transition automatically when this state is reached. This works best with [code]SWITCH_MODE_AT_END[/code]. + Don't use this transition during [method AnimationNodeStateMachinePlayback.travel] or [member auto_advance]. + Lower priority transitions are preferred when travelling through the tree via [method AnimationNodeStateMachinePlayback.travel] or [member auto_advance]. + The transition type. + The time to cross-fade between this state and the next. @@ -32,10 +38,13 @@ + Switch to the next state immediately. The current state will end and blend into the beginning of the new one. + Switch to the next state immediately, but will seek the new state to the playback position of the old state. + Wait for the current state playback to end, then switch to the beginning of the next state animation. diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml index 9a6a75079c4..d483a6604c9 100644 --- a/doc/classes/AnimationTree.xml +++ b/doc/classes/AnimationTree.xml @@ -5,6 +5,8 @@ + https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html + https://github.com/godotengine/tps-demo diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index 68ad71d01cd..1e3470cd903 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -960,7 +960,7 @@ void AnimationNodeStateMachine::_bind_methods() { ClassDB::bind_method(D_METHOD("set_end_node", "name"), &AnimationNodeStateMachine::set_end_node); ClassDB::bind_method(D_METHOD("get_end_node"), &AnimationNodeStateMachine::get_end_node); - ClassDB::bind_method(D_METHOD("set_graph_offset", "name"), &AnimationNodeStateMachine::set_graph_offset); + ClassDB::bind_method(D_METHOD("set_graph_offset", "offset"), &AnimationNodeStateMachine::set_graph_offset); ClassDB::bind_method(D_METHOD("get_graph_offset"), &AnimationNodeStateMachine::get_graph_offset); ClassDB::bind_method(D_METHOD("_tree_changed"), &AnimationNodeStateMachine::_tree_changed);