summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
authorChristian Dannie Storgaard <cybolic@gmail.com>2016-05-20 13:13:32 +0300
committerChristian Dannie Storgaard <cybolic@gmail.com>2016-05-20 13:13:32 +0300
commit8884b8f51963553dd1ecc0bc4accf64deb4f645f (patch)
tree263c4ebd5f5fd535fbdf794380dc75a6c19ac742 /scene/animation
parent5e0f0a962adddfc85957400b007b6b0c08160057 (diff)
Added toggle for loop interpolation based on adolson's code
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_player.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index cecdd2bc40..22c41dda8e 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -538,6 +538,7 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
float len=cd.from->animation->get_length();
bool loop=cd.from->animation->has_loop();
+ bool loop_interpolation=cd.from->animation->has_loop_interpolation();
if (!loop) {
@@ -563,10 +564,21 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd,float p_delta,flo
}
- } else {
+ } else if (loop_interpolation) {
next_pos=Math::fposmod(next_pos,len);
+ } else {
+
+ if (next_pos<0 or next_pos>len) {
+ if (!backwards)
+ next_pos=0;
+ else if (backwards)
+ next_pos=len;
+ }
+ // fix delta - not sure if needed here
+ delta=next_pos-cd.pos;
+
}
cd.pos=next_pos;