godotengine / godotengine/godot

Reordering `AnimatedSprite2D` involuntarily changes `animation` to copy whatever `AnimatedSprite2D` is open in the inspector

Open
#116,348 0 comments 0 reactions 0 assignees View on GitHub
bug topic:animation topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in v4.7.dev1.official [bf95b6258]

IIRC this has been an issue for a quite a while though.

### System information

Godot v4.7.dev1 - Windows 10 (build 19045) - Multi-window, 3 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 Ti (NVIDIA; 32.0.15.8228) - AMD Ryzen 5 1500X Quad-Core Processor (8 threads) - 15.92 GiB memory

### Issue description

While reordering `AnimatedSprite2D` nodes in a scene that contains multiple of them, often I will find that doing so changes `animation` without my consent. This can even result in `animation` being assigned the name of a nonexistent animation.

This additionally does not create an undo action, perhaps as an extension of how the SpriteFrames bottom panel doesn't seem to create undo actions at all (which might be worthy of its own issue if it doesn't already exist). Similarly, this doesn't happen when selecting multiple nodes or when either `AnimatedSprite2D` doesn't have a `SpriteFrames` resource, probably because the SpriteFrames bottom panel is disabled in both of those cases.

The reordered `AnimatedSprite2D` copies the animation of whatever node is open in the inspector, if that node is also an `AnimatedSprite2D`. This usually occurs in the following two situations:

- Dragging a node without first selecting it to focus it in the inspector.
- Hovering a node while dragging long enough to focus it in the inspector (quite often happens immediately before dropping, if the mouse isn't moving at that point).

Of note is that this specifically occurs when the `AnimatedSprite2D` is *reordered.* If it's just reparented without specifically moving it afterward, `animation` stays the same.

### Steps to reproduce

1. Add two `AnimatedSprite2D` nodes to the scene, ensuring that they both have a valid `sprite_frames`, and that their `animation` values are different.
2. Reorder one of the nodes in a way such that the other `AnimatedSprite2D` is open in the inspector when the first node is dropped.
3. The dropped `AnimatedSprite2D` should now have a different (possibly invalid) `animation`.

### Minimal reproduction project (MRP)

[issue.zip](https://github.com/user-attachments/files/25335656/issue.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.