class_animationnodetransition.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTransition.xml.
  6. .. _class_AnimationNodeTransition:
  7. AnimationNodeTransition
  8. =======================
  9. **Inherits:** :ref:`AnimationNodeSync<class_AnimationNodeSync>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A transition within an :ref:`AnimationTree<class_AnimationTree>` connecting two :ref:`AnimationNode<class_AnimationNode>`\ s.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Simple state machine for cases which don't require a more advanced :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>`. Animations can be connected to the inputs and transition times can be specified.
  15. After setting the request and changing the animation playback, the transition node automatically clears the request on the next process frame by setting its ``transition_request`` value to empty.
  16. \ **Note:** When using a cross-fade, ``current_state`` and ``current_index`` change to the next state immediately after the cross-fade begins.
  17. .. tabs::
  18. .. code-tab:: gdscript
  19. # Play child animation connected to "state_2" port.
  20. animation_tree.set("parameters/Transition/transition_request", "state_2")
  21. # Alternative syntax (same result as above).
  22. animation_tree["parameters/Transition/transition_request"] = "state_2"
  23. # Get current state name (read-only).
  24. animation_tree.get("parameters/Transition/current_state")
  25. # Alternative syntax (same result as above).
  26. animation_tree["parameters/Transition/current_state"]
  27. # Get current state index (read-only).
  28. animation_tree.get("parameters/Transition/current_index")
  29. # Alternative syntax (same result as above).
  30. animation_tree["parameters/Transition/current_index"]
  31. .. code-tab:: csharp
  32. // Play child animation connected to "state_2" port.
  33. animationTree.Set("parameters/Transition/transition_request", "state_2");
  34. // Get current state name (read-only).
  35. animationTree.Get("parameters/Transition/current_state");
  36. // Get current state index (read-only).
  37. animationTree.Get("parameters/Transition/current_index");
  38. .. rst-class:: classref-introduction-group
  39. Tutorials
  40. ---------
  41. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  42. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/2748>`__
  43. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  44. .. rst-class:: classref-reftable-group
  45. Properties
  46. ----------
  47. .. table::
  48. :widths: auto
  49. +---------------------------+--------------------------------------------------------------------------------------------------+-----------+
  50. | :ref:`bool<class_bool>` | :ref:`allow_transition_to_self<class_AnimationNodeTransition_property_allow_transition_to_self>` | ``false`` |
  51. +---------------------------+--------------------------------------------------------------------------------------------------+-----------+
  52. | :ref:`int<class_int>` | :ref:`input_count<class_AnimationNodeTransition_property_input_count>` | ``0`` |
  53. +---------------------------+--------------------------------------------------------------------------------------------------+-----------+
  54. | :ref:`Curve<class_Curve>` | :ref:`xfade_curve<class_AnimationNodeTransition_property_xfade_curve>` | |
  55. +---------------------------+--------------------------------------------------------------------------------------------------+-----------+
  56. | :ref:`float<class_float>` | :ref:`xfade_time<class_AnimationNodeTransition_property_xfade_time>` | ``0.0`` |
  57. +---------------------------+--------------------------------------------------------------------------------------------------+-----------+
  58. .. rst-class:: classref-reftable-group
  59. Methods
  60. -------
  61. .. table::
  62. :widths: auto
  63. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`is_input_loop_broken_at_end<class_AnimationNodeTransition_method_is_input_loop_broken_at_end>`\ (\ input\: :ref:`int<class_int>`\ ) |const| |
  65. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`is_input_reset<class_AnimationNodeTransition_method_is_input_reset>`\ (\ input\: :ref:`int<class_int>`\ ) |const| |
  67. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`is_input_set_as_auto_advance<class_AnimationNodeTransition_method_is_input_set_as_auto_advance>`\ (\ input\: :ref:`int<class_int>`\ ) |const| |
  69. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | |void| | :ref:`set_input_as_auto_advance<class_AnimationNodeTransition_method_set_input_as_auto_advance>`\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  71. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | |void| | :ref:`set_input_break_loop_at_end<class_AnimationNodeTransition_method_set_input_break_loop_at_end>`\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  73. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | |void| | :ref:`set_input_reset<class_AnimationNodeTransition_method_set_input_reset>`\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  75. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_AnimationNodeTransition_property_allow_transition_to_self:
  82. .. rst-class:: classref-property
  83. :ref:`bool<class_bool>` **allow_transition_to_self** = ``false`` :ref:`🔗<class_AnimationNodeTransition_property_allow_transition_to_self>`
  84. .. rst-class:: classref-property-setget
  85. - |void| **set_allow_transition_to_self**\ (\ value\: :ref:`bool<class_bool>`\ )
  86. - :ref:`bool<class_bool>` **is_allow_transition_to_self**\ (\ )
  87. If ``true``, allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If ``false``, nothing happens on the transition to the self state.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_AnimationNodeTransition_property_input_count:
  91. .. rst-class:: classref-property
  92. :ref:`int<class_int>` **input_count** = ``0`` :ref:`🔗<class_AnimationNodeTransition_property_input_count>`
  93. .. rst-class:: classref-property-setget
  94. - |void| **set_input_count**\ (\ value\: :ref:`int<class_int>`\ )
  95. - :ref:`int<class_int>` **get_input_count**\ (\ )
  96. The number of enabled input ports for this animation node.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_AnimationNodeTransition_property_xfade_curve:
  100. .. rst-class:: classref-property
  101. :ref:`Curve<class_Curve>` **xfade_curve** :ref:`🔗<class_AnimationNodeTransition_property_xfade_curve>`
  102. .. rst-class:: classref-property-setget
  103. - |void| **set_xfade_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
  104. - :ref:`Curve<class_Curve>` **get_xfade_curve**\ (\ )
  105. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_AnimationNodeTransition_property_xfade_time:
  109. .. rst-class:: classref-property
  110. :ref:`float<class_float>` **xfade_time** = ``0.0`` :ref:`🔗<class_AnimationNodeTransition_property_xfade_time>`
  111. .. rst-class:: classref-property-setget
  112. - |void| **set_xfade_time**\ (\ value\: :ref:`float<class_float>`\ )
  113. - :ref:`float<class_float>` **get_xfade_time**\ (\ )
  114. Cross-fading time (in seconds) between each animation connected to the inputs.
  115. \ **Note:** **AnimationNodeTransition** transitions the current state immediately after the start of the fading. The precise remaining time can only be inferred from the main animation. When :ref:`AnimationNodeOutput<class_AnimationNodeOutput>` is considered as the most upstream, so the :ref:`xfade_time<class_AnimationNodeTransition_property_xfade_time>` is not scaled depending on the downstream delta. See also :ref:`AnimationNodeOneShot.fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>`.
  116. .. rst-class:: classref-section-separator
  117. ----
  118. .. rst-class:: classref-descriptions-group
  119. Method Descriptions
  120. -------------------
  121. .. _class_AnimationNodeTransition_method_is_input_loop_broken_at_end:
  122. .. rst-class:: classref-method
  123. :ref:`bool<class_bool>` **is_input_loop_broken_at_end**\ (\ input\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AnimationNodeTransition_method_is_input_loop_broken_at_end>`
  124. Returns whether the animation breaks the loop at the end of the loop cycle for transition.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_AnimationNodeTransition_method_is_input_reset:
  128. .. rst-class:: classref-method
  129. :ref:`bool<class_bool>` **is_input_reset**\ (\ input\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AnimationNodeTransition_method_is_input_reset>`
  130. Returns whether the animation restarts when the animation transitions from the other animation.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_AnimationNodeTransition_method_is_input_set_as_auto_advance:
  134. .. rst-class:: classref-method
  135. :ref:`bool<class_bool>` **is_input_set_as_auto_advance**\ (\ input\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AnimationNodeTransition_method_is_input_set_as_auto_advance>`
  136. Returns ``true`` if auto-advance is enabled for the given ``input`` index.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_AnimationNodeTransition_method_set_input_as_auto_advance:
  140. .. rst-class:: classref-method
  141. |void| **set_input_as_auto_advance**\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AnimationNodeTransition_method_set_input_as_auto_advance>`
  142. Enables or disables auto-advance for the given ``input`` index. If enabled, state changes to the next input after playing the animation once. If enabled for the last input state, it loops to the first.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_AnimationNodeTransition_method_set_input_break_loop_at_end:
  146. .. rst-class:: classref-method
  147. |void| **set_input_break_loop_at_end**\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AnimationNodeTransition_method_set_input_break_loop_at_end>`
  148. If ``true``, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_AnimationNodeTransition_method_set_input_reset:
  152. .. rst-class:: classref-method
  153. |void| **set_input_reset**\ (\ input\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AnimationNodeTransition_method_set_input_reset>`
  154. If ``true``, the destination animation is restarted when the animation transitions.
  155. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  156. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  157. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  158. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  159. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  160. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  161. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  162. .. |void| replace:: :abbr:`void (No return value.)`