Set default name if SpriteFrames name is empty

This commit is contained in:
Eldor Zang 2023-01-01 02:11:04 +02:00 committed by Rémi Verschelde
parent 6212da66e8
commit 62976659b8
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -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();