1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Fix AnimationMixer handling disabled track in RESET

This commit is contained in:
Silc Lizard (Tokage) Renew
2025-12-19 10:18:10 +09:00
parent 40cf5a0f50
commit ff615f8aed

View File

@@ -686,6 +686,9 @@ bool AnimationMixer::_update_caches() {
for (const StringName &E : sname_list) {
Ref<Animation> 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,18 +753,14 @@ 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);
}
} 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];
}
}
}
}
if (is_value && callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS) {
if (child) {
@@ -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);
}
}