mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 22:53:01 +00:00
Fix Tweeners to emit finished() when underlying object is deleted
This commit is contained in:
parent
108c603f91
commit
1abd67caac
@ -5,6 +5,7 @@
|
|||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
[PropertyTweener] is used to interpolate a property in an object. See [method Tween.tween_property] for more usage information.
|
[PropertyTweener] is used to interpolate a property in an object. See [method Tween.tween_property] for more usage information.
|
||||||
|
The tweener will finish automatically if the target object is freed.
|
||||||
[b]Note:[/b] [method Tween.tween_property] is the only correct way to create [PropertyTweener]. Any [PropertyTweener] created manually will not function correctly.
|
[b]Note:[/b] [method Tween.tween_property] is the only correct way to create [PropertyTweener]. Any [PropertyTweener] created manually will not function correctly.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<signals>
|
<signals>
|
||||||
<signal name="finished">
|
<signal name="finished">
|
||||||
<description>
|
<description>
|
||||||
Emitted when the [Tweener] has just finished its job.
|
Emitted when the [Tweener] has just finished its job or became invalid (e.g. due to a freed object).
|
||||||
</description>
|
</description>
|
||||||
</signal>
|
</signal>
|
||||||
</signals>
|
</signals>
|
||||||
|
@ -579,6 +579,7 @@ bool PropertyTweener::step(double &r_delta) {
|
|||||||
|
|
||||||
Object *target_instance = ObjectDB::get_instance(target);
|
Object *target_instance = ObjectDB::get_instance(target);
|
||||||
if (!target_instance) {
|
if (!target_instance) {
|
||||||
|
_finish();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
elapsed_time += r_delta;
|
elapsed_time += r_delta;
|
||||||
@ -706,6 +707,7 @@ bool CallbackTweener::step(double &r_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!callback.is_valid()) {
|
if (!callback.is_valid()) {
|
||||||
|
_finish();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,6 +772,7 @@ bool MethodTweener::step(double &r_delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!callback.is_valid()) {
|
if (!callback.is_valid()) {
|
||||||
|
_finish();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user