Open shartte opened 5 years ago
I looked into this issue a bit. Although my analysis might be off (have only been using Godot for a very short amount of time).
CanvasLayer nodes register themselves with the current node's parent viewport upon NOTIFICATION_ENTER_TREE
.
A viewport will only consider it's directly registered canvas layers when drawing the environment background in canvas mode.
Since the spatial editor viewports are nested within the primary viewport, no canvas layers will be registered on them, and as such, they will not draw any background. The primary viewport's background is fully obscured by editor controls.
Following this logic, I think I can reproduce this in the normal game by simply using multiple viewports.
I managed to reproduce this outside of the editor now, by using another viewport that shares the same world/environment. Demo is attached. CanvasDemo2.zip
Expected behavior would have been that the icon shows up in the nested viewport as well, since it's sharing the same environment with bgmode=canvas.
Current workaround:
Add a tool script that fishes out the spatial editor viewport from the editor's scene tree and set that as custom_viewport
on the canvas layer. This will allow the canvas layer to show up in one of the spatial viewports.
Godot version: 3.1.0 beta9
Issue description: A canvas layer is not drawn as the background layer in the SpatialEditor, even when using WorldEnvironment with BGMode=canvas, and "Use Environment" is true for the current viewport. The same canvas layer is shown in the running game just fine.
Use case: I need the editor to show the canvas environment because I am working on a game with pre-rendered 3d backgrounds (examples: Pillars of Eternity, Temple of Elemental Evil), but normal 3d scenes. In order to align any node in the editor with the pre-rendered background properly, I need to actually see the background in the editor (adjusting the camera to have the same transform as used when rendering the background is a different issue).
Steps to reproduce:
Minimal reproduction project: CanvasDemo.zip