From 154b4a51f2c454a4f74d3d57887d4bee59ea809c Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 12 Feb 2024 14:58:12 +0100 Subject: [PATCH] Improve AnimationMixer warnings --- scene/animation/animation_mixer.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 78abdbdd3e7..9f954fd6c0c 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -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 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."); } }