Skip to content

Commit

Permalink
Add autocompletion options for AnimatedSprite's other play methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Jan 3, 2024
1 parent 07b8860 commit d5a7c78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions scene/2d/animated_sprite_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Node::get_argument_options(p_function, p_idx, r_options);
Expand Down
12 changes: 7 additions & 5 deletions scene/3d/sprite_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Node::get_argument_options(p_function, p_idx, r_options);
Expand Down

0 comments on commit d5a7c78

Please sign in to comment.