diff options
author | sanikoyes <sanikoyes@163.com> | 2014-08-20 12:19:22 +0800 |
---|---|---|
committer | sanikoyes <sanikoyes@163.com> | 2014-08-20 12:19:22 +0800 |
commit | b51da466e9fc25fb39e499f1d521a2a0b78c63cf (patch) | |
tree | bc98514af3d1a8ba68e4e1f3936b4868081b469e | |
parent | f75b8a81d2f356627731633471b2fe992daa1edf (diff) |
Add remove/remove_all for tween
-rw-r--r-- | scene/animation/tween.cpp | 27 | ||||
-rw-r--r-- | scene/animation/tween.h | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index e7876e3bfa..eebb0d6777 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -115,6 +115,10 @@ void Tween::_bind_methods() { ObjectTypeDB::bind_method(_MD("reset_all"),&Tween::reset_all ); ObjectTypeDB::bind_method(_MD("stop","object,key"),&Tween::stop ); ObjectTypeDB::bind_method(_MD("stop_all"),&Tween::stop_all ); + ObjectTypeDB::bind_method(_MD("resume"),&Tween::resume ); + ObjectTypeDB::bind_method(_MD("resume_all"),&Tween::resume_all ); + ObjectTypeDB::bind_method(_MD("remove"),&Tween::remove ); + ObjectTypeDB::bind_method(_MD("remove_all"),&Tween::remove_all ); ObjectTypeDB::bind_method(_MD("interpolate_property","object","property","initial_val","final_val","times_in_sec","trans_type","ease_type"),&Tween::interpolate_property ); ObjectTypeDB::bind_method(_MD("interpolate_method","object","method","initial_val","final_val","times_in_sec","trans_type","ease_type"),&Tween::interpolate_method ); @@ -485,6 +489,29 @@ bool Tween::resume_all() { return true; } +bool Tween::remove(Variant p_object, String p_key) { + + for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { + + InterpolateData& data = E->get(); + if(data.object == p_object && data.key == p_key) { + + interpolates.erase(E); + return true; + } + } + return true; +} + +bool Tween::remove_all() { + + set_active(false); + _set_process(false); + interpolates.clear(); + return true; +} + + bool Tween::_calc_delta_val(InterpolateData& p_data) { Variant& initial_val = p_data.initial_val; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 9d087f93ca..5a8186cc21 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -130,6 +130,8 @@ public: bool stop_all(); bool resume(Variant p_object, String p_key); bool resume_all(); + bool remove(Variant p_object, String p_key); + bool remove_all(); bool interpolate_property(Variant p_object , String p_property |