Skip to content
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

Add WindowContainer similiar to SubviewportContainer #11437

Open
Kakiroi opened this issue Dec 28, 2024 · 4 comments
Open

Add WindowContainer similiar to SubviewportContainer #11437

Kakiroi opened this issue Dec 28, 2024 · 4 comments

Comments

@Kakiroi
Copy link

Kakiroi commented Dec 28, 2024

Describe the project you are working on

A game with lots of UI.

Describe the problem or limitation you are having in your project

Embedding window node into Control node is currently a manual operation. It would be much straightforward to have a node like a SubviewportCotainer that contains Window node.

The reason you might be using this is when you need multiple ui focuses in your game. Currently Godot does not support multiple ui focuses in a single viewport. The only way to achieve this is by embedding multiple windows.
This also can be used to snap Window node into control node. (like detachable window)

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

WindowContainer will resize it's child window when it's size is changed, and when the viewport that contains the WindowContainer node changes it's size.

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

I think it will work similar to SubviewportContainer.

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

Multiple focuses is a very common approach when dealing with embedded UIs (such as inventory per character). Having multiple windows within main viewport is the only way to achieve this in godot currently.

This may be achieved with some lines of codes but I guess that depends on how complicated a node like SubviewportContainer is.

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

Implementing this node with stability may require changes within Window node.

@sockeye-d
Copy link

I think needing multiple focus targets points to maybe needing to make your own selection system? Especially for something like inventories, I don't think using the built-in focus system is ideal

@KoBeWi
Copy link
Member

KoBeWi commented Dec 29, 2024

Sounds like what you need is multi-focus and you suggested a workaround.

@Kakiroi
Copy link
Author

Kakiroi commented Dec 30, 2024

Multiple focus topic was included just to show the usage of WindowContainer. This proposal is for the better usability of Window node by allowing it to integrate into UI nodes. It maybe used for other usages like dockable window nodes.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 30, 2024

Dockable windows in the editor work by moving their content to a container. Embedding them as part of UI is not practical, as you can e.g. still move the window via some system shortcuts (e.g. Windows+Shift+Right).

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

No branches or pull requests

3 participants