godot icon indicating copy to clipboard operation
godot copied to clipboard

Remove viewport restrictions in 2D editor

Open KoBeWi opened this issue 3 years ago • 2 comments

Attempt to solve the long-standing issue of not being able to move nodes inside another viewport.

At first glance it works great: godot windows tools 64_TsolVuywxr

Things fall apart when the viewport container is moved: godot windows tools 64_x6XAvVYo5U 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... godot windows tools 64_eji2P9Zq88

And then there is Window, which has a position offset, but doesn't display anything: godot windows tools 64_dSXtSZpOBw

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?)

KoBeWi avatar Jun 10 '22 01:06 KoBeWi

Seems good, needs rebase. I would still ask for a review to @groud.

reduz avatar Aug 06 '22 22:08 reduz

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 >_>

KoBeWi avatar Aug 06 '22 22:08 KoBeWi

Any updates?

gaoshan0621 avatar Apr 19 '23 04:04 gaoshan0621

I opened a PR with alternative approach, which is more promising, but needs to be finished 🙃

KoBeWi avatar Apr 19 '23 10:04 KoBeWi