Godot Version
4.7.1.stable
Question
Hi, I’m working on a compositor shader effect, and it requires the exchange of data between two compositors, and the only way to do that is by making a singleton to hold references to the passed data (I’m specifically transmitting a rendered frame from one viewport to my main compositor effect, where the auxiliary compositor doesn’t even instance a glsl shader, it just grabs the texture RID and stores it on the singleton every render callback). The singleton is a @tool script, as well as every edited scene root.
The problem arises when opening multiple scenes, or multiple viewports in the editor, as that will change what camera is rendering the viewport and the reference to the current camera on the singleton becomes stale. I could check every frame if EditorInterface.get_editor_viewport_3d(i).get_camera_3d() == Singleton.aux_cameras[i], but that just seems like a waste of resources. I know a plugin has exactly that functionality, but it seems way too overkill to make a plugin just for one compositor effect to work in the editor…
Is there a solution that isn’t the plugin method? It’s really important to me that my shaders are previewable in the editor, for ease of implementation when I pass it on to the community.