Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicating a child node which has @exports on the root does not keep those exports local to the child scene #87774

Closed
ek68794998 opened this issue Jan 31, 2024 · 3 comments
Labels

Comments

@ek68794998
Copy link
Contributor

Tested versions

  • Reproducible in v4.2.1.stable.official [b09f793f5]
  • No other versions tested

System information

Godot v4.2.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3161) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)

Issue description

In the context of a scene, duplicating one of its children which is also a scene and has @export-ed nodes will lead to the paths to those nodes referring to the original child scene, not the duplicated one.

Steps to reproduce

  1. Create a "Root" scene, can be any node type.
  2. Create a second "Child" scene; again, any node type.
  3. Add any node (e.g., AnimationPlayer) as a child in the child scene.
  4. Add a script to the Child scene root, which has an @export of a type matching the node in step 3.
  5. Link the node from step 3 to the propery in step 4.
  6. Instantiate the Child scene in the Root scene. (= name Child) Do NOT override the property, so that it remains in root.tscn as not having a value (i.e., uses default).
  7. Duplicate the Child scene in the Root scene. (= name Child2)

At this point, Child will have a reference to its nested AnimationPlayer. However, Child2 will have a reference to ../Child/AnimationPlayer.

Unfortunately, this means that every time you duplicate a node, you have to click reset on every single one of its node properties—recently had to do this for 20 nodes with 6 properties each, and that was only for a small proof-of-concept.

The MRP included only contains up to step 6, and leaves step 7 as the repro. I've also got a GIF of the behavior here, which shows that both nodes use Child1/AnimationPlayer as their node after duplication.

godot-duplicate-node-path-bug

Minimal reproduction project (MRP)

godot-duplicate-node-path-bug.zip

@Mickeon
Copy link
Contributor

Mickeon commented Jan 31, 2024

I believe this is a duplicate of #78060

@ek68794998
Copy link
Contributor Author

Thanks @Mickeon, I think you're right. I had a cursory look at that thread before and thought node.duplicate() might be distinct from the editor's Duplicate menu, but upon closer reading of that issue and #83343, it seems to be the same functionality.

@Mickeon
Copy link
Contributor

Mickeon commented Jan 31, 2024

it seems to be the same functionality.

Yeah, they use the same method and suffer from the same issue as a result.

I wouldn't usually task myself with closing issues but since we're pretty confident, closing as a duplicate of #78060

@Mickeon Mickeon closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants