A while ago I started a project in Godot 3 that is supposed to allow using four viewports, where you control the camera of the active one with WASD, just like you do it in Godot editor when you divide the 3D view into several views and right-click inside one of them (except in mine you middle-click).
But now in Godot 4 the setup I'm using isn't working due to a very small difference in behavior. But at the same time, this makes me think maybe I'm not even doing it the right way.
To explain what I have:
I used Zylann's Editor Debugger
plugin (in Godot 3), which lets you see the node tree of Godot's editor itself, to figure out which nodes to use, and I came up with a very similar setup (this is a simplified version):

The ViewportContainers
have mouse_entered|exited
signals connected to their own script, which toggles on/off the input of their underlying camera object when the mouse enters or exits.
Now, this works in Godot 3 because when the mouse is hidden those signals are not triggered. When the mouse is hidden Godot centers it on the window, so it will often be outside any given viewport, but not trigger the signal until made visible.
In Godot 4 the signals are triggered while the mouse is hidden, so this doesn't work anymore.
Here are the two test projects I'm using in both versions of Godot:
https://www.mediafire.com/file/qgdvzlhwl2qx1th/gd3_ui_viewport_tests.rar/file
https://www.mediafire.com/file/5k9zpt96ozekp87/gd4_ui_viewports_test.rar/file
(The viewport_test
scene is the main one in both.)
I can't find any information on how to properly do this kind of thing, so I could only rely on reading Godot's own source code so far, but that's always an overwhelming task for me, and so far I haven't found anything useful.