Improve and clarify paused Tweens

This commit is contained in:
kobewi 2023-07-25 13:29:30 +02:00
parent f6187014ec
commit dbecf8bd1a
2 changed files with 6 additions and 4 deletions

View File

@ -206,6 +206,7 @@
<return type="void" /> <return type="void" />
<description> <description>
Pauses the tweening. The animation can be resumed by using [method play]. Pauses the tweening. The animation can be resumed by using [method play].
[b]Note:[/b] If a Tween is paused and not bound to any node, it will exist indefinitely until manually started or invalidated. If you lose a reference to such Tween, you can retrieve it using [method SceneTree.get_processed_tweens].
</description> </description>
</method> </method>
<method name="play"> <method name="play">
@ -273,6 +274,7 @@
<return type="void" /> <return type="void" />
<description> <description>
Stops the tweening and resets the [Tween] to its initial state. This will not remove any appended [Tweener]s. Stops the tweening and resets the [Tween] to its initial state. This will not remove any appended [Tweener]s.
[b]Note:[/b] If a Tween is stopped and not bound to any node, it will exist indefinitely until manually started or invalidated. If you lose a reference to such Tween, you can retrieve it using [method SceneTree.get_processed_tweens].
</description> </description>
</method> </method>
<method name="tween_callback"> <method name="tween_callback">

View File

@ -284,10 +284,6 @@ bool Tween::step(double p_delta) {
return false; return false;
} }
if (!running) {
return true;
}
if (is_bound) { if (is_bound) {
Node *node = get_bound_node(); Node *node = get_bound_node();
if (node) { if (node) {
@ -299,6 +295,10 @@ bool Tween::step(double p_delta) {
} }
} }
if (!running) {
return true;
}
if (!started) { if (!started) {
if (tweeners.is_empty()) { if (tweeners.is_empty()) {
String tween_id; String tween_id;