Materials on instances using viewport textures do not properly interpret nodepaths
Tested versions
Reproducible in 4.3stable.
System information
MacBook Air M1
Issue description
When adding a ViewportTexture to a material on an instanced mesh scene, the ViewportTexture tries to interpret the NodePath to the SubViewport as a local path:
(in the scope of itself as the root, ie if the SV is a direct child of the mesh the path would simply be "SubViewport")
when the path is instead generated as a global/absolute path:
(in the scope of the scene owner, ie if the SV is a direct child of the mesh the path would be "MeshNode/SubViewport").
This can be temporarily fixed by manually setting the path, but any changes are reset upon scene reload.
When done with a mesh originally created in a scene, the same process occurs, but functions correctly, therefore my best guess is that a scene being instanced treats nodepaths as local by default. Apologies if this is a duplicate or difficult to understand, this is my first issue. :D
Steps to reproduce
- Create a separate scene with a meshinstance3D
- Instance that to another scene
- Add a SubViewport child to that instance
- Add a new StandardMaterial3D, make local to scene, add Viewport texture
- Set subviewport as viewport in viewport texture
- Reload scene
Minimal reproduction project (MRP)
Seems to be a bug in specifically how the editor interprets this combination
Seems to be a bug in specifically how the editor interprets this combination
Most likely, seems that instanced scenes don't realize that they aren't the root. Not sure where this would need to be fixed but I'll do some digging.
Glanced at the code but didn't find anything concrete about where the things are computed, but my immediate suspicion is that it assumes the instanced scene is never the local scene because it's not supposed to be generally, but would be great if you looked around and see!
Seems to be a duplicate of #74331, I'll leave it up to yall to close it but seems to be the exact same issue.