From 0cc8a3b9a68c1b9644b11cecdeff0807b6eaa3f9 Mon Sep 17 00:00:00 2001 From: DualMatrix Date: Wed, 28 Nov 2018 01:43:34 +0100 Subject: [PATCH] Made it possible to read AnimationPlayer queue from GDscript --- scene/animation/animation_player.cpp | 10 ++++++++++ scene/animation/animation_player.h | 1 + 2 files changed, 11 insertions(+) diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 64202ba0e32..7f9953ab434 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1120,6 +1120,15 @@ void AnimationPlayer::queue(const StringName &p_name) { queued.push_back(p_name); } +PoolVector AnimationPlayer::get_queue() { + PoolVector ret; + for (List::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); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index f50b2454ec3..b3bf8b1e228 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -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 get_queue(); void clear_queue(); void stop(bool p_reset = true); bool is_playing() const;