godotengine / godotengine/godot
Node duplication issue with @tool
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
4.2, 4.3 stable
### System information
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)
### Issue description
I noticed a strange problem when duplicating nodes in the scene tree that were added by a plugin, I first encountered this problem in [my plugin](https://github.com/JekSun97/gdTree3D/issues/1) developed using GDExtension, now I decided to test this problem locally in the editor itself using GDScript plugins, and this problem repeated.
If we duplicate a node added using GDExtension or a plugin and `@tool`, then the node is duplicated twice, the more we duplicate this node, the more descendants it has
When reloading a project, extra nodes are sometimes shown in the editor, sometimes not, which is also quite strange.
### Steps to reproduce
1. Open MRP
2. Create a new node added by the "newnode" plugin
3. Duplicate it
4. You will see extra descendants in the output window
### Minimal reproduction project (MRP)
[bugdublicate.zip](https://github.com/user-attachments/files/17654469/bugdublicate.zip)
Contributor guide
Research direction
Start by opening the attached bugdublicate.zip minimal reproduction project in Godot 4.3 and follow the listed steps: create the node from the newnode plugin, duplicate it, and inspect the output and scene tree. The issue is done when plugin or GDExtension nodes using @tool duplicate only once and reloading the project does not produce extra descendants.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100