class_animationnodestatemachinetransition.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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/AnimationNodeStateMachineTransition.xml.
  6. .. _class_AnimationNodeStateMachineTransition:
  7. AnimationNodeStateMachineTransition
  8. ===================================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A transition within an :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` connecting two :ref:`AnimationRootNode<class_AnimationRootNode>`\ s.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The path generated when using :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>` is limited to the nodes connected by **AnimationNodeStateMachineTransition**.
  15. You can set the timing and conditions of the transition in detail.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  26. | :ref:`StringName<class_StringName>` | :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` | ``&""`` |
  27. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  28. | :ref:`String<class_String>` | :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` | ``""`` |
  29. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  30. | :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` | :ref:`advance_mode<class_AnimationNodeStateMachineTransition_property_advance_mode>` | ``1`` |
  31. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  32. | :ref:`bool<class_bool>` | :ref:`break_loop_at_end<class_AnimationNodeStateMachineTransition_property_break_loop_at_end>` | ``false`` |
  33. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  34. | :ref:`int<class_int>` | :ref:`priority<class_AnimationNodeStateMachineTransition_property_priority>` | ``1`` |
  35. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  36. | :ref:`bool<class_bool>` | :ref:`reset<class_AnimationNodeStateMachineTransition_property_reset>` | ``true`` |
  37. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  38. | :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` | :ref:`switch_mode<class_AnimationNodeStateMachineTransition_property_switch_mode>` | ``0`` |
  39. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  40. | :ref:`Curve<class_Curve>` | :ref:`xfade_curve<class_AnimationNodeStateMachineTransition_property_xfade_curve>` | |
  41. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  42. | :ref:`float<class_float>` | :ref:`xfade_time<class_AnimationNodeStateMachineTransition_property_xfade_time>` | ``0.0`` |
  43. +--------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------+
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Signals
  48. -------
  49. .. _class_AnimationNodeStateMachineTransition_signal_advance_condition_changed:
  50. .. rst-class:: classref-signal
  51. **advance_condition_changed**\ (\ ) :ref:`🔗<class_AnimationNodeStateMachineTransition_signal_advance_condition_changed>`
  52. Emitted when :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` is changed.
  53. .. rst-class:: classref-section-separator
  54. ----
  55. .. rst-class:: classref-descriptions-group
  56. Enumerations
  57. ------------
  58. .. _enum_AnimationNodeStateMachineTransition_SwitchMode:
  59. .. rst-class:: classref-enumeration
  60. enum **SwitchMode**: :ref:`🔗<enum_AnimationNodeStateMachineTransition_SwitchMode>`
  61. .. _class_AnimationNodeStateMachineTransition_constant_SWITCH_MODE_IMMEDIATE:
  62. .. rst-class:: classref-enumeration-constant
  63. :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` **SWITCH_MODE_IMMEDIATE** = ``0``
  64. Switch to the next state immediately. The current state will end and blend into the beginning of the new one.
  65. .. _class_AnimationNodeStateMachineTransition_constant_SWITCH_MODE_SYNC:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` **SWITCH_MODE_SYNC** = ``1``
  68. Switch to the next state immediately, but will seek the new state to the playback position of the old state.
  69. .. _class_AnimationNodeStateMachineTransition_constant_SWITCH_MODE_AT_END:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` **SWITCH_MODE_AT_END** = ``2``
  72. Wait for the current state playback to end, then switch to the beginning of the next state animation.
  73. .. rst-class:: classref-item-separator
  74. ----
  75. .. _enum_AnimationNodeStateMachineTransition_AdvanceMode:
  76. .. rst-class:: classref-enumeration
  77. enum **AdvanceMode**: :ref:`🔗<enum_AnimationNodeStateMachineTransition_AdvanceMode>`
  78. .. _class_AnimationNodeStateMachineTransition_constant_ADVANCE_MODE_DISABLED:
  79. .. rst-class:: classref-enumeration-constant
  80. :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **ADVANCE_MODE_DISABLED** = ``0``
  81. Don't use this transition.
  82. .. _class_AnimationNodeStateMachineTransition_constant_ADVANCE_MODE_ENABLED:
  83. .. rst-class:: classref-enumeration-constant
  84. :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **ADVANCE_MODE_ENABLED** = ``1``
  85. Only use this transition during :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>`.
  86. .. _class_AnimationNodeStateMachineTransition_constant_ADVANCE_MODE_AUTO:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **ADVANCE_MODE_AUTO** = ``2``
  89. Automatically use this transition if the :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` and :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` checks are ``true`` (if assigned).
  90. .. rst-class:: classref-section-separator
  91. ----
  92. .. rst-class:: classref-descriptions-group
  93. Property Descriptions
  94. ---------------------
  95. .. _class_AnimationNodeStateMachineTransition_property_advance_condition:
  96. .. rst-class:: classref-property
  97. :ref:`StringName<class_StringName>` **advance_condition** = ``&""`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_advance_condition>`
  98. .. rst-class:: classref-property-setget
  99. - |void| **set_advance_condition**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  100. - :ref:`StringName<class_StringName>` **get_advance_condition**\ (\ )
  101. Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the :ref:`AnimationTree<class_AnimationTree>` that can be controlled from code (see `Using AnimationTree <../tutorials/animation/animation_tree.html#controlling-from-code>`__). For example, if :ref:`AnimationTree.tree_root<class_AnimationTree_property_tree_root>` is an :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` and :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` is set to ``"idle"``:
  102. .. tabs::
  103. .. code-tab:: gdscript
  104. $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0))
  105. .. code-tab:: csharp
  106. GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.X == 0));
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_AnimationNodeStateMachineTransition_property_advance_expression:
  110. .. rst-class:: classref-property
  111. :ref:`String<class_String>` **advance_expression** = ``""`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_advance_expression>`
  112. .. rst-class:: classref-property-setget
  113. - |void| **set_advance_expression**\ (\ value\: :ref:`String<class_String>`\ )
  114. - :ref:`String<class_String>` **get_advance_expression**\ (\ )
  115. Use an expression as a condition for state machine transitions. It is possible to create complex animation advance conditions for switching between states and gives much greater flexibility for creating complex state machines by directly interfacing with the script code.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_AnimationNodeStateMachineTransition_property_advance_mode:
  119. .. rst-class:: classref-property
  120. :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **advance_mode** = ``1`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_advance_mode>`
  121. .. rst-class:: classref-property-setget
  122. - |void| **set_advance_mode**\ (\ value\: :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>`\ )
  123. - :ref:`AdvanceMode<enum_AnimationNodeStateMachineTransition_AdvanceMode>` **get_advance_mode**\ (\ )
  124. Determines whether the transition should be disabled, enabled when using :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>`, or traversed automatically if the :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` and :ref:`advance_expression<class_AnimationNodeStateMachineTransition_property_advance_expression>` checks are ``true`` (if assigned).
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_AnimationNodeStateMachineTransition_property_break_loop_at_end:
  128. .. rst-class:: classref-property
  129. :ref:`bool<class_bool>` **break_loop_at_end** = ``false`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_break_loop_at_end>`
  130. .. rst-class:: classref-property-setget
  131. - |void| **set_break_loop_at_end**\ (\ value\: :ref:`bool<class_bool>`\ )
  132. - :ref:`bool<class_bool>` **is_loop_broken_at_end**\ (\ )
  133. If ``true``, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_AnimationNodeStateMachineTransition_property_priority:
  137. .. rst-class:: classref-property
  138. :ref:`int<class_int>` **priority** = ``1`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_priority>`
  139. .. rst-class:: classref-property-setget
  140. - |void| **set_priority**\ (\ value\: :ref:`int<class_int>`\ )
  141. - :ref:`int<class_int>` **get_priority**\ (\ )
  142. Lower priority transitions are preferred when travelling through the tree via :ref:`AnimationNodeStateMachinePlayback.travel<class_AnimationNodeStateMachinePlayback_method_travel>` or :ref:`advance_mode<class_AnimationNodeStateMachineTransition_property_advance_mode>` is set to :ref:`ADVANCE_MODE_AUTO<class_AnimationNodeStateMachineTransition_constant_ADVANCE_MODE_AUTO>`.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_AnimationNodeStateMachineTransition_property_reset:
  146. .. rst-class:: classref-property
  147. :ref:`bool<class_bool>` **reset** = ``true`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_reset>`
  148. .. rst-class:: classref-property-setget
  149. - |void| **set_reset**\ (\ value\: :ref:`bool<class_bool>`\ )
  150. - :ref:`bool<class_bool>` **is_reset**\ (\ )
  151. If ``true``, the destination animation is played back from the beginning when switched.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_AnimationNodeStateMachineTransition_property_switch_mode:
  155. .. rst-class:: classref-property
  156. :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` **switch_mode** = ``0`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_switch_mode>`
  157. .. rst-class:: classref-property-setget
  158. - |void| **set_switch_mode**\ (\ value\: :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>`\ )
  159. - :ref:`SwitchMode<enum_AnimationNodeStateMachineTransition_SwitchMode>` **get_switch_mode**\ (\ )
  160. The transition type.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_AnimationNodeStateMachineTransition_property_xfade_curve:
  164. .. rst-class:: classref-property
  165. :ref:`Curve<class_Curve>` **xfade_curve** :ref:`🔗<class_AnimationNodeStateMachineTransition_property_xfade_curve>`
  166. .. rst-class:: classref-property-setget
  167. - |void| **set_xfade_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
  168. - :ref:`Curve<class_Curve>` **get_xfade_curve**\ (\ )
  169. Ease curve for better control over cross-fade between this state and the next.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_AnimationNodeStateMachineTransition_property_xfade_time:
  173. .. rst-class:: classref-property
  174. :ref:`float<class_float>` **xfade_time** = ``0.0`` :ref:`🔗<class_AnimationNodeStateMachineTransition_property_xfade_time>`
  175. .. rst-class:: classref-property-setget
  176. - |void| **set_xfade_time**\ (\ value\: :ref:`float<class_float>`\ )
  177. - :ref:`float<class_float>` **get_xfade_time**\ (\ )
  178. The time to cross-fade between this state and the next.
  179. \ **Note:** :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` 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_AnimationNodeStateMachineTransition_property_xfade_time>` is not scaled depending on the downstream delta. See also :ref:`AnimationNodeOneShot.fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>`.
  180. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  181. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  182. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  183. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  184. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  185. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  186. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  187. .. |void| replace:: :abbr:`void (No return value.)`