Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/classes/Tween.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@
[b]Note:[/b] As it results from accumulating frame deltas, the time returned after the [Tween] has finished animating will be slightly greater than the actual [Tween] duration.
</description>
</method>
<method name="has_tweeners" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if any [Tweener] has been added to the [Tween] and the [Tween] is valid. Useful when tweeners are added dynamically and the tween can end up empty. Killing an empty tween before it starts will prevent errors.
</description>
</method>
<method name="interpolate_value" qualifiers="static">
<return type="Variant" />
<param index="0" name="initial_value" type="Variant" />
Expand Down
5 changes: 5 additions & 0 deletions scene/animation/tween.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ void Tween::kill() {
dead = true;
}

bool Tween::has_tweeners() const {
return !tweeners.is_empty();
}

bool Tween::is_running() {
return running;
}
Expand Down Expand Up @@ -441,6 +445,7 @@ void Tween::_bind_methods() {
ClassDB::bind_method(D_METHOD("kill"), &Tween::kill);
ClassDB::bind_method(D_METHOD("get_total_elapsed_time"), &Tween::get_total_time);

ClassDB::bind_method(D_METHOD("has_tweeners"), &Tween::has_tweeners);
Comment thread
AThousandShips marked this conversation as resolved.
Outdated
ClassDB::bind_method(D_METHOD("is_running"), &Tween::is_running);
ClassDB::bind_method(D_METHOD("is_valid"), &Tween::is_valid);
ClassDB::bind_method(D_METHOD("bind_node", "node"), &Tween::bind_node);
Expand Down
1 change: 1 addition & 0 deletions scene/animation/tween.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class Tween : public RefCounted {
void play();
void kill();

bool has_tweeners() const;
bool is_running();
bool is_valid();
void clear();
Expand Down