godotengine / godotengine/godot
Unexpected change in Nodepath inside Animation resource
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
-Reproducible: 4.2.1 stable , 4.1.3 stable
### System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 31.0.23013.1023) - AMD Ryzen 5 5500 (12 Threads)
### Issue description
I have this instanciable Node with an Animation Player attached. This animation track has unknowingly changed the Node it affects (its Nodepath), so instead of targeting itself, it targets the first instance of the Node at the scene, resulting in the following: only said Node will trigger the animation, regardless if you have many instances of them, shown in the image bellow. If the Node is freed, this error appears: `E 0:00:07:0527 get_node: Node not found: "../Enemy/BodyAnim:modulate". Method/function failed. Returning: nullptr scene/main/node.cpp:1638 @ get_node()`.
Both in the error above and in the resource (converted into .tres for readability), it is clear why this happens: Nodepath is targeting a specific Node (called Enemy) found in the Scenetree.

Instead of the usual behavior of targeting itself and its own properties, which allow instances to play the animation on themselves:

This had happened all of a sudden, on a bigger project, without me even touching the animation track after it was done (which was working as expected)

### Steps to reproduce
I don't have any clue as to how this happened. However, the MRP has the project in the same way when it happened: a library, an external animation resource loaded into it.
### Minimal reproduction project (MRP)
[AnimBug.zip](https://github.com/godotengine/godot/files/14092107/AnimBug.zip)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached AnimBug.zip minimal reproduction project and inspect the Animation Player's external animation resource, including the serialized .tres NodePath track. Review the get_node entry point reported at scene/main/node.cpp:1638 and compare the track's target with the expected instanced-node behavior; the issue is complete when the animation targets each instance rather than a specific scene node.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100