Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpriteFrames window renaming animation to empty still causes error and spurious naming conflict if already "new_animation" #73883

Closed
hsandt opened this issue Feb 24, 2023 · 1 comment · Fixed by #79600

Comments

@hsandt
Copy link
Contributor

hsandt commented Feb 24, 2023

Godot version

v4.0.rc4.official [e0de357]

System information

Linux Ubuntu 20.04 with Unity desktop

Issue description

Following PR #70788 solving issue #70769, there are still a few bugs remaining.

  1. Editing any animation name to empty string will auto-fix it with "new_animation[suffix]" as expected, but still show the Output error just before:

Animation '' doesn't exist.
Rename Animation

  1. Renaming an animation already named "new_animation[suffix]" will consider the old name to be reserved, causing a conflict with itself and increment the suffix without needing to. For instance, "new_animation" -> empty string will become "new_animation_1". If "new_animation_1" already exists, it will become "new_animation_2", etc.

Basically, it should behave as if the user actually input "new_animation" instead of empty string. Looking at 6297665 I'd say that the empty -> "new_animation" fallback should be done earlier, before if (new_name == String(edited_anim)) to fix 2. and before if (!frames->has_animation(edited_anim)) to fix 1. But I'm not sure of possible side effects, so this needs to be tested.

Steps to reproduce

  1. In any project: create new Sprite Frames resource
  2. In SpriteFrames window: you'll see "default" animation. Try to rename it to empty string -> becomes "new_animation" as it should.
  3. Check the Output console: observe error "Animation '' doesn't exist."
  4. Rename the animation to empty string again. This time, it becomes "new_animation_1".
  5. Try various combinations of existing suffixes by adding new animations multiple times, and observe how number resolution by increment occurs as usual, but unnecessarily skipping the very animation that is renamed.

Minimal reproduction project

N/A

@akien-mga akien-mga added this to the 4.x milestone Feb 24, 2023
@akien-mga akien-mga changed the title v4.0.rc4 - SpriteFrames window renaming animation to empty still causes error and spurious naming conflict if already "new_animation" SpriteFrames window renaming animation to empty still causes error and spurious naming conflict if already "new_animation" Feb 24, 2023
@TokageItLab TokageItLab self-assigned this Mar 1, 2023
@Rindbee
Copy link
Contributor

Rindbee commented Jul 18, 2023

Whenever an animation is renamed, the following error message is output:

ERROR: Animation '' doesn't exist.
   at: get_frame_count (scene/resources/sprite_frames.cpp:71)

It is mainly caused by the following code:

_rename_node_animation(undo_redo, false, edited_anim, "", "");

undo_redo->add_do_method(E, "set_animation", p_new_animation);

int frame_count = frames->get_frame_count(animation);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants