mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
300 lines
15 KiB
ReStructuredText
300 lines
15 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_AnimationNodeBlendTree:
|
|
|
|
AnimationNodeBlendTree
|
|
======================
|
|
|
|
**继承:** :ref:`AnimationRootNode<class_AnimationRootNode>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
用于复杂动画的许多类型 :ref:`AnimationNode<class_AnimationNode>` 的子树。由 :ref:`AnimationTree<class_AnimationTree>` 使用。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
描述
|
|
----
|
|
|
|
这个动画节点可以包含任何其他类型动画节点的子树,例如 :ref:`AnimationNodeTransition<class_AnimationNodeTransition>`\ 、\ :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`\ 、\ :ref:`AnimationNodeBlend3<class_AnimationNodeBlend3>`\ 、\ :ref:`AnimationNodeOneShot<class_AnimationNodeOneShot>` 等。这是最常用的动画节点根之一。
|
|
|
|
默认会创建一个名为 ``output`` 的 :ref:`AnimationNodeOutput<class_AnimationNodeOutput>` 节点。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
教程
|
|
----
|
|
|
|
- :doc:`使用 AnimationTree <../tutorials/animation/animation_tree>`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
属性
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------------+-------------------------------------------------------------------------+-------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`graph_offset<class_AnimationNodeBlendTree_property_graph_offset>` | ``Vector2(0, 0)`` |
|
|
+-------------------------------+-------------------------------------------------------------------------+-------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
方法
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_node<class_AnimationNodeBlendTree_method_add_node>`\ (\ name\: :ref:`StringName<class_StringName>`, node\: :ref:`AnimationNode<class_AnimationNode>`, position\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`connect_node<class_AnimationNodeBlendTree_method_connect_node>`\ (\ input_node\: :ref:`StringName<class_StringName>`, input_index\: :ref:`int<class_int>`, output_node\: :ref:`StringName<class_StringName>`\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`disconnect_node<class_AnimationNodeBlendTree_method_disconnect_node>`\ (\ input_node\: :ref:`StringName<class_StringName>`, input_index\: :ref:`int<class_int>`\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`AnimationNode<class_AnimationNode>` | :ref:`get_node<class_AnimationNodeBlendTree_method_get_node>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_node_list<class_AnimationNodeBlendTree_method_get_node_list>`\ (\ ) |const| |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_node_position<class_AnimationNodeBlendTree_method_get_node_position>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_node<class_AnimationNodeBlendTree_method_has_node>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`remove_node<class_AnimationNodeBlendTree_method_remove_node>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_node<class_AnimationNodeBlendTree_method_rename_node>`\ (\ name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_node_position<class_AnimationNodeBlendTree_method_set_node_position>`\ (\ name\: :ref:`StringName<class_StringName>`, position\: :ref:`Vector2<class_Vector2>`\ ) |
|
|
+------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
信号
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_signal_node_changed:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**node_changed**\ (\ node_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_signal_node_changed>`
|
|
|
|
当输入端口信息发生更改时发出。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
常量
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_OK:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_OK** = ``0`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_OK>`
|
|
|
|
连接成功。
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_INPUT:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_ERROR_NO_INPUT** = ``1`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_INPUT>`
|
|
|
|
输入节点为 ``null``\ 。
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_INPUT_INDEX:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_ERROR_NO_INPUT_INDEX** = ``2`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_INPUT_INDEX>`
|
|
|
|
指定的输入端口超出范围。
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_OUTPUT:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_ERROR_NO_OUTPUT** = ``3`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_NO_OUTPUT>`
|
|
|
|
输出节点为 ``null``\ 。
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_SAME_NODE:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_ERROR_SAME_NODE** = ``4`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_SAME_NODE>`
|
|
|
|
输入和输出节点相同。
|
|
|
|
.. _class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_CONNECTION_EXISTS:
|
|
|
|
.. rst-class:: classref-constant
|
|
|
|
**CONNECTION_ERROR_CONNECTION_EXISTS** = ``5`` :ref:`🔗<class_AnimationNodeBlendTree_constant_CONNECTION_ERROR_CONNECTION_EXISTS>`
|
|
|
|
指定的连接已经存在。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
属性说明
|
|
--------
|
|
|
|
.. _class_AnimationNodeBlendTree_property_graph_offset:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector2<class_Vector2>` **graph_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_AnimationNodeBlendTree_property_graph_offset>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_graph_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
|
- :ref:`Vector2<class_Vector2>` **get_graph_offset**\ (\ )
|
|
|
|
所有子动画节点的全局偏移量。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
方法说明
|
|
--------
|
|
|
|
.. _class_AnimationNodeBlendTree_method_add_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_node**\ (\ name\: :ref:`StringName<class_StringName>`, node\: :ref:`AnimationNode<class_AnimationNode>`, position\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_add_node>`
|
|
|
|
在给定的位置 ``position`` 添加一个 :ref:`AnimationNode<class_AnimationNode>`\ 。\ ``name`` 用于后续识别该创建的子动画节点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_connect_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **connect_node**\ (\ input_node\: :ref:`StringName<class_StringName>`, input_index\: :ref:`int<class_int>`, output_node\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_connect_node>`
|
|
|
|
连接一个 :ref:`AnimationNode<class_AnimationNode>` 的输出作为另一个 :ref:`AnimationNode<class_AnimationNode>` 的输入,连接在 ``input_index`` 指定的输入端口。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_disconnect_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **disconnect_node**\ (\ input_node\: :ref:`StringName<class_StringName>`, input_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_disconnect_node>`
|
|
|
|
断开连接到指定输入端的动画节点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_get_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`AnimationNode<class_AnimationNode>` **get_node**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationNodeBlendTree_method_get_node>`
|
|
|
|
返回名称为 ``name`` 的子动画节点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_get_node_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_node_list**\ (\ ) |const| :ref:`🔗<class_AnimationNodeBlendTree_method_get_node_list>`
|
|
|
|
返回包含该混合树中所有子动画节点名称的列表。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_get_node_position:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Vector2<class_Vector2>` **get_node_position**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationNodeBlendTree_method_get_node_position>`
|
|
|
|
返回名称为 ``name`` 的子动画节点的位置。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_has_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_node**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationNodeBlendTree_method_has_node>`
|
|
|
|
如果存在名称为 ``name`` 的动画子节点,则返回 ``true``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_remove_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **remove_node**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_remove_node>`
|
|
|
|
移除一个子动画节点。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_rename_node:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_node**\ (\ name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_rename_node>`
|
|
|
|
更改子动画节点的名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AnimationNodeBlendTree_method_set_node_position:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_node_position**\ (\ name\: :ref:`StringName<class_StringName>`, position\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_AnimationNodeBlendTree_method_set_node_position>`
|
|
|
|
修改子动画节点的位置。
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
|
|
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
|
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
|
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
|
|
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
|
|
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
|
|
.. |void| replace:: :abbr:`void (无返回值。)`
|