diff options
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_cache.cpp | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 26 | ||||
-rw-r--r-- | scene/animation/animation_player.h | 1 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 4 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.h | 1 | ||||
-rw-r--r-- | scene/animation/transitioner.cpp | 34 | ||||
-rw-r--r-- | scene/animation/transitioner.h | 68 | ||||
-rw-r--r-- | scene/animation/tween_interpolaters.cpp | 2 |
8 files changed, 24 insertions, 114 deletions
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index b1123897b2..113e2c2278 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -301,7 +301,7 @@ void AnimationCache::set_all(float p_time, float p_delta) { } break; case Animation::TYPE_VALUE: { - if (animation->value_track_is_continuous(i)) { + if (animation->value_track_get_update_mode(i)==Animation::UPDATE_CONTINUOUS || (animation->value_track_get_update_mode(i)==Animation::UPDATE_DISCRETE && p_delta==0)) { Variant v = animation->value_track_interpolate(i,p_time); set_track_value(i,v); } else { 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; diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 2ae3a0756c..ac0265dbaa 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -33,7 +33,6 @@ #include "scene/resources/animation.h" #include "scene/3d/spatial.h" #include "scene/3d/skeleton.h" -#include "scene/main/misc.h" #include "scene/2d/node_2d.h" /** @author Juan Linietsky <reduzio@gmail.com> diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index 211c5961b0..628edf09de 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -669,7 +669,7 @@ float AnimationTreePlayer::_process_node(const StringName& p_node,AnimationNode } tsn->seek_pos=-1; - return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,p_seek); + return _process_node(tsn->inputs[0].node,r_prev_anim,p_weight,p_time,p_seek, p_filter, p_reverse_weight); } break; case NODE_TRANSITION: { @@ -825,7 +825,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) { } break; case Animation::TYPE_VALUE: { ///< Set a value in a property, can be interpolated. - if (a->value_track_is_continuous(tr.local_track)) { + if (a->value_track_get_update_mode(tr.local_track)==Animation::UPDATE_CONTINUOUS) { Variant value = a->value_track_interpolate(tr.local_track,anim_list->time); Variant::blend(tr.track->value,value,blend,tr.track->value); } else { diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 0e78281e4c..dae891b5ce 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -33,7 +33,6 @@ #include "scene/resources/animation.h" #include "scene/3d/spatial.h" #include "scene/3d/skeleton.h" -#include "scene/main/misc.h" #include "animation_player.h" diff --git a/scene/animation/transitioner.cpp b/scene/animation/transitioner.cpp deleted file mode 100644 index adcf73d489..0000000000 --- a/scene/animation/transitioner.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************/ -/* transitioner.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "transitioner.h" -/* -Transitioner::Transitioner() -{ -} -*/ diff --git a/scene/animation/transitioner.h b/scene/animation/transitioner.h deleted file mode 100644 index 8b7ec4f3fa..0000000000 --- a/scene/animation/transitioner.h +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************/ -/* transitioner.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef TRANSITIONER_H -#define TRANSITIONER_H - -/* -class Transitioner : public Node { - OBJ_TYPE(Transitioner, Node); -public: - enum Interpolation { - INTERPOLATION_NEAREST, - INTERPOLATION_LINEAR, - INTERPOLATION_CUBIC - }; - - enum TransitionType { - TYPE_PROPERTY, - TYPE_METHOD, - TYPE_TRANSITION - - }; - - - void create_transition(const String& p_transition, TransitionType p_type); - void transition_set_target(const NodePath& p_node,const String& p_target); - TransitionType transition_get_type() const; - void transition_add_key(const String& p_transition,float p_time, const Variant& p_key); - int transition_get_key_count(const String& p_transition) const; - Variant transition_get_key_time(const String& p_transition.int p_key_index) const - Variant transition_get_key(const String& p_transition,int p_key_index) const; - - void transition_remove_key(const String& p_transition, int p_key_index); - void transition_clear_keys(const String& p_transition); - void remove_transition(const String& p_transition); - - void transition_ - - - Transitioner(); -}; -*/ -#endif // TRANSITIONER_H diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp index 80588d643e..058a7f12bc 100644 --- a/scene/animation/tween_interpolaters.cpp +++ b/scene/animation/tween_interpolaters.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* tween.cpp */ +/* tween_interpolaters.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ |