diff options
author | Silc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com> | 2023-07-21 19:20:53 +0900 |
---|---|---|
committer | Silc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com> | 2023-07-21 19:36:25 +0900 |
commit | 99451b55c225c0dad588f94f57ef11962876aff4 (patch) | |
tree | f078ab3be1c7a9dde8818e9579cfadfd5c803f05 | |
parent | 38ccab2ab3975bca051e98120ef616e9f74cdb2e (diff) | |
download | redot-engine-99451b55c225c0dad588f94f57ef11962876aff4.tar.gz |
Make animation name list scroll to new animation in SpriteEditor
Co-authored-by: DarellLdark <darell.ldark@gmail.com>
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 6b0e87e5e8..9715250405 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1209,30 +1209,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) { |