You've already forked godot
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:
@@ -686,6 +686,9 @@ bool AnimationMixer::_update_caches() {
|
|||||||
for (const StringName &E : sname_list) {
|
for (const StringName &E : sname_list) {
|
||||||
Ref<Animation> anim = get_animation(E);
|
Ref<Animation> anim = get_animation(E);
|
||||||
for (int i = 0; i < anim->get_track_count(); i++) {
|
for (int i = 0; i < anim->get_track_count(); i++) {
|
||||||
|
if (!anim->track_is_enabled(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
NodePath path = anim->track_get_path(i);
|
NodePath path = anim->track_get_path(i);
|
||||||
Animation::TypeHash thash = anim->track_get_type_hash(i);
|
Animation::TypeHash thash = anim->track_get_type_hash(i);
|
||||||
Animation::TrackType track_src_type = anim->track_get_type(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 there is a Reset Animation, it takes precedence by overwriting.
|
||||||
if (has_reset_anim) {
|
if (has_reset_anim) {
|
||||||
int rt = reset_anim->find_track(path, track_src_type);
|
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 (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 {
|
} 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.
|
// For non Skeleton3D bone animation.
|
||||||
if (has_reset_anim && !has_rest) {
|
if (has_reset_anim && !has_rest) {
|
||||||
int rt = reset_anim->find_track(path, track_src_type);
|
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) {
|
switch (track_src_type) {
|
||||||
case Animation::TYPE_POSITION_3D: {
|
case Animation::TYPE_POSITION_3D: {
|
||||||
track_xform->init_loc = reset_anim->track_get_key_value(rt, 0);
|
track_xform->init_loc = reset_anim->track_get_key_value(rt, 0);
|
||||||
@@ -871,7 +870,7 @@ bool AnimationMixer::_update_caches() {
|
|||||||
|
|
||||||
if (has_reset_anim) {
|
if (has_reset_anim) {
|
||||||
int rt = reset_anim->find_track(path, track_src_type);
|
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);
|
track_bshape->init_value = reset_anim->track_get_key_value(rt, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user