godot
godot copied to clipboard
Remove viewport restrictions in 2D editor
Attempt to solve the long-standing issue of not being able to move nodes inside another viewport.
At first glance it works great:

Things fall apart when the viewport container is moved:
Editor gizmos appear relative to the main viewport instead of the sub-viewport.
If the viewport isn't in a container, the offset doesn't appear, but the node doesn't appear either, even though you can edit it...

And then there is Window, which has a position offset, but doesn't display anything:

So with this solution, you can edit nodes inside a sub-viewport without a problem, IF the sub viewport is inside a container, which is located at (0, 0). It works in other cases too, but the node isn't displayed correctly.
The main reason I opened this PR is #60088. Dialogs were changed from Control to Window, so their content can't be edited easily. IMO it's time to do something about the viewport issue. The PR lays some foundation, and we could think of some fix for the new problems. Mainly the offset problem. Edited nodes in sub-viewport should somehow be able to offset their gizmos based on the viewport position. Not sure if this is possible.
Resolves #20619 Fixes #60088 (content doesn't display, but technically you can edit it) Closes https://github.com/godotengine/godot-proposals/issues/2139 (I think?)
Seems good, needs rebase. I would still ask for a review to @groud.
Seems good
Which part xd I attached a few GIFs showing how much it is broken. The editor issues need to be resolved somehow, maybe by adding some helper methods for determining sub-viewport position. Sounds complicated, so I didn't even try yet >_>
Any updates?
I opened a PR with alternative approach, which is more promising, but needs to be finished 🙃