diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 08f72f21f99..dd47436705f 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -43252,10 +43252,10 @@ - + - Stop animating and completely remove a tween, given its object and property/method pair. Passing empty String as key will remove all tweens for given object. + Stop animating and completely remove a tween, given its object and property/method pair. @@ -43270,10 +43270,10 @@ - + - Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. Passing empty String as key will reset all tweens for given object. + Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. @@ -43288,10 +43288,10 @@ - + - Continue animating a stopped tween, given its object and property/method pair. Passing empty String as key will resume all tweens for given object. + Continue animating a stopped tween, given its object and property/method pair. @@ -43350,10 +43350,10 @@ - + - Stop animating a tween, given its object and property/method pair. Passing empty String as key will stop all tweens for given object. + Stop animating a tween, given its object and property/method pair. diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 156f4956bb0..adc8f9c8cfc 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, DEFVAL("") ); + ObjectTypeDB::bind_method(_MD("reset","object","key"),&Tween::reset ); ObjectTypeDB::bind_method(_MD("reset_all"),&Tween::reset_all ); - ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop, DEFVAL("") ); + ObjectTypeDB::bind_method(_MD("stop","object","key"),&Tween::stop ); ObjectTypeDB::bind_method(_MD("stop_all"),&Tween::stop_all ); - ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume, DEFVAL("") ); + ObjectTypeDB::bind_method(_MD("resume","object","key"),&Tween::resume ); ObjectTypeDB::bind_method(_MD("resume_all"),&Tween::resume_all ); - ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove, DEFVAL("") ); + ObjectTypeDB::bind_method(_MD("remove","object","key"),&Tween::remove ); 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 || p_key == "")) { + if(object == p_object && data.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 || p_key == "")) + if(object == p_object && data.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 || p_key == "")) + if(object == p_object && data.key == p_key) data.active = true; } pending_update --; @@ -821,20 +821,17 @@ bool Tween::remove(Object *p_object, String p_key) { call_deferred("remove", p_object, p_key); return true; } - List::Element *> for_removal; for(List::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 || p_key == "")) { - for_removal.push_back(E); + if(object == p_object && data.key == p_key) { + interpolates.erase(E); + return true; } } - for(List::Element *>::Element *E=for_removal.front();E;E=E->next()) { - interpolates.erase(E->get()); - } return true; }