class_animationnodetransition.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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/125>`__
  43. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  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_reset<class_AnimationNodeTransition_method_is_input_reset>` **(** :ref:`int<class_int>` input **)** |const| |
  65. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`is_input_set_as_auto_advance<class_AnimationNodeTransition_method_is_input_set_as_auto_advance>` **(** :ref:`int<class_int>` input **)** |const| |
  67. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`set_input_as_auto_advance<class_AnimationNodeTransition_method_set_input_as_auto_advance>` **(** :ref:`int<class_int>` input, :ref:`bool<class_bool>` enable **)** |
  69. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`set_input_reset<class_AnimationNodeTransition_method_set_input_reset>` **(** :ref:`int<class_int>` input, :ref:`bool<class_bool>` enable **)** |
  71. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. .. rst-class:: classref-section-separator
  73. ----
  74. .. rst-class:: classref-descriptions-group
  75. Property Descriptions
  76. ---------------------
  77. .. _class_AnimationNodeTransition_property_allow_transition_to_self:
  78. .. rst-class:: classref-property
  79. :ref:`bool<class_bool>` **allow_transition_to_self** = ``false``
  80. .. rst-class:: classref-property-setget
  81. - void **set_allow_transition_to_self** **(** :ref:`bool<class_bool>` value **)**
  82. - :ref:`bool<class_bool>` **is_allow_transition_to_self** **(** **)**
  83. 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.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_AnimationNodeTransition_property_input_count:
  87. .. rst-class:: classref-property
  88. :ref:`int<class_int>` **input_count** = ``0``
  89. .. rst-class:: classref-property-setget
  90. - void **set_input_count** **(** :ref:`int<class_int>` value **)**
  91. - :ref:`int<class_int>` **get_input_count** **(** **)**
  92. The number of enabled input ports for this animation node.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_AnimationNodeTransition_property_xfade_curve:
  96. .. rst-class:: classref-property
  97. :ref:`Curve<class_Curve>` **xfade_curve**
  98. .. rst-class:: classref-property-setget
  99. - void **set_xfade_curve** **(** :ref:`Curve<class_Curve>` value **)**
  100. - :ref:`Curve<class_Curve>` **get_xfade_curve** **(** **)**
  101. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_AnimationNodeTransition_property_xfade_time:
  105. .. rst-class:: classref-property
  106. :ref:`float<class_float>` **xfade_time** = ``0.0``
  107. .. rst-class:: classref-property-setget
  108. - void **set_xfade_time** **(** :ref:`float<class_float>` value **)**
  109. - :ref:`float<class_float>` **get_xfade_time** **(** **)**
  110. Cross-fading time (in seconds) between each animation connected to the inputs.
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Method Descriptions
  115. -------------------
  116. .. _class_AnimationNodeTransition_method_is_input_reset:
  117. .. rst-class:: classref-method
  118. :ref:`bool<class_bool>` **is_input_reset** **(** :ref:`int<class_int>` input **)** |const|
  119. Returns whether the animation restarts when the animation transitions from the other animation.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_AnimationNodeTransition_method_is_input_set_as_auto_advance:
  123. .. rst-class:: classref-method
  124. :ref:`bool<class_bool>` **is_input_set_as_auto_advance** **(** :ref:`int<class_int>` input **)** |const|
  125. Returns ``true`` if auto-advance is enabled for the given ``input`` index.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_AnimationNodeTransition_method_set_input_as_auto_advance:
  129. .. rst-class:: classref-method
  130. void **set_input_as_auto_advance** **(** :ref:`int<class_int>` input, :ref:`bool<class_bool>` enable **)**
  131. 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.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_AnimationNodeTransition_method_set_input_reset:
  135. .. rst-class:: classref-method
  136. void **set_input_reset** **(** :ref:`int<class_int>` input, :ref:`bool<class_bool>` enable **)**
  137. If ``true``, the destination animation is restarted when the animation transitions.
  138. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  139. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  140. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  141. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  142. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  143. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  144. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`