class_animationtree.rst 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AnimationTree.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AnimationTree:
  6. AnimationTree
  7. =============
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. A node to be used for advanced animation transitions in an :ref:`AnimationPlayer<class_AnimationPlayer>`.
  10. Description
  11. -----------
  12. Note: When linked with an :ref:`AnimationPlayer<class_AnimationPlayer>`, several properties and methods of the corresponding :ref:`AnimationPlayer<class_AnimationPlayer>` will not function as expected. Playback and transitions should be handled using only the ``AnimationTree`` and its constituent :ref:`AnimationNode<class_AnimationNode>`\ (s). The :ref:`AnimationPlayer<class_AnimationPlayer>` node should be used solely for adding, deleting, and editing animations.
  13. Tutorials
  14. ---------
  15. - :doc:`../tutorials/animation/animation_tree`
  16. - `https://github.com/godotengine/tps-demo <https://github.com/godotengine/tps-demo>`_
  17. Properties
  18. ----------
  19. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  20. | :ref:`bool<class_bool>` | :ref:`active<class_AnimationTree_property_active>` | ``false`` |
  21. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  22. | :ref:`NodePath<class_NodePath>` | :ref:`anim_player<class_AnimationTree_property_anim_player>` | ``NodePath("")`` |
  23. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  24. | :ref:`AnimationProcessMode<enum_AnimationTree_AnimationProcessMode>` | :ref:`process_mode<class_AnimationTree_property_process_mode>` | ``1`` |
  25. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  26. | :ref:`NodePath<class_NodePath>` | :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` | ``NodePath("")`` |
  27. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  28. | :ref:`AnimationNode<class_AnimationNode>` | :ref:`tree_root<class_AnimationTree_property_tree_root>` | |
  29. +----------------------------------------------------------------------+--------------------------------------------------------------------------+------------------+
  30. Methods
  31. -------
  32. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`advance<class_AnimationTree_method_advance>` **(** :ref:`float<class_float>` delta **)** |
  34. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Transform<class_Transform>` | :ref:`get_root_motion_transform<class_AnimationTree_method_get_root_motion_transform>` **(** **)** |const| |
  36. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`rename_parameter<class_AnimationTree_method_rename_parameter>` **(** :ref:`String<class_String>` old_name, :ref:`String<class_String>` new_name **)** |
  38. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Enumerations
  40. ------------
  41. .. _enum_AnimationTree_AnimationProcessMode:
  42. .. _class_AnimationTree_constant_ANIMATION_PROCESS_PHYSICS:
  43. .. _class_AnimationTree_constant_ANIMATION_PROCESS_IDLE:
  44. .. _class_AnimationTree_constant_ANIMATION_PROCESS_MANUAL:
  45. enum **AnimationProcessMode**:
  46. - **ANIMATION_PROCESS_PHYSICS** = **0** --- The animations will progress during the physics frame (i.e. :ref:`Node._physics_process<class_Node_method__physics_process>`).
  47. - **ANIMATION_PROCESS_IDLE** = **1** --- The animations will progress during the idle frame (i.e. :ref:`Node._process<class_Node_method__process>`).
  48. - **ANIMATION_PROCESS_MANUAL** = **2** --- The animations will only progress manually (see :ref:`advance<class_AnimationTree_method_advance>`).
  49. Property Descriptions
  50. ---------------------
  51. .. _class_AnimationTree_property_active:
  52. - :ref:`bool<class_bool>` **active**
  53. +-----------+-------------------+
  54. | *Default* | ``false`` |
  55. +-----------+-------------------+
  56. | *Setter* | set_active(value) |
  57. +-----------+-------------------+
  58. | *Getter* | is_active() |
  59. +-----------+-------------------+
  60. If ``true``, the ``AnimationTree`` will be processing.
  61. ----
  62. .. _class_AnimationTree_property_anim_player:
  63. - :ref:`NodePath<class_NodePath>` **anim_player**
  64. +-----------+-----------------------------+
  65. | *Default* | ``NodePath("")`` |
  66. +-----------+-----------------------------+
  67. | *Setter* | set_animation_player(value) |
  68. +-----------+-----------------------------+
  69. | *Getter* | get_animation_player() |
  70. +-----------+-----------------------------+
  71. The path to the :ref:`AnimationPlayer<class_AnimationPlayer>` used for animating.
  72. ----
  73. .. _class_AnimationTree_property_process_mode:
  74. - :ref:`AnimationProcessMode<enum_AnimationTree_AnimationProcessMode>` **process_mode**
  75. +-----------+-------------------------+
  76. | *Default* | ``1`` |
  77. +-----------+-------------------------+
  78. | *Setter* | set_process_mode(value) |
  79. +-----------+-------------------------+
  80. | *Getter* | get_process_mode() |
  81. +-----------+-------------------------+
  82. The process mode of this ``AnimationTree``. See :ref:`AnimationProcessMode<enum_AnimationTree_AnimationProcessMode>` for available modes.
  83. ----
  84. .. _class_AnimationTree_property_root_motion_track:
  85. - :ref:`NodePath<class_NodePath>` **root_motion_track**
  86. +-----------+------------------------------+
  87. | *Default* | ``NodePath("")`` |
  88. +-----------+------------------------------+
  89. | *Setter* | set_root_motion_track(value) |
  90. +-----------+------------------------------+
  91. | *Getter* | get_root_motion_track() |
  92. +-----------+------------------------------+
  93. The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. To specify a track that controls properties or bones, append its name after the path, separated by ``":"``. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
  94. If the track has type :ref:`Animation.TYPE_TRANSFORM<class_Animation_constant_TYPE_TRANSFORM>`, the transformation will be cancelled visually, and the animation will appear to stay in place.
  95. ----
  96. .. _class_AnimationTree_property_tree_root:
  97. - :ref:`AnimationNode<class_AnimationNode>` **tree_root**
  98. +----------+----------------------+
  99. | *Setter* | set_tree_root(value) |
  100. +----------+----------------------+
  101. | *Getter* | get_tree_root() |
  102. +----------+----------------------+
  103. The root animation node of this ``AnimationTree``. See :ref:`AnimationNode<class_AnimationNode>`.
  104. Method Descriptions
  105. -------------------
  106. .. _class_AnimationTree_method_advance:
  107. - void **advance** **(** :ref:`float<class_float>` delta **)**
  108. Manually advance the animations by the specified time (in seconds).
  109. ----
  110. .. _class_AnimationTree_method_get_root_motion_transform:
  111. - :ref:`Transform<class_Transform>` **get_root_motion_transform** **(** **)** |const|
  112. Retrieve the motion of the :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` as a :ref:`Transform<class_Transform>` that can be used elsewhere. If :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` is not a path to a track of type :ref:`Animation.TYPE_TRANSFORM<class_Animation_constant_TYPE_TRANSFORM>`, returns an identity transformation.
  113. ----
  114. .. _class_AnimationTree_method_rename_parameter:
  115. - void **rename_parameter** **(** :ref:`String<class_String>` old_name, :ref:`String<class_String>` new_name **)**
  116. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  117. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  118. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`