Merge pull request #86733 from Mickeon/autocompletion-more-animated-sprite

Add autocompletion options for AnimatedSprite's other play methods
This commit is contained in:
Rémi Verschelde 2024-01-03 10:15:01 +01:00
commit d822fd5322
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 14 additions and 10 deletions

View file

@ -577,11 +577,13 @@ PackedStringArray AnimatedSprite2D::get_configuration_warnings() const {
}
void AnimatedSprite2D::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());
if (p_idx == 0 && frames.is_valid()) {
if (p_function == "play" || p_function == "play_backwards" || p_function == "set_animation" || p_function == "set_autoplay") {
List<StringName> al;
frames->get_animation_list(&al);
for (const StringName &name : al) {
r_options->push_back(String(name).quote());
}
}
}
Node2D::get_argument_options(p_function, p_idx, r_options);

View file

@ -1439,11 +1439,13 @@ PackedStringArray AnimatedSprite3D::get_configuration_warnings() const {
}
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());
if (p_idx == 0 && frames.is_valid()) {
if (p_function == "play" || p_function == "play_backwards" || p_function == "set_animation" || p_function == "set_autoplay") {
List<StringName> al;
frames->get_animation_list(&al);
for (const StringName &name : al) {
r_options->push_back(String(name).quote());
}
}
}
SpriteBase3D::get_argument_options(p_function, p_idx, r_options);