summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-04-21 04:14:08 +0900
committerSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-05-01 06:39:17 +0900
commitb346e2a722a4460752372086171d3f5c03476114 (patch)
tree83cd51cd12d8c073cedc5db007113b98bafce1c8
parent4a0160241fd0c1e874e297f6b08676cf0761e5e8 (diff)
downloadredot-engine-b346e2a722a4460752372086171d3f5c03476114.tar.gz
Make seeking animation playback track consider internal seeking
-rw-r--r--scene/animation/animation_mixer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp
index 5a3a5f9bc0..bc5c99dbfe 100644
--- a/scene/animation/animation_mixer.cpp
+++ b/scene/animation/animation_mixer.cpp
@@ -1617,7 +1617,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
}
if (seeked) {
// Seek.
- int idx = a->track_find_key(i, time, is_external_seeking ? Animation::FIND_MODE_NEAREST : Animation::FIND_MODE_EXACT, true);
+ int idx = a->track_find_key(i, time, Animation::FIND_MODE_NEAREST, true);
if (idx < 0) {
continue;
}
@@ -1630,6 +1630,9 @@ 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: {
+ if (!is_external_seeking && ((!backward && time >= pos + (double)anim->get_length()) || (backward && time <= pos))) {
+ continue; // Do nothing if current time is outside of length when started.
+ }
at_anim_pos = MIN((double)anim->get_length(), time - pos); // Seek to end.
} break;
case Animation::LOOP_LINEAR: {
@@ -1641,7 +1644,7 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
default:
break;
}
- if (player2->is_playing()) {
+ if (player2->is_playing() || !is_external_seeking) {
player2->seek(at_anim_pos, false, p_update_only);
player2->play(anim_name);
t->playing = true;