Improve AnimationMixer warnings

This commit is contained in:
kobewi 2024-02-12 14:58:12 +01:00
parent f317cc713a
commit 154b4a51f2

View file

@ -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) {
@ -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.");
}
}