From d5a7c7818c2424c9dc919d9e6d163a39bf13f081 Mon Sep 17 00:00:00 2001 From: Micky Date: Wed, 3 Jan 2024 01:33:08 +0100 Subject: [PATCH] Add autocompletion options for AnimatedSprite's other play methods --- scene/2d/animated_sprite_2d.cpp | 12 +++++++----- scene/3d/sprite_3d.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 08b315fa6c6..828069f2fab 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -577,11 +577,13 @@ PackedStringArray AnimatedSprite2D::get_configuration_warnings() const { } void AnimatedSprite2D::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { - if (p_idx == 0 && p_function == "play" && frames.is_valid()) { - List al; - frames->get_animation_list(&al); - for (const StringName &name : al) { - r_options->push_back(String(name).quote()); + if (p_idx == 0 && frames.is_valid()) { + if (p_function == "play" || p_function == "play_backwards" || p_function == "set_animation" || p_function == "set_autoplay") { + List 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); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index b8b0d31d451..17e72be9aae 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1439,11 +1439,13 @@ PackedStringArray AnimatedSprite3D::get_configuration_warnings() const { } void AnimatedSprite3D::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { - if (p_idx == 0 && p_function == "play" && frames.is_valid()) { - List al; - frames->get_animation_list(&al); - for (const StringName &name : al) { - r_options->push_back(String(name).quote()); + if (p_idx == 0 && frames.is_valid()) { + if (p_function == "play" || p_function == "play_backwards" || p_function == "set_animation" || p_function == "set_autoplay") { + List 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);