diff options
author | Ray Koopa <raykoopa@users.noreply.github.com> | 2017-11-28 16:46:37 +0100 |
---|---|---|
committer | Ray Koopa <raykoopa@users.noreply.github.com> | 2017-12-09 18:22:16 +0100 |
commit | ad9f987715831b4f1e72cfaf8d4bf6772370bf7d (patch) | |
tree | b8f1c352010655d58f31c2a41d20ac8e0ef1c25a /scene/animation | |
parent | 20a566d63a34e5b502a0b46d3cbe655427f1bc76 (diff) |
Add feature to disable animation tracks
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_player.cpp | 3 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 96a59380fa..91aa069060 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -364,6 +364,9 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float if (!nc) // no node cache for this track, skip it continue; + if (!a->track_is_enabled(i)) + continue; // do nothing if the track is disabled + if (a->track_get_key_count(i) == 0) continue; // do nothing if track is empty diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 96b5ea51b0..32f82fe6b8 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -831,7 +831,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) { for (List<AnimationNode::TrackRef>::Element *E = anim_list->tref.front(); E; E = E->next()) { AnimationNode::TrackRef &tr = E->get(); - if (tr.track == NULL || tr.local_track < 0 || tr.weight < CMP_EPSILON) + if (tr.track == NULL || tr.local_track < 0 || tr.weight < CMP_EPSILON || !a->track_is_enabled(tr.local_track)) continue; switch (a->track_get_type(tr.local_track)) { |