godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.13k stars 21.19k forks source link

Errors when instancing a sprite that contains a viewport #34126

Open jabcross opened 4 years ago

jabcross commented 4 years ago

Godot version: commit 9002b045c (Godot 3.2 beta)

OS/device including version: Linux Mint 19

Issue description:

Instancing a Sprite3D with a ViewportTexture that points to a viewport which descends from it generates many errors and doesn't render correctly.

image

image

Minimal reproduction project:

viewport_wierdness.zip

jabcross commented 4 years ago

Making it so the viewport doesn't descend from the sprite only prevents some of the errors, and now it renders correctly. The error messages are still annoying, tho.

image

Interestingly, changing the order of the nodes changes the number of errors too.

image

jabcross commented 4 years ago

On further inspection, I attempt to assign the ViewportTexture through GDScript.

The highlighted line doesn't seem to execute; after that, the Sprite3D's texture is still [empty] in the remote inspector.

image

jabcross commented 4 years ago

Found a workaround: setting the texture from code using Viewport::get_texture() seems to work. However, I think that the other way I tried to do it should have worked as well.

Also, doing this on ready prevents it from rendering in the editor.

Seems like changing the viewport path dynamically doesn't update the vp pointer in ViewportTexture.

KoBeWi commented 3 years ago

Still valid in a3a3b02 I re-assigned the viewport path and it reduced error count from 7 to 4. The viewport texture displays correctly despite the error.

EDIT: On another test, seems like this error only appears on saving. I remember some issue where scene is fake-instanced upon save, which might lead to errors. This is probably the case here.

Issue is still fully valid in 3.2.4 beta3 though.