AnimationNodeStateMachine¶
Inherits: AnimationRootNode < AnimationNode < Resource < Reference < Object
类别: 核心
简要说明¶
用于控制动画的状态机。
方法¶
无效 |
add_node ( String name, AnimationNode node, Vector2 position=Vector2( 0, 0 ) ) |
无效 |
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 |
|
无效 |
remove_node ( String name ) |
无效 |
remove_transition ( String from, String to ) |
无效 |
remove_transition_by_index ( int idx ) |
无效 |
rename_node ( String name, String new_name ) |
无效 |
set_end_node ( String name ) |
无效 |
set_graph_offset ( Vector2 offset ) |
无效 |
set_node_position ( String name, Vector2 position ) |
无效 |
set_start_node ( String name ) |
描述¶
包含表示动画状态的多个节点,连接在一个图形中。可以使用最短路径算法,将节点转换配置为自动进行或通过代码进行。从中检索animationNodeStateMachinePlayback对象 AnimationTree 节点以编程方式控制它。
例子:
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
方法说明¶
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 set_end_node ( String name )
将给定节点设置为图形终点。
void set_graph_offset ( Vector2 offset )
设置图形的绘制偏移。用于在编辑器中显示。
设置节点的坐标。用于在编辑器中显示。
void set_start_node ( String name )
将给定节点设置为图形起点。