Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scene/animation/animation_blend_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,21 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(ProcessState &p_pro
double anim_size = anim->get_length();

double cur_len;
double playback_end;
Animation::LoopMode cur_loop_mode;
if (use_custom_timeline) {
cur_len = timeline_length;
if (stretch_time_scale) {
// When time scale is stretched, the entire animation is played anyway using a time scale based on the timeline length.
// Therefore, the end of the animation section is the animation length.
playback_end = anim_size;
} else {
playback_end = timeline_length;
}
cur_loop_mode = loop_mode;
} else {
cur_len = anim_size;
playback_end = anim_size;
cur_loop_mode = anim->get_loop_mode();
}

Expand Down Expand Up @@ -244,7 +253,7 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(ProcessState &p_pro
if (immediately_after_start) {
AnimationMixer::PlaybackInfo pi = p_playback_info;
pi.start = 0.0;
pi.end = cur_len;
pi.end = playback_end;
if (play_mode == PLAY_MODE_FORWARD) {
pi.time = 0;
} else {
Expand All @@ -257,7 +266,7 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(ProcessState &p_pro

AnimationMixer::PlaybackInfo pi = p_playback_info;
pi.start = 0.0;
pi.end = cur_len;
pi.end = playback_end;
if (play_mode == PLAY_MODE_FORWARD) {
pi.time = cur_playback_time;
} else {
Expand Down
Loading