diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-04-15 09:09:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-15 09:09:27 +0200 |
commit | 3639c27cf16cf3ee588c5a1e7587e0deecc9db6a (patch) | |
tree | c857bb5e391b531ee5d8c95b8ca5d4e9e9fcb41e /scene | |
parent | 7032b111ce66ed0e1612ef6bd6d53b9c3624e3af (diff) | |
parent | 0fe723a1acc4f22a183c96a3e54e11681165cfd5 (diff) |
Merge pull request #60235 from TokageItLab/fix-value-track-blend
Fixed blending value track without RESET and TRS3D track with RESET
Diffstat (limited to 'scene')
-rw-r--r-- | scene/animation/animation_tree.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 60f2623267..572e767f44 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -623,11 +623,13 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { track_xform->skeleton = nullptr; track_xform->bone_idx = -1; + bool has_rest = false; if (path.get_subname_count() == 1 && Object::cast_to<Skeleton3D>(node_3d)) { Skeleton3D *sk = Object::cast_to<Skeleton3D>(node_3d); track_xform->skeleton = sk; int bone_idx = sk->find_bone(path.get_subname(0)); if (bone_idx != -1) { + has_rest = true; track_xform->bone_idx = bone_idx; Transform3D rest = sk->get_bone_rest(bone_idx); track_xform->init_loc = rest.origin; @@ -656,7 +658,8 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { } } - if (has_reset_anim) { + // For non Skeleton3D bone animation. + if (has_reset_anim && !has_rest) { int rt = reset_anim->find_track(path, track_type); if (rt >= 0 && reset_anim->track_get_key_count(rt) > 0) { switch (track_type) { @@ -1321,9 +1324,8 @@ void AnimationTree::_process_graph(double p_delta) { if (!t->init_value) { t->init_value = value; t->init_value.zero(); - } else { - t->value = t->init_value; } + t->value = t->init_value; } Variant::sub(value, t->init_value, value); |