Merge pull request #24024 from DualMatrix/queue

Made it possible to read AnimationPlayer queue from GDscript
This commit is contained in:
Rémi Verschelde 2018-11-28 09:56:36 +01:00 committed by GitHub
commit 0307f2885c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -1120,6 +1120,15 @@ void AnimationPlayer::queue(const StringName &p_name) {
queued.push_back(p_name);
}
PoolVector<String> AnimationPlayer::get_queue() {
PoolVector<String> ret;
for (List<StringName>::Element *E = queued.front(); E; E = E->next()) {
ret.push_back(E->get());
}
return ret;
}
void AnimationPlayer::clear_queue() {
queued.clear();
}
@ -1603,6 +1612,7 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_assigned_animation", "anim"), &AnimationPlayer::set_assigned_animation);
ClassDB::bind_method(D_METHOD("get_assigned_animation"), &AnimationPlayer::get_assigned_animation);
ClassDB::bind_method(D_METHOD("queue", "name"), &AnimationPlayer::queue);
ClassDB::bind_method(D_METHOD("get_queue"), &AnimationPlayer::get_queue);
ClassDB::bind_method(D_METHOD("clear_queue"), &AnimationPlayer::clear_queue);
ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationPlayer::set_active);

View file

@ -312,6 +312,7 @@ public:
void play(const StringName &p_name = StringName(), float p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
void play_backwards(const StringName &p_name = StringName(), float p_custom_blend = -1);
void queue(const StringName &p_name);
PoolVector<String> get_queue();
void clear_queue();
void stop(bool p_reset = true);
bool is_playing() const;