godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.05k stars 65 forks source link

Allow SplitContainer to have more than 2 children #9666

Open lullabyist opened 2 weeks ago

lullabyist commented 2 weeks ago

Describe the project you are working on

I'm working on an application that is able to recursively divide its viewports the way Blender is able to.

Describe the problem or limitation you are having in your project

For this, the built in SplitContainer class is almost perfect, except for the fact that it limits its children to a max of 2. I'm having a hard time understanding why this is so, and working with BoxContainer is proving a little clunky since setting the minimum size for a child being manipulated isn't always predictable, and adjusting size directly doesn't affect a sibling.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If SplitContainer was able to accept arbitrary amounts of children, with with the stretch ratio of the child determining space allotment on resizing the container (for instance, 1:3:1 for Godot's left sidebar, middle viewport and right sidebar), I feel like it would be a big improvement on the current behavior. This would also allow the application I'm making to scale well to ultrawide displays.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Horizontal splitcontainer children in blue, vertical in red. godot splitcontainer proposal

If this enhancement will not be used often, can it be worked around with a few lines of script?

I'm sure it can work as a custom type, I just felt it worthwhile to propose this since I didn't understand the reason for the limitation. If someone could let me know, or tell me what kind of container Godot uses for its three (upto five?) main horizontal panes, that would help me as well. I appreciate it.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

kleonc commented 2 weeks ago

Seems like there's already a PR for this:

redsett commented 2 weeks ago

I've always just nested them. But it would be nice to not have to do that.

lullabyist commented 1 week ago

Seems like there's already a PR for this:

* [Allow SplitContainer to have more than two children godot#90411](https://github.com/godotengine/godot/pull/90411).

Haha, verbatim. No idea how I missed this, thank you.