summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-07-25 21:51:35 +0200
committerYuri Sizov <yuris@humnom.net>2023-07-25 21:51:35 +0200
commita581bf0a24cc2db0b56477101c0bd180333edccd (patch)
tree9b493f9a0210d643b3efbe99c3ac557980b3f0d8
parentfc1b392e085ff61a729b30722aeaa9b8bfdde13b (diff)
parentdbecf8bd1ab800d1349c6519c9199692a4a486a7 (diff)
downloadredot-engine-a581bf0a24cc2db0b56477101c0bd180333edccd.tar.gz
Merge pull request #79879 from KoBeWi/the_tweenld
Improve and clarify paused Tweens
-rw-r--r--doc/classes/Tween.xml2
-rw-r--r--scene/animation/tween.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index fd8ef507fb..f104c5f107 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -206,6 +206,7 @@
<return type="void" />
<description>
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>
</method>
<method name="play">
@@ -273,6 +274,7 @@
<return type="void" />
<description>
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>
</method>
<method name="tween_callback">
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 96e5da5a40..b32b04655d 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;