summaryrefslogtreecommitdiffstats
path: root/scene/animation
diff options
context:
space:
mode:
authorSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-06-15 11:27:05 +0900
committerSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-06-15 11:38:52 +0900
commit049c1a569957a129ca25cd3a7453b53db5f287ea (patch)
tree4ef51054492d0e7f697a3d639d87f30383b49f35 /scene/animation
parent71699e08c9df78b7203fa4ef9cede28e995d6ace (diff)
downloadredot-engine-049c1a569957a129ca25cd3a7453b53db5f287ea.tar.gz
Fix force continuous un-interpolatable value is not applied correctly
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_mixer.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp
index 5074145168..afd292e552 100644
--- a/scene/animation/animation_mixer.cpp
+++ b/scene/animation/animation_mixer.cpp
@@ -1426,13 +1426,32 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
bool is_value = ttype == Animation::TYPE_VALUE;
bool is_discrete = is_value && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE;
bool force_continuous = callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS;
- if (t->is_variant_interpolatable && (!is_discrete || force_continuous)) {
+ if (!is_discrete || force_continuous) {
t->use_continuous = true;
- Variant value = is_value ? a->value_track_interpolate(i, time, is_discrete && force_continuous ? backward : false) : Variant(a->bezier_track_interpolate(i, time));
- value = post_process_key_value(a, i, value, t->object_id);
- if (value == Variant()) {
+
+ Variant value;
+ if (t->is_variant_interpolatable) {
+ value = is_value ? a->value_track_interpolate(i, time, is_discrete && force_continuous ? backward : false) : Variant(a->bezier_track_interpolate(i, time));
+ value = post_process_key_value(a, i, value, t->object_id);
+ if (value == Variant()) {
+ continue;
+ }
+ } else {
+ // Discrete track sets the value in the current _blend_process() function,
+ // but Force Continuous track does not set the value here because the value must be set in the _blend_apply() function later.
+ int idx = a->track_find_key(i, time, Animation::FIND_MODE_NEAREST, false, backward);
+ if (idx < 0) {
+ continue;
+ }
+ value = a->track_get_key_value(i, idx);
+ value = post_process_key_value(a, i, value, t->object_id);
+ if (value == Variant()) {
+ continue;
+ }
+ t->value = value;
continue;
}
+
// Special case for angle interpolation.
if (t->is_using_angle) {
// For blending consistency, it prevents rotation of more than 180 degrees from init_value.