Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug with Tween.is_active, fixes #39760 #39801

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions scene/animation/tween.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,21 +701,21 @@ void Tween::_tween_process(float p_delta) {
}

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

// 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 == nullptr) {
Expand Down Expand Up @@ -802,17 +802,15 @@ void Tween::_tween_process(float p_delta) {
// If we are not repeating the tween, remove it
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 (all_finished) {
if (any_unfinished == 0) {
set_active(false);
emit_signal("tween_all_completed");
}
Expand Down