diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-05-04 20:56:20 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-05-05 14:36:35 +0800 |
commit | 312ec612c78a9d3b5af046332c0bbc54dbca7040 (patch) | |
tree | d4aebaa144026e3aab11a2c1d40c1ca6b7b5b184 /scene/3d | |
parent | 0f8ee1d256c2bc7dc7bafc32e8137644bcc4a8ae (diff) |
Add autocompletion for AnimatedSprite.play()
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/sprite_3d.cpp | 11 | ||||
-rw-r--r-- | scene/3d/sprite_3d.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 223da13b71..8cb5081047 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1247,6 +1247,17 @@ TypedArray<String> AnimatedSprite3D::get_configuration_warnings() const { return warnings; } +void AnimatedSprite3D::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { + if (p_idx == 0 && p_function == "play" && frames.is_valid()) { + List<StringName> al; + frames->get_animation_list(&al); + for (const StringName &name : al) { + r_options->push_back(String(name).quote()); + } + } + Node::get_argument_options(p_function, p_idx, r_options); +} + void AnimatedSprite3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_sprite_frames", "sprite_frames"), &AnimatedSprite3D::set_sprite_frames); ClassDB::bind_method(D_METHOD("get_sprite_frames"), &AnimatedSprite3D::get_sprite_frames); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 028720a783..6ac85a7bbc 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -248,6 +248,8 @@ public: virtual Rect2 get_item_rect() const override; virtual TypedArray<String> get_configuration_warnings() const override; + virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override; + AnimatedSprite3D(); }; |