summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-03-23 12:23:24 +0900
committerSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-03-23 18:48:29 +0900
commitc1741fe98e82a65a36a2999a05c2fec851b5342b (patch)
tree0354bcccebfb7b32bd37fffe3507940c88b170bf
parentfe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff)
downloadredot-engine-c1741fe98e82a65a36a2999a05c2fec851b5342b.tar.gz
Fix AnimationPlaybackTrack seeking behavior overall
Co-authored-by: jsjtxietian <jsjtxietian@outlook.com> Co-authored-by: Miguel0312 <miguel.vpereira14@gmail.com> Co-authored-by: BruceLiCong <citb_li@163.com>
-rw-r--r--scene/animation/animation_mixer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp
index 7080a5338b..22f919ad36 100644
--- a/scene/animation/animation_mixer.cpp
+++ b/scene/animation/animation_mixer.cpp
@@ -1596,7 +1596,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
}
} break;
case Animation::TYPE_ANIMATION: {
- if (p_update_only || Math::is_zero_approx(blend)) {
+ if (Math::is_zero_approx(blend)) {
continue;
}
TrackCacheAnimation *t = static_cast<TrackCacheAnimation *>(track);
@@ -1623,10 +1623,10 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
double at_anim_pos = 0.0;
switch (anim->get_loop_mode()) {
case Animation::LOOP_NONE: {
- at_anim_pos = MAX((double)anim->get_length(), time - pos); //seek to end
+ at_anim_pos = MIN((double)anim->get_length(), time - pos); // Seek to end.
} break;
case Animation::LOOP_LINEAR: {
- at_anim_pos = Math::fposmod(time - pos, (double)anim->get_length()); //seek to loop
+ at_anim_pos = Math::fposmod(time - pos, (double)anim->get_length()); // Seek to loop.
} break;
case Animation::LOOP_PINGPONG: {
at_anim_pos = Math::pingpong(time - pos, (double)a->get_length());
@@ -1634,14 +1634,14 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
default:
break;
}
- if (player2->is_playing() || seeked) {
- player2->seek(at_anim_pos);
+ if (player2->is_playing()) {
+ player2->seek(at_anim_pos, false, p_update_only);
player2->play(anim_name);
t->playing = true;
playing_caches.insert(t);
} else {
player2->set_assigned_animation(anim_name);
- player2->seek(at_anim_pos, true);
+ player2->seek(at_anim_pos, true, p_update_only);
}
} else {
// Find stuff to play.