summaryrefslogtreecommitdiff
path: root/scene/animation/animation_player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/animation_player.cpp')
-rw-r--r--scene/animation/animation_player.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 2399bee539..0ff6931dcd 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -174,7 +174,7 @@ void AnimationPlayer::_get_property_list( List<PropertyInfo> *p_list) const {
hint+=E->get();
}
- p_list->push_back( PropertyInfo( Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint,PROPERTY_USAGE_EDITOR) );
+ p_list->push_back( PropertyInfo( Variant::STRING, "playback/play", PROPERTY_HINT_ENUM, hint,PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_ANIMATE_AS_TRIGGER) );
p_list->push_back( PropertyInfo( Variant::BOOL, "playback/active", PROPERTY_HINT_NONE,"" ) );
p_list->push_back( PropertyInfo( Variant::REAL, "playback/speed", PROPERTY_HINT_RANGE, "-64,64,0.01") );
@@ -421,12 +421,13 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
TrackNodeCache::PropertyAnim *pa = &E->get();
- if (a->value_track_is_continuous(i) || p_delta==0) { //delta == 0 means seek
+ if (a->value_track_get_update_mode(i)==Animation::UPDATE_CONTINUOUS || (p_delta==0 && a->value_track_get_update_mode(i)==Animation::UPDATE_DISCRETE)) { //delta == 0 means seek
Variant value=a->value_track_interpolate(i,p_time);
- if (p_delta==0 && value.get_type()==Variant::STRING)
- continue; // doing this with strings is messy, should find another way
+ //thanks to trigger mode, this should be solved now..
+ //if (p_delta==0 && value.get_type()==Variant::STRING)
+ // continue; // doing this with strings is messy, should find another way
if (pa->accum_pass!=accum_pass) {
ERR_CONTINUE( cache_update_prop_size >= NODE_CACHE_UPDATE_MAX );
cache_update_prop[cache_update_prop_size++]=pa;
@@ -437,11 +438,12 @@ void AnimationPlayer::_animation_process_animation(AnimationData* p_anim,float p
}
- } else if (p_allow_discrete) {
+ } else if (p_allow_discrete && p_delta!=0) {
List<int> indices;
a->value_track_get_key_indices(i,p_time,p_delta,&indices);
+
for(List<int>::Element *F=indices.front();F;F=F->next()) {
Variant value=a->track_get_key_value(i,F->get());
@@ -538,6 +540,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 +566,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;