summaryrefslogtreecommitdiffstats
path: root/editor/plugins/sprite_frames_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/sprite_frames_editor_plugin.cpp')
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 563398e512..7b35351457 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -46,6 +46,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/separator.h"
+#include "scene/resources/atlas_texture.h"
static void _draw_shadowed_line(Control *p_control, const Point2 &p_from, const Size2 &p_size, const Size2 &p_shadow_offset, Color p_color, Color p_shadow_color) {
p_control->draw_line(p_from, p_from + p_size, p_color);
@@ -948,13 +949,16 @@ void SpriteFramesEditor::_animation_name_edited() {
String name = new_name;
int counter = 0;
while (frames->has_animation(name)) {
+ if (name == String(edited_anim)) {
+ edited->set_text(0, name); // The name didn't change, just updated the column text to name.
+ return;
+ }
counter++;
name = new_name + "_" + itos(counter);
}
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Rename Animation"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());
- _rename_node_animation(undo_redo, false, edited_anim, "", "");
undo_redo->add_do_method(frames.ptr(), "rename_animation", edited_anim, name);
undo_redo->add_undo_method(frames.ptr(), "rename_animation", name, edited_anim);
_rename_node_animation(undo_redo, false, edited_anim, name, name);
@@ -1208,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) {