Skip to content

Commit

Permalink
Merge pull request #91822 from TokageItLab/inv-offset
Browse files Browse the repository at this point in the history
Invert start offset on AnimationNode custom timeline
  • Loading branch information
akien-mga committed May 11, 2024
2 parents 916ea00 + d654acb commit 10471a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scene/animation/animation_blend_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(const AnimationMixe
nti.is_just_looped = is_just_looped;

// 3. Progress for Animation.
double prev_playback_time = prev_time - start_offset;
double cur_playback_time = cur_time - start_offset;
double prev_playback_time = prev_time + start_offset;
double cur_playback_time = cur_time + start_offset;
if (stretch_time_scale) {
double mlt = anim_size / cur_len;
cur_playback_time *= mlt;
Expand Down Expand Up @@ -241,7 +241,7 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(const AnimationMixe
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_started", animation);
}
// Finished.
if (prev_time - start_offset < anim_size && cur_playback_time >= anim_size) {
if (prev_time + start_offset < anim_size && cur_playback_time >= anim_size) {
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_finished", animation);
}
}
Expand Down

0 comments on commit 10471a4

Please sign in to comment.