Skip to content

Commit

Permalink
Merge pull request #79743 from TokageItLab/fix-name-list-asp
Browse files Browse the repository at this point in the history
Make animation name list scroll to new animation in `SpriteEditor`
  • Loading branch information
YuriSizov committed Jul 24, 2023
2 parents c8e191b + 99451b5 commit 7dbbf2e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions editor/plugins/sprite_frames_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,30 +1212,29 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
bool searching = anim_search_box->get_text().size();
String searched_string = searching ? anim_search_box->get_text().to_lower() : String();

TreeItem *selected = nullptr;
for (const StringName &E : anim_names) {
String name = E;

if (searching && name.to_lower().find(searched_string) < 0) {
continue;
}

TreeItem *it = animations->create_item(anim_root);

it->set_metadata(0, name);

it->set_text(0, name);
it->set_editable(0, true);

if (animated_sprite) {
if (name == String(animated_sprite->call("get_autoplay"))) {
it->set_icon(0, autoplay_icon);
}
}

if (E == edited_anim) {
it->select(0);
selected = it;
}
}
if (selected) {
animations->scroll_to_item(selected);
}
}

if (animated_sprite) {
Expand Down

0 comments on commit 7dbbf2e

Please sign in to comment.