diff options
author | Pawel Kowal <pkowal1982@gmail.com> | 2016-09-25 23:25:52 +0200 |
---|---|---|
committer | Pawel Kowal <pkowal1982@gmail.com> | 2016-09-25 23:25:52 +0200 |
commit | acc242fd6a3fc0dda18c01290263313e09d8269e (patch) | |
tree | c0420ecadff88b173c175fd4335640be3dd2ee06 /scene/animation | |
parent | 20c7b65b7e3630ada9f2e8b6b64926ec05d68c4c (diff) |
Tween reset/stop/resume/remove for all object properties at once
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/tween.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index adc8f9c8cf..156f4956bb 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -199,13 +199,13 @@ void Tween::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_tween_process_mode"),&Tween::get_tween_process_mode); ObjectTypeDB::bind_method(_MD("start"),&Tween::start ); - ObjectTypeDB::bind_method(_MD("reset","object","key"),&Tween::reset ); + ObjectTypeDB::bind_method(_MD("reset","object","key"),&Tween::reset, DEFVAL("") ); ObjectTypeDB::bind_method(_MD("reset_all"),&Tween::reset_all ); - ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop ); + ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop, DEFVAL("") ); ObjectTypeDB::bind_method(_MD("stop_all"),&Tween::stop_all ); - ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume ); + ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume, DEFVAL("") ); ObjectTypeDB::bind_method(_MD("resume_all"),&Tween::resume_all ); - ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove ); + ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove, DEFVAL("") ); ObjectTypeDB::bind_method(_MD("remove_all"),&Tween::remove_all ); ObjectTypeDB::bind_method(_MD("seek","time"),&Tween::seek ); ObjectTypeDB::bind_method(_MD("tell"),&Tween::tell ); @@ -723,7 +723,7 @@ bool Tween::reset(Object *p_object, String p_key) { if(object == NULL) continue; - if(object == p_object && data.key == p_key) { + if(object == p_object && (data.key == p_key || p_key == "")) { data.elapsed = 0; data.finish = false; @@ -759,7 +759,7 @@ bool Tween::stop(Object *p_object, String p_key) { Object *object = ObjectDB::get_instance(data.id); if(object == NULL) continue; - if(object == p_object && data.key == p_key) + if(object == p_object && (data.key == p_key || p_key == "")) data.active = false; } pending_update --; @@ -793,7 +793,7 @@ bool Tween::resume(Object *p_object, String p_key) { Object *object = ObjectDB::get_instance(data.id); if(object == NULL) continue; - if(object == p_object && data.key == p_key) + if(object == p_object && (data.key == p_key || p_key == "")) data.active = true; } pending_update --; @@ -821,17 +821,20 @@ bool Tween::remove(Object *p_object, String p_key) { call_deferred("remove", p_object, p_key); return true; } + List<List<InterpolateData>::Element *> for_removal; for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { InterpolateData& data = E->get(); Object *object = ObjectDB::get_instance(data.id); if(object == NULL) continue; - if(object == p_object && data.key == p_key) { - interpolates.erase(E); - return true; + if(object == p_object && (data.key == p_key || p_key == "")) { + for_removal.push_back(E); } } + for(List<List<InterpolateData>::Element *>::Element *E=for_removal.front();E;E=E->next()) { + interpolates.erase(E->get()); + } return true; } |