Skip to content

Commit

Permalink
Merge pull request #83030 from TokageItLab/patch-misc-blending
Browse files Browse the repository at this point in the history
AnimationMixer: Fix non-numeric misc type (`Resource`, `Dictionary` & etc.) values cannot be blended with `UpdateMode.UPDATE_CONTINUOUS`
  • Loading branch information
akien-mga committed Oct 9, 2023
2 parents a1d7c62 + c4743ba commit 1e55eeb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scene/animation/animation_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,27 @@ bool AnimationMixer::_update_caches() {
track_value->is_continuous |= anim->value_track_get_update_mode(i) != Animation::UPDATE_DISCRETE;
track_value->is_using_angle |= anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE;

// TODO: Currently, misc type cannot be blended. In the future,
// it should have a separate blend weight, just as bool is converted to 0 and 1.
// Then, it should provide the correct precedence value.
switch (track_value->init_value.get_type()) {
case Variant::NIL:
case Variant::STRING_NAME:
case Variant::NODE_PATH:
case Variant::RID:
case Variant::OBJECT:
case Variant::CALLABLE:
case Variant::SIGNAL:
case Variant::DICTIONARY:
case Variant::ARRAY: {
WARN_PRINT_ONCE_ED("AnimationMixer: '" + String(E) + "', Value Track: '" + String(path) + "' uses a non-numeric type as key value with UpdateMode.UPDATE_CONTINUOUS. This will not be blended correctly, so it is forced to UpdateMode.UPDATE_DISCRETE.");
track_value->is_continuous = false;
break;
}
default: {
}
}

if (was_continuous != track_value->is_continuous) {
WARN_PRINT_ONCE_ED("Value Track: " + String(path) + " has different update modes between some animations may be blended. Blending prioritizes UpdateMode.UPDATE_CONTINUOUS, so the process treat UpdateMode.UPDATE_DISCRETE as UpdateMode.UPDATE_CONTINUOUS with InterpolationType.INTERPOLATION_NEAREST.");
}
Expand Down

0 comments on commit 1e55eeb

Please sign in to comment.