Revert "bug with Tween.is_active, fixes #39760"

This reverts commit 8ef40b9306.
This commit is contained in:
Rémi Verschelde 2020-08-25 12:58:40 +02:00
parent 3b080845a8
commit 2d42625184
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 9 additions and 8 deletions

View File

@ -689,7 +689,7 @@ void Tween::_tween_process(float p_delta) {
} }
// Are all of the tweens complete? // Are all of the tweens complete?
int any_unfinished = 0; bool all_finished = true;
// For each tween we wish to interpolate... // For each tween we wish to interpolate...
for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) { for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
@ -697,13 +697,13 @@ void Tween::_tween_process(float p_delta) {
// Get the data from it // Get the data from it
InterpolateData &data = E->get(); InterpolateData &data = E->get();
// Track if we hit one that isn't finished yet
all_finished = all_finished && data.finish;
// Is the data not active or already finished? No need to go any further // Is the data not active or already finished? No need to go any further
if (!data.active || data.finish) if (!data.active || data.finish)
continue; continue;
// Track if we hit one that isn't finished yet
any_unfinished++;
// Get the target object for this interpolation // Get the target object for this interpolation
Object *object = ObjectDB::get_instance(data.id); Object *object = ObjectDB::get_instance(data.id);
if (object == NULL) if (object == NULL)
@ -787,17 +787,18 @@ void Tween::_tween_process(float p_delta) {
emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false)); emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false));
// If we are not repeating the tween, remove it // If we are not repeating the tween, remove it
if (!repeat) { if (!repeat)
call_deferred("_remove_by_uid", data.uid); call_deferred("_remove_by_uid", data.uid);
any_unfinished--; } else if (!repeat) {
} // Check whether all tweens are finished
all_finished = all_finished && data.finish;
} }
} }
// One less update left to go // One less update left to go
pending_update--; pending_update--;
// If all tweens are completed, we no longer need to be active // If all tweens are completed, we no longer need to be active
if (any_unfinished == 0) { if (all_finished) {
set_active(false); set_active(false);
emit_signal("tween_all_completed"); emit_signal("tween_all_completed");
} }