123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- :github_url: hide
- .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the AnimationNodeStateMachine.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_AnimationNodeStateMachine:
- AnimationNodeStateMachine
- =========================
- **Inherits:** :ref:`AnimationRootNode<class_AnimationRootNode>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
- State machine for control of animations.
- Description
- -----------
- Contains multiple nodes representing animation states, connected in a graph. Node transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the :ref:`AnimationNodeStateMachinePlayback<class_AnimationNodeStateMachinePlayback>` object from the :ref:`AnimationTree<class_AnimationTree>` node to control it programmatically.
- **Example:**
- ::
- var state_machine = $AnimationTree.get("parameters/playback")
- state_machine.travel("some_state")
- Tutorials
- ---------
- - :doc:`../tutorials/animation/animation_tree`
- Methods
- -------
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_node<class_AnimationNodeStateMachine_method_add_node>` **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_transition<class_AnimationNodeStateMachine_method_add_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to, :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` transition **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_end_node<class_AnimationNodeStateMachine_method_get_end_node>` **(** **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`get_graph_offset<class_AnimationNodeStateMachine_method_get_graph_offset>` **(** **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`AnimationNode<class_AnimationNode>` | :ref:`get_node<class_AnimationNodeStateMachine_method_get_node>` **(** :ref:`String<class_String>` name **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_node_name<class_AnimationNodeStateMachine_method_get_node_name>` **(** :ref:`AnimationNode<class_AnimationNode>` node **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`get_node_position<class_AnimationNodeStateMachine_method_get_node_position>` **(** :ref:`String<class_String>` name **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_start_node<class_AnimationNodeStateMachine_method_get_start_node>` **(** **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` | :ref:`get_transition<class_AnimationNodeStateMachine_method_get_transition>` **(** :ref:`int<class_int>` idx **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_transition_count<class_AnimationNodeStateMachine_method_get_transition_count>` **(** **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_transition_from<class_AnimationNodeStateMachine_method_get_transition_from>` **(** :ref:`int<class_int>` idx **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_transition_to<class_AnimationNodeStateMachine_method_get_transition_to>` **(** :ref:`int<class_int>` idx **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_node<class_AnimationNodeStateMachine_method_has_node>` **(** :ref:`String<class_String>` name **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_transition<class_AnimationNodeStateMachine_method_has_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** |const| |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_node<class_AnimationNodeStateMachine_method_remove_node>` **(** :ref:`String<class_String>` name **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_transition<class_AnimationNodeStateMachine_method_remove_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_transition_by_index<class_AnimationNodeStateMachine_method_remove_transition_by_index>` **(** :ref:`int<class_int>` idx **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`rename_node<class_AnimationNodeStateMachine_method_rename_node>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`replace_node<class_AnimationNodeStateMachine_method_replace_node>` **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_end_node<class_AnimationNodeStateMachine_method_set_end_node>` **(** :ref:`String<class_String>` name **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_graph_offset<class_AnimationNodeStateMachine_method_set_graph_offset>` **(** :ref:`Vector2<class_Vector2>` offset **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_node_position<class_AnimationNodeStateMachine_method_set_node_position>` **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` position **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_start_node<class_AnimationNodeStateMachine_method_set_start_node>` **(** :ref:`String<class_String>` name **)** |
- +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Method Descriptions
- -------------------
- .. _class_AnimationNodeStateMachine_method_add_node:
- - void **add_node** **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)**
- Adds a new node to the graph. The ``position`` is used for display in the editor.
- ----
- .. _class_AnimationNodeStateMachine_method_add_transition:
- - void **add_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to, :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` transition **)**
- Adds a transition between the given nodes.
- ----
- .. _class_AnimationNodeStateMachine_method_get_end_node:
- - :ref:`String<class_String>` **get_end_node** **(** **)** |const|
- Returns the graph's end node.
- ----
- .. _class_AnimationNodeStateMachine_method_get_graph_offset:
- - :ref:`Vector2<class_Vector2>` **get_graph_offset** **(** **)** |const|
- Returns the draw offset of the graph. Used for display in the editor.
- ----
- .. _class_AnimationNodeStateMachine_method_get_node:
- - :ref:`AnimationNode<class_AnimationNode>` **get_node** **(** :ref:`String<class_String>` name **)** |const|
- Returns the animation node with the given name.
- ----
- .. _class_AnimationNodeStateMachine_method_get_node_name:
- - :ref:`String<class_String>` **get_node_name** **(** :ref:`AnimationNode<class_AnimationNode>` node **)** |const|
- Returns the given animation node's name.
- ----
- .. _class_AnimationNodeStateMachine_method_get_node_position:
- - :ref:`Vector2<class_Vector2>` **get_node_position** **(** :ref:`String<class_String>` name **)** |const|
- Returns the given node's coordinates. Used for display in the editor.
- ----
- .. _class_AnimationNodeStateMachine_method_get_start_node:
- - :ref:`String<class_String>` **get_start_node** **(** **)** |const|
- Returns the graph's end node.
- ----
- .. _class_AnimationNodeStateMachine_method_get_transition:
- - :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` **get_transition** **(** :ref:`int<class_int>` idx **)** |const|
- Returns the given transition.
- ----
- .. _class_AnimationNodeStateMachine_method_get_transition_count:
- - :ref:`int<class_int>` **get_transition_count** **(** **)** |const|
- Returns the number of connections in the graph.
- ----
- .. _class_AnimationNodeStateMachine_method_get_transition_from:
- - :ref:`String<class_String>` **get_transition_from** **(** :ref:`int<class_int>` idx **)** |const|
- Returns the given transition's start node.
- ----
- .. _class_AnimationNodeStateMachine_method_get_transition_to:
- - :ref:`String<class_String>` **get_transition_to** **(** :ref:`int<class_int>` idx **)** |const|
- Returns the given transition's end node.
- ----
- .. _class_AnimationNodeStateMachine_method_has_node:
- - :ref:`bool<class_bool>` **has_node** **(** :ref:`String<class_String>` name **)** |const|
- Returns ``true`` if the graph contains the given node.
- ----
- .. _class_AnimationNodeStateMachine_method_has_transition:
- - :ref:`bool<class_bool>` **has_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** |const|
- Returns ``true`` if there is a transition between the given nodes.
- ----
- .. _class_AnimationNodeStateMachine_method_remove_node:
- - void **remove_node** **(** :ref:`String<class_String>` name **)**
- Deletes the given node from the graph.
- ----
- .. _class_AnimationNodeStateMachine_method_remove_transition:
- - void **remove_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)**
- Deletes the transition between the two specified nodes.
- ----
- .. _class_AnimationNodeStateMachine_method_remove_transition_by_index:
- - void **remove_transition_by_index** **(** :ref:`int<class_int>` idx **)**
- Deletes the given transition by index.
- ----
- .. _class_AnimationNodeStateMachine_method_rename_node:
- - void **rename_node** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)**
- Renames the given node.
- ----
- .. _class_AnimationNodeStateMachine_method_replace_node:
- - void **replace_node** **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node **)**
- Replaces the node and keeps its transitions unchanged.
- ----
- .. _class_AnimationNodeStateMachine_method_set_end_node:
- - void **set_end_node** **(** :ref:`String<class_String>` name **)**
- Sets the given node as the graph end point.
- ----
- .. _class_AnimationNodeStateMachine_method_set_graph_offset:
- - void **set_graph_offset** **(** :ref:`Vector2<class_Vector2>` offset **)**
- Sets the draw offset of the graph. Used for display in the editor.
- ----
- .. _class_AnimationNodeStateMachine_method_set_node_position:
- - void **set_node_position** **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` position **)**
- Sets the node's coordinates. Used for display in the editor.
- ----
- .. _class_AnimationNodeStateMachine_method_set_start_node:
- - void **set_start_node** **(** :ref:`String<class_String>` name **)**
- Sets the given node as the graph start point.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|