From dbecf8bd1ab800d1349c6519c9199692a4a486a7 Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 25 Jul 2023 13:29:30 +0200 Subject: [PATCH] Improve and clarify paused Tweens --- doc/classes/Tween.xml | 2 ++ scene/animation/tween.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index fd8ef507fbd..f104c5f1075 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -206,6 +206,7 @@ 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]. @@ -273,6 +274,7 @@ 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]. diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 96e5da5a400..b32b04655d2 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -284,10 +284,6 @@ bool Tween::step(double p_delta) { return false; } - if (!running) { - return true; - } - if (is_bound) { Node *node = get_bound_node(); if (node) { @@ -299,6 +295,10 @@ bool Tween::step(double p_delta) { } } + if (!running) { + return true; + } + if (!started) { if (tweeners.is_empty()) { String tween_id;