diff options
author | Eldor Zang <e.z.eldor.zang@gmail.com> | 2023-01-01 02:11:04 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-17 15:29:07 +0100 |
commit | 62976659b8aa9a582550b5a19d0ea1b3af494912 (patch) | |
tree | 62cbb1cae8d2fd282f44718aba34dca24bc0c0dc | |
parent | 6212da66e859fff7f3522e67045eeb81fcad0296 (diff) |
Set default name if SpriteFrames name is empty
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index c41bf4b8cc..20b3cf3618 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -807,13 +807,17 @@ void SpriteFramesEditor::_animation_name_edited() { return; } + if (new_name.is_empty()) { + new_name = "new_animation"; + } + new_name = new_name.replace("/", "_").replace(",", " "); String name = new_name; int counter = 0; while (frames->has_animation(name)) { counter++; - name = new_name + " " + itos(counter); + name = new_name + "_" + itos(counter); } EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); |