Skip to content

Use SplitContainer for Node3D Editor viewports#117203

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
kitbdev:sc-ed3d
Mar 9, 2026
Merged

Use SplitContainer for Node3D Editor viewports#117203
Repiteo merged 1 commit intogodotengine:masterfrom
kitbdev:sc-ed3d

Conversation

@kitbdev
Copy link
Contributor

@kitbdev kitbdev commented Mar 8, 2026

The previous approach for the Node3D Editor's viewport container had some issues:

  • It used SplitContainer's separation but grabbing did not account for minimum_grab_thickness. This made it more difficult to grab.
  • The splitter icons had rendering issues when dragging (it flickers / doesn't show when dragging in some cases).
  • No touch dragger support.
  • No accessibility support.
  • At compact spacing preset, there was no space between them and it was impossible to drag them.
image

These could be fixed on their own, but it is better to just use SplitContainer to handle all of it.

I changed it to use 3 SplitContainers, one main one and two children. I change their vertical flags when needed to fit the different layouts.
I also made sure that the horizontal/vertical positions would remain the same when switching layouts like before.
These use the new drag nested intersections SplitContainer option so you can still adjust multiple at once. Also you can drag the intersection between one of these and the docks now. related godotengine/godot-proposals#14300

The four-way works by disabling the first child split and using the second child's drag margin to expand it over the first, and setting the first child split offset to follow.

I set minimum size of viewports to 39. This is the value I got when I minimized them on master, not sure why that value or where it is from, but it keeps the behavior the same.

Removed the 3-way and 4-way grabber icons. Drag nested intersections handles it by showing both regular grabber icons instead.
The 3-way icons had another issue too, sometimes it was not aligned correctly. Related #74691

The exact viewport that is used for certain positions in some layouts have changed a bit, but I don't think it is that important to keep the same. 2 viewports (including alt) now use indexes 0 and 1 instead of 0 and 2, and 3 viewports alt now uses 0,1,2 instead of 0,2,3.

I also fixed an issue in SplitContainer where enabling the touch dragger didn't hide it if dragging was disabled until it was sorted, it now updates immediately. Otherwise in the four way, it would show incorrectly for the first split until it gets updated.

image

@kitbdev kitbdev added this to the 4.x milestone Mar 8, 2026
@kitbdev kitbdev requested review from a team as code owners March 8, 2026 02:42
Copy link
Contributor

@ryevdokimov ryevdokimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works. Tested all the different configurations, spacing presets and touch screen.

Code looks fine to me.

The exact viewport that is used for certain positions in some layouts have changed a bit, but I don't think it is that important to keep the same.

I believe this will affect how viewport state is reloaded when people upgrade, but this is a onetime annoyance, and I don't think worth worrying about.

Quick Demo:

2026-03-08.15-00-34.mp4

@ryevdokimov ryevdokimov modified the milestones: 4.x, 4.7 Mar 8, 2026
@Repiteo Repiteo merged commit fbc00f1 into godotengine:master Mar 9, 2026
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Mar 9, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants