AnimationNodeBlendSpace2D¶
Inherits: AnimationRootNode < AnimationNode < Resource < Reference < Object
在二维空间中放置的三个任意类型的AnimationNode之间线性融合。
描述¶
添加到 AnimationNodeBlendTree 的资源。
该节点允许您使用 Vector2 权重在三个动画之间进行线性混合。
您可以使用 add_blend_point 向混合空间添加顶点,并通过将 auto_triangles 设置为 true
来自动进行三角测量。否则,请使用 add_triangle 和 remove_triangle 手工创建混合空间。
教程¶
属性¶
|
||
|
||
|
||
|
||
|
||
|
||
|
方法¶
void |
add_blend_point ( AnimationRootNode node, Vector2 pos, int at_index=-1 ) |
void |
add_triangle ( int x, int y, int z, int at_index=-1 ) |
get_blend_point_count ( ) const |
|
get_blend_point_node ( int point ) const |
|
get_blend_point_position ( int point ) const |
|
get_triangle_count ( ) const |
|
get_triangle_point ( int triangle, int point ) |
|
void |
remove_blend_point ( int point ) |
void |
remove_triangle ( int triangle ) |
void |
set_blend_point_node ( int point, AnimationRootNode node ) |
void |
set_blend_point_position ( int point, Vector2 pos ) |
信号¶
triangles_updated ( )
每当创建、删除混合空间的三角形,或当其中一个顶点改变位置时发出。
枚举¶
enum BlendMode:
BLEND_MODE_INTERPOLATED = 0 --- 动画之间的插点是线性的。
BLEND_MODE_DISCRETE = 1 --- 混合空间播放混合位置最接近的节点的动画。对逐帧的2D动画很有用。
BLEND_MODE_DISCRETE_CARRY = 2 --- 类似于BLEND_MODE_DISCRETE,但在最后一个动画的播放位置开始新的动画。
属性说明¶
bool auto_triangles
Default |
|
Setter |
set_auto_triangles(value) |
Getter |
get_auto_triangles() |
如果 true
,混合空间会自动进行三角测量。每次使用 add_blend_point 和 remove_blend_point 添加或移除点时,网格都会更新。
BlendMode blend_mode
Default |
|
Setter |
set_blend_mode(value) |
Getter |
get_blend_mode() |
控制动画之间的插值。参阅 BlendMode 常量。
Vector2 max_space
Default |
|
Setter |
set_max_space(value) |
Getter |
get_max_space() |
混合空间的 X 轴和 Y 轴的点的位置上限。请参阅 add_blend_point。
Vector2 min_space
Default |
|
Setter |
set_min_space(value) |
Getter |
get_min_space() |
混合空间的 X 轴和 Y 轴的点的位置下限。请参阅 add_blend_point。
Vector2 snap
Default |
|
Setter |
set_snap(value) |
Getter |
get_snap() |
移动点时要对齐的位置增量。
String x_label
Default |
|
Setter |
set_x_label(value) |
Getter |
get_x_label() |
混合空间X轴的名称。
String y_label
Default |
|
Setter |
set_y_label(value) |
Getter |
get_y_label() |
混合空间Y轴的名称。
方法说明¶
void add_blend_point ( AnimationRootNode node, Vector2 pos, int at_index=-1 )
在 pos
设定的位置添加一个代表 node
的新点。您可以使用 at_index
参数将它插入到特定的索引中。如果您使用 at_index
的默认值,这个点会被插入到混合点数组的最后。
使用 x
、y
and z
三个点创建一个新的三角形。三角形可以重叠。您可以使用 at_index
参数在特定的索引处插入三角形。如果您使用 at_index
的默认值,该点会被插入到混合点数组的最后。
int get_blend_point_count ( ) const
返回混合空间中的点的数量。
AnimationRootNode get_blend_point_node ( int point ) const
返回索引point
处的点所引用的AnimationRootNode。
返回索引point
处的点的位置。
int get_triangle_count ( ) const
返回混合空间中三角形的数量。
返回索引point
处的点在索引triangle
的三角形中的位置。
void remove_blend_point ( int point )
从混合空间中删除索引point
处的点。
void remove_triangle ( int triangle )
从混合空间中删除索引triangle
处的三角形。
void set_blend_point_node ( int point, AnimationRootNode node )
改变索引point
处的点所引用的AnimationNode。
更新混合轴上索引point
处的点的位置。