summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-11-02 14:21:09 +0100
committerGitHub <noreply@github.com>2017-11-02 14:21:09 +0100
commitc880302754352dce1e44bf00bf9b1ac20e71cd1d (patch)
tree2fbaf869a74c05e84ced6dc3b201df1df5fb9984
parentcefdb34f6c1af31048340182c10587099c39da44 (diff)
parent95408c86704b0b57dcff07051e780f8b1f459af1 (diff)
Merge pull request #12566 from bncastle/select_anim_fix
Select correct animation on creation of a new one
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index b8274122f8..b3bb103577 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -365,13 +365,11 @@ void SpriteFramesEditor::_animation_name_edited() {
}
void SpriteFramesEditor::_animation_add() {
- String new_name = "New Anim";
-
- String name = new_name;
+ String name = "New Anim";
int counter = 0;
while (frames->has_animation(name)) {
counter++;
- name = new_name + " " + itos(counter);
+ name = "New Anim " + itos(counter);
}
List<Node *> nodes;
@@ -393,7 +391,7 @@ void SpriteFramesEditor::_animation_add() {
undo_redo->add_undo_method(E->get(), "set_animation", current);
}
- edited_anim = new_name;
+ edited_anim = name;
undo_redo->commit_action();
}