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 node with ViewportTexture keeps reference to the original #92104

Closed
DeeJayLSP opened this issue May 19, 2024 · 2 comments
Closed
Labels

Comments

@DeeJayLSP
Copy link
Contributor

DeeJayLSP commented May 19, 2024

Tested versions

4.2.2

System information

Nobara Linux 39

Issue description

I have a node tree with a Sprite3D that uses a ViewportTexture, referencing a child SubViewport. This node tree needs to be duplicated for the intended usage.

The issue is, when the tree gets duplicated, the SubViewport gets duplicated as well, but the reference ViewportTexture is using is the one on the original tree instead of the duplicate.

Steps to reproduce

Make a scene with the following structure:

  • Node3D
    • Sprite3D (assign the SubViewport below as the sprite)
      • SubViewport
        • Sprite2D
      • AnimationPlayer

On the animation player, make two animations: one to rotate clockwise (default), and another to rotate counter-clockwise.

Then make a script that duplicates the Sprite3D, adds the duplicate slightly to the side of the original, and make its animation player play the counter-clockwise one.

Nothing will happen. Because the SubViewport on the second is the same as the first. Evidenced by any animation changes on the first also being applied on the second.

Additionally, trying to assign the duplicate SubViewport on the second overrides the first.

Despite being checked by default, resource_local_to_scene doesn't seem to have any effect.

A solution with code would be to get the duplicated SubViewport's texture with get_texture() and assign it to the Sprite.

Minimal reproduction project (MRP)

Viewport Duplicate Bug.zip

@AThousandShips
Copy link
Member

@DeeJayLSP
Copy link
Contributor Author

Duplicate of #78060

At least people with this issue will know how to workaround until it gets fixed.

@DeeJayLSP DeeJayLSP closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 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