1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Fix rename animation in SpriteFramesEditor/AnimationNodeStateMachineEditor

When the name suffix grows, the old name is used if it is obtained first.

Fix the case where the following error message would appear when renaming
an animation.

```
ERROR: Animation '' doesn't exist.
   at: get_frame_count (scene/resources/sprite_frames.cpp:71)
```
This commit is contained in:
Rindbee
2023-07-18 13:10:58 +08:00
parent 57919beb05
commit e9cd29cf22
2 changed files with 8 additions and 1 deletions

View File

@@ -1508,6 +1508,10 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
int base = 1;
String name = base_name;
while (state_machine->has_node(name)) {
if (name == prev_name) {
name_edit_popup->hide(); // The old name wins, the name doesn't change, just hide the popup.
return;
}
base++;
name = base_name + " " + itos(base);
}