diff options
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r-- | scene/animation/animation_player.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index eca7caeaf0..a0e0137863 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -246,8 +246,9 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) { if (a->track_get_path(i).get_subname_count() == 1 && Object::cast_to<Skeleton>(child)) { - bone_idx = Object::cast_to<Skeleton>(child)->find_bone(a->track_get_path(i).get_subname(0)); - if (bone_idx == -1) { + Skeleton *sk = Object::cast_to<Skeleton>(child); + bone_idx = sk->find_bone(a->track_get_path(i).get_subname(0)); + if (bone_idx == -1 || sk->is_bone_ignore_animation(bone_idx)) { continue; } @@ -506,7 +507,6 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend) { float delta = p_delta * speed_scale * cd.speed_scale; - bool backwards = delta < 0; float next_pos = cd.pos + delta; float len = cd.from->animation->get_length(); @@ -524,6 +524,8 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f if (&cd == &playback.current) { + bool backwards = delta < 0; + if (!backwards && cd.pos <= len && next_pos == len /*&& playback.blend.empty()*/) { //playback finished end_reached = true; @@ -579,16 +581,14 @@ void AnimationPlayer::_animation_process2(float p_delta) { } void AnimationPlayer::_animation_update_transforms() { + { + Transform t; + for (int i = 0; i < cache_update_size; i++) { - for (int i = 0; i < cache_update_size; i++) { - - TrackNodeCache *nc = cache_update[i]; - - ERR_CONTINUE(nc->accum_pass != accum_pass); + TrackNodeCache *nc = cache_update[i]; - if (nc->spatial) { + ERR_CONTINUE(nc->accum_pass != accum_pass); - Transform t; t.origin = nc->loc_accum; t.basis.set_quat_scale(nc->rot_accum, nc->scale_accum); if (nc->skeleton && nc->bone_idx >= 0) { @@ -1208,7 +1208,7 @@ NodePath AnimationPlayer::get_root() const { void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { String pf = p_function; - if (p_function == "play" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") { + if (p_function == "play" || p_function == "play_backwards" || p_function == "remove_animation" || p_function == "has_animation" || p_function == "queue") { List<StringName> al; get_animation_list(&al); for (List<StringName>::Element *E = al.front(); E; E = E->next()) { |