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); } }