Skip to content

Commit

Permalink
Merge pull request #88247 from KoBeWi/warning_pinpointer_20000
Browse files Browse the repository at this point in the history
Improve AnimationMixer warnings
  • Loading branch information
akien-mga committed Feb 12, 2024
2 parents 7d89f55 + 154b4a5 commit e57fee9
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions scene/animation/animation_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,19 @@ bool AnimationMixer::_update_caches() {
return false;
}

#ifdef TOOLS_ENABLED
String mixer_name = "AnimationMixer";
const Node *owner = get_owner();
if (owner) {
const String scene_path = owner->get_scene_file_path();
if (!scene_path.is_empty()) {
mixer_name += vformat(" (at: %s)", scene_path.get_file());
}
}
#else
const String mixer_name = "AnimationMixer";
#endif

Ref<Animation> reset_anim;
bool has_reset_anim = has_animation(SceneStringNames::get_singleton()->RESET);
if (has_reset_anim) {
Expand Down Expand Up @@ -858,20 +871,20 @@ bool AnimationMixer::_update_caches() {
bool skip_update_mode_warning = false;
if (track_value->is_continuous) {
if (!Animation::is_variant_interpolatable(track_value->init_value)) {
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.");
WARN_PRINT_ONCE_ED(mixer_name + ": '" + 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;
skip_update_mode_warning = true;
}
if (track_value->init_value.is_string()) {
WARN_PRINT_ONCE_ED("AnimationMixer: '" + String(E) + "', Value Track: '" + String(path) + "' blends String types. This is an experimental algorithm.");
WARN_PRINT_ONCE_ED(mixer_name + ": '" + String(E) + "', Value Track: '" + String(path) + "' blends String types. This is an experimental algorithm.");
}
}

if (!skip_update_mode_warning && was_continuous != track_value->is_continuous) {
WARN_PRINT_ONCE_ED("AnimationMixer: '" + String(E) + "', Value Track: '" + String(path) + "' has different update modes between some animations which may be blended together. Blending prioritizes UpdateMode.UPDATE_CONTINUOUS, so the process treats UpdateMode.UPDATE_DISCRETE as UpdateMode.UPDATE_CONTINUOUS with InterpolationType.INTERPOLATION_NEAREST.");
WARN_PRINT_ONCE_ED(mixer_name + ": '" + String(E) + "', Value Track: '" + String(path) + "' has different update modes between some animations which may be blended together. Blending prioritizes UpdateMode.UPDATE_CONTINUOUS, so the process treats UpdateMode.UPDATE_DISCRETE as UpdateMode.UPDATE_CONTINUOUS with InterpolationType.INTERPOLATION_NEAREST.");
}
if (was_using_angle != track_value->is_using_angle) {
WARN_PRINT_ONCE_ED("AnimationMixer: '" + String(E) + "', Value Track: '" + String(path) + "' has different interpolation types for rotation between some animations which may be blended together. Blending prioritizes angle interpolation, so the blending result uses the shortest path referenced to the initial (RESET animation) value.");
WARN_PRINT_ONCE_ED(mixer_name + ": '" + String(E) + "', Value Track: '" + String(path) + "' has different interpolation types for rotation between some animations which may be blended together. Blending prioritizes angle interpolation, so the blending result uses the shortest path referenced to the initial (RESET animation) value.");
}
}

Expand Down

0 comments on commit e57fee9

Please sign in to comment.