godotengine / godotengine/godot

Unexpected change in Nodepath inside Animation resource

Open
#87,726 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic:animation
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.

![Help](https://github.com/godotengine/godot/assets/124409014/bbc5df33-f0e3-4216-be8b-bdd94c2821ef)

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

![help2](https://github.com/godotengine/godot/assets/124409014/36af808f-eb05-4f42-a6a7-feac25003b5c)

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)

![Help](https://github.com/godotengine/godot/assets/124409014/64eed383-5ebe-42f5-ba14-4a5da616a762)

### 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.