Invert start offset on AnimationNode custom timeline
This commit is contained in:
parent
2ba22d1554
commit
d654acbd39
|
@ -194,8 +194,8 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(const AnimationMixe
|
||||||
nti.is_just_looped = is_just_looped;
|
nti.is_just_looped = is_just_looped;
|
||||||
|
|
||||||
// 3. Progress for Animation.
|
// 3. Progress for Animation.
|
||||||
double prev_playback_time = prev_time - start_offset;
|
double prev_playback_time = prev_time + start_offset;
|
||||||
double cur_playback_time = cur_time - start_offset;
|
double cur_playback_time = cur_time + start_offset;
|
||||||
if (stretch_time_scale) {
|
if (stretch_time_scale) {
|
||||||
double mlt = anim_size / cur_len;
|
double mlt = anim_size / cur_len;
|
||||||
cur_playback_time *= mlt;
|
cur_playback_time *= mlt;
|
||||||
|
@ -241,7 +241,7 @@ AnimationNode::NodeTimeInfo AnimationNodeAnimation::_process(const AnimationMixe
|
||||||
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_started", animation);
|
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_started", animation);
|
||||||
}
|
}
|
||||||
// Finished.
|
// Finished.
|
||||||
if (prev_time - start_offset < anim_size && cur_playback_time >= anim_size) {
|
if (prev_time + start_offset < anim_size && cur_playback_time >= anim_size) {
|
||||||
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_finished", animation);
|
process_state->tree->call_deferred(SNAME("emit_signal"), "animation_finished", animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue