AnimationNodeStateMachine¶
Inherits: AnimationRootNode < AnimationNode < Resource < Reference < Object
用于控制动画的状态机。
描述¶
包含代表动画状态的多个节点,以图的形式连接。节点转换可以配置为自动发生或通过代码,使用最短路径算法。从AnimationTree节点中检索AnimationNodeStateMachinePlayback对象,对其进行编程控制。
示例:
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
教程¶
方法¶
void |
add_node ( String name, AnimationNode node, Vector2 position=Vector2( 0, 0 ) ) |
void |
add_transition ( String from, String to, AnimationNodeStateMachineTransition transition ) |
get_end_node ( ) const |
|
get_graph_offset ( ) const |
|
get_node_name ( AnimationNode node ) const |
|
get_node_position ( String name ) const |
|
get_start_node ( ) const |
|
get_transition ( int idx ) const |
|
get_transition_count ( ) const |
|
get_transition_from ( int idx ) const |
|
get_transition_to ( int idx ) const |
|
has_transition ( String from, String to ) const |
|
void |
remove_node ( String name ) |
void |
remove_transition ( String from, String to ) |
void |
remove_transition_by_index ( int idx ) |
void |
rename_node ( String name, String new_name ) |
void |
replace_node ( String name, AnimationNode node ) |
void |
set_end_node ( String name ) |
void |
set_graph_offset ( Vector2 offset ) |
void |
set_node_position ( String name, Vector2 position ) |
void |
set_start_node ( String name ) |
方法说明¶
void add_node ( String name, AnimationNode node, Vector2 position=Vector2( 0, 0 ) )
向图中添加一个新节点。 position
用于在编辑器中显示。
void add_transition ( String from, String to, AnimationNodeStateMachineTransition transition )
在给定节点之间添加一个过渡。
String get_end_node ( ) const
返回图的末端节点。
Vector2 get_graph_offset ( ) const
返回图形的绘制偏移。用于编辑器中的显示。
AnimationNode get_node ( String name ) const
返回指定名称的动画节点。
String get_node_name ( AnimationNode node ) const
返回指定动画节点的名称。
返回给定的节点的坐标。用于编辑器中的显示。
String get_start_node ( ) const
返回图的末端节点。
AnimationNodeStateMachineTransition get_transition ( int idx ) const
返回给定的过渡。
int get_transition_count ( ) const
返回图中的连接数。
返回给定过渡的开始节点。
返回给定过渡的端节点。
如果图中包含给定的节点,返回true
。
如果在给定节点之间存在过渡,返回true
。
void remove_node ( String name )
从图中删除指定的节点。
删除两个指定节点之间的过渡。
void remove_transition_by_index ( int idx )
按索引删除给定的过渡。
重命名给定的节点。
void replace_node ( String name, AnimationNode node )
替换节点并保持其过渡不变。
void set_end_node ( String name )
将给定的节点设置为图形的端点。
void set_graph_offset ( Vector2 offset )
设置图形的绘制偏移。用于编辑器中的显示。
设置节点的坐标。用于编辑器中的显示。
void set_start_node ( String name )
将给定的节点设置为图形的起始点。