Skip to content

Commit

Permalink
Revert "bug with Tween.is_active, fixes #39760"
Browse files Browse the repository at this point in the history
This reverts commit 8ef40b9.
  • Loading branch information
akien-mga committed Aug 25, 2020
1 parent 3b08084 commit 2d42625
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scene/animation/tween.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,21 +689,21 @@ void Tween::_tween_process(float p_delta) {
}

// Are all of the tweens complete?
int any_unfinished = 0;
bool all_finished = true;

// For each tween we wish to interpolate...
for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {

// Get the data from it
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
if (!data.active || data.finish)
continue;

// Track if we hit one that isn't finished yet
any_unfinished++;

// Get the target object for this interpolation
Object *object = ObjectDB::get_instance(data.id);
if (object == NULL)
Expand Down Expand Up @@ -787,17 +787,18 @@ void Tween::_tween_process(float p_delta) {
emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false));

// If we are not repeating the tween, remove it
if (!repeat) {
if (!repeat)
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
pending_update--;

// If all tweens are completed, we no longer need to be active
if (any_unfinished == 0) {
if (all_finished) {
set_active(false);
emit_signal("tween_all_completed");
}
Expand Down

0 comments on commit 2d42625

Please sign in to comment.