From ff615f8aed4309e8c03a7aa89f6fa36d439864a6 Mon Sep 17 00:00:00 2001 From: "Silc Lizard (Tokage) Renew" <61938263+TokageItLab@users.noreply.github.com> Date: Fri, 19 Dec 2025 10:18:10 +0900 Subject: [PATCH] Fix AnimationMixer handling disabled track in RESET --- scene/animation/animation_mixer.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 5890baa2ef0..c54e21b9f52 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -686,6 +686,9 @@ bool AnimationMixer::_update_caches() { for (const StringName &E : sname_list) { Ref anim = get_animation(E); for (int i = 0; i < anim->get_track_count(); i++) { + if (!anim->track_is_enabled(i)) { + continue; + } NodePath path = anim->track_get_path(i); Animation::TypeHash thash = anim->track_get_type_hash(i); Animation::TrackType track_src_type = anim->track_get_type(i); @@ -750,15 +753,11 @@ bool AnimationMixer::_update_caches() { // If there is a Reset Animation, it takes precedence by overwriting. if (has_reset_anim) { int rt = reset_anim->find_track(path, track_src_type); - if (rt >= 0) { + if (rt >= 0 && reset_anim->track_is_enabled(rt) && reset_anim->track_get_key_count(rt) > 0) { if (is_value) { - if (reset_anim->track_get_key_count(rt) > 0) { - track_value->init_value = reset_anim->track_get_key_value(rt, 0); - } + track_value->init_value = reset_anim->track_get_key_value(rt, 0); } else { - if (reset_anim->track_get_key_count(rt) > 0) { - track_value->init_value = (reset_anim->track_get_key_value(rt, 0).operator Array())[0]; - } + track_value->init_value = (reset_anim->track_get_key_value(rt, 0).operator Array())[0]; } } } @@ -825,7 +824,7 @@ bool AnimationMixer::_update_caches() { // For non Skeleton3D bone animation. if (has_reset_anim && !has_rest) { int rt = reset_anim->find_track(path, track_src_type); - if (rt >= 0 && reset_anim->track_get_key_count(rt) > 0) { + if (rt >= 0 && reset_anim->track_is_enabled(rt) && reset_anim->track_get_key_count(rt) > 0) { switch (track_src_type) { case Animation::TYPE_POSITION_3D: { track_xform->init_loc = reset_anim->track_get_key_value(rt, 0); @@ -871,7 +870,7 @@ bool AnimationMixer::_update_caches() { if (has_reset_anim) { int rt = reset_anim->find_track(path, track_src_type); - if (rt >= 0 && reset_anim->track_get_key_count(rt) > 0) { + if (rt >= 0 && reset_anim->track_is_enabled(rt) && reset_anim->track_get_key_count(rt) > 0) { track_bshape->init_value = reset_anim->track_get_key_value(rt, 0); } }