-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use HFlowContainers for toolbars to allow for smaller resizing of the MainScreen element #7156
Comments
I remember this being attempted in the past, and there were some blockers that made it not worthwhile for now. I don't remember what exactly was the problem though. |
Thanks for the reply! One issue I've come across so far with this approach is that the extra controls that get dynamically added onto the top toolbar (like for example the ControlEditorToolbar), get floated to the far right, because the HFlow is set to expand. |
The bottom dock could be converted into a TabBar instead of using buttons, so it has functionality like the other docks including resizing down. This way it also doesn't take up more vertical space. |
--Google translate-- |
Describe the project you are working on
This aims to solve an editor limitation, regardless of the type of project.
Describe the problem or limitation you are having in your project
The godot editor window cannot be horizontally resized to small sizes. When it reaches a small enough width, the content of the editor starts clipping and becomes inaccessible.
For example:
This is on a 1920x1080 screen, with Godot resized to exactly half the width of the screen. The right-most part of the inspector tab is clipped. The central MainScreen cannot be resized to a smaller size (in an attempt to bring the inspector back into the window).
This behaviour is frustrating, and instead I'd like to be able to still see and access everything, even if I have to sacrifice real estate of the main screen.
I think this is an issue that's most likely to come up when using tiled window managers, and most notably when one tries to have two godot windows side by side, e.g. for copying stuff between projects or when referencing another project.
The same issue was raised in #4845. The toolbars are the main culprit and using HFlowContainers instead of HBoxes seems like a good compromise to me.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allow the central MainScreen control to be resized to a smaller width.
That way we can make use of a much smaller total editor width, while everything remains accessible instead of clipped.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The main culprit for the inability to resize this node are the horizontal toolbars. The main one at the top with all the buttons, just below the open files tab, and the one at the very bottom ("Output, Debugger..."). These use an HBoxContainer, which cannot be resized to be smaller than the total width of the children.
By replacing the HBox with an HFlowContainer we can allow the toolbars to be resized smaller.
Example:
The godot editor still takes half the screen width, but now the toolbars are wrapping on a new row and the inspector becomes accessible.
Now I can also fit two godot windows in the same 1920px screen side by side, which is helpful when copying stuff between projects:
EDIT: And this is possibly even more relevant now that the script window can be floated:
I have proof-of-concept code for this on my fork: https://github.com/nyxkn/godot/tree/flow-resize
It needs some cleanup but I'm happy to do that and open a PR in case there is interest in this proposal. Also happy to work on this problem through other angles if suggested.
I also remove the minimum_size of 170px for the dock elements and the 200px minimum size from the tabcontainer of the script editor. The latter is necessary to resize the script view, but the docks change makes less of an improvement and potentially not needed.
Here is a video of the resizing in action. The toolbars are automatically reflowed into multiple rows, saving horizontal space.
flow-resize-demo-2.mp4
At the smallest, when toolbars have many rows, it doesn't look the prettiest, but everything is still accessible, which is probably a nicer solution than to let some of the content be clipped.
I'll note one issue with this approach: I had to remove the spacers in the script toolbar because they're only available for hboxes. But the same spacer layout can maybe be achieved in other ways with the hflowcontainer.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I think an editor plugin could be used to remove some of the minimum_size constraints set on a few things, namely the dock elements and the open files tabcontainer, but it might not be able to replace the hboxes with hflows.
Is there a reason why this should be core and not an add-on in the asset library?
This seems to need to be a core modification.
The text was updated successfully, but these errors were encountered: