Open hunterloftis opened 6 months ago
See also:
LabelSettings could be moved to Font and then Font Color could just be Font. That would include font, font size, outline size, shadow offset, font color, outline color, and shadow color.
Also I would suggest having Button Style be a Control Style since we may want normal, hovered, focused, pressed, and disabled states for other controls
Describe the project you are working on
A 2D game with a typical number of menus & buttons, that needs to be styled in a way that works for both controller players and keyboard+mouse players.
Describe the problem or limitation you are having in your project
Godot's styling system, especially for controls with multiple state combinations like Buttons, is both overwrought and under-powered. This has been discussed elsewhere, including:
The limitation of focus as only an overlay is especially problematic, as it makes many common patterns impossible to implement with native buttons. This is especially the case for games with both mouse and controller input, where you often want similar behavior between focus (controlled by controller d-pad) and hover (controlled by mouse). The main menus of many commercial games would not be implementable in Godot without a custom button system.
Additionally, due to the combinatoric way that Godot currently implements themes (
hover_pressed_mirrored
), the floor of work for theming a Godot game is quite high. Many styles get repeatedly copy, pasted, tweaked, then copy, pasted again.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Instead, Godot should consider cascading control styles, in user-definable order, with a state mask. This has several advantages:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Here's a rough example of how a cascade of styles with state masks would work:
When Godot renders this button, it selects the first style in the array whose mask matches its current state. The mask is a bitwise AND. So with this button, for instance:
These states are intuitive and easy to understand by running through the list top-to-bottom. This example ordering is reasonable for my use-case, but another game might prefer for hovered and focused buttons to have different styles, or for just-hovered and just-focused to be different from hovered-and-focused, and all of that would be straightforward to add.
If Godot were willing/able to completely rethink theming from the ground up, there is likely a better approach. However, with the goal of pragmatism, this change maintains the existing primitives & states while providing a simpler & more powerful way for users to apply them.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
Doing this as an add-on would require completely replacing Godot's built-in controls & themes with custom versions, and would remove the Godot-made-with-Godot dogfooding of Godot's own UI.