godotengine / godotengine/godot

Duplicating a node tree with a @tool script that edits global_position/global_rotation causes nodes to lose their transforms

Open
#89,848 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs testing topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

Tested versions
  • Reproducible in: v4.2.1.stable
System information

Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.5176) - AMD Ryzen 5 5600H with Radeon Graphics (12 Threads)

Issue description

Duplicating a node tree with a @tool script that edits global_position/global_rotation causes nodes to lose their transforms.
A spam of scene/3d/node_3d.cpp:343 - Condition "!is_inside_tree()" is true. Returning: Transform3D() errors print in the console.

https://github.com/godotengine/godot/assets/39361911/9985cc7f-d814-413c-a53a-0601109b8230

Steps to reproduce

Create a Node3D, with a set of Node3D children
Attach a @tool script to the children that has a function that changes global_position/global_rotation
Create a exported bool "button" that allows the function to be called from the inspector, such as @export var function: bool = false : set = function_exec
Duplicate the Node3D

Minimal reproduction project (MRP)

Script_Position_Bug.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 linked Script_Position_Bug.zip reproduction and follow the reported errors at scene/3d/node_3d.cpp:343 during Node3D duplication. Reproduce the @tool script that changes global_position/global_rotation, then verify that duplicating the tree preserves node transforms without the is_inside_tree() errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.