-
-
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
Re-implement rendering/2d/options/ninepatch_mode
or an equivalent in 4.x
#10932
Comments
rendering/2d/options/ninepatch_mode
in 4.xrendering/2d/options/ninepatch_mode
or an equivalent in 4.x
This should be an definitely be an option on the StyleBoxTexture. IMO how it renders overlapping sections needs to be fixed, that is clearly wrong. I think it could have more utility with these options:
|
If this is only needed to emulate squircle corners (due to not being viable with textures that have borders), it might be worth implementing a squircle corner radius mode in StyleBoxFlat instead. This would allow for vector-based rendering as well, which would look good at any resolution and allow for more real-time customization. |
Hmm, maybe overhauling the StyleBoxFlat corner system to allow for the use of a Curve resource to drive the corner profiles would be better then? That seems like a different topic though, it would still not replace the StyleBoxTexture |
Well, I am using this to render squircles but nine-patch textures can emulate all kinds of shapes, really. ^^ My issue isn't really "I'd like a better way to render squircles" but "I'd like nine-patch textures to be more flexible again, like they used to be in 3.x" |
Describe the project you are working on
A game that uses nine-slice panels to render UI elements with shapes other than rectangles and rounded rectangles.
Describe the problem or limitation you are having in your project
In Godot 4.3, I'm using a
StyleBoxTexture
to render some UI elements, like panels, using nine-slice textures in order to create elements with a squircle-like shape that cannot be recreated with a default stylebox.However, if the resulting element is made to be too small to fit the entire texture, the appearance of the element will break:
If I want to be able to use this specific shape on elements of different sizes (like buttons), I'd need to create multiple variants of my texture at different scales, and create matching
StyleBoxTexture
s, which is cumbersome.Describe the feature / enhancement and how it helps to overcome the problem or limitation
In Godot 3.6, it's possible to set the
rendering/2d/options/ninepatch_mode
property toscaled
, which allows the nine-slice texture to be rescaled based on the size of the element in such a way that the corners retain their aspect ratios, and the filling sections still behave as normal.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The proposal would involve reintroducing this feature into Godot 4.x, either by making it a project wide setting, or by making it a per-stylebox setting.
Having such an option has been discussed in a previous proposal but was ultimately not added. I believe allowing the nine-slice texture to be rescaled would be really useful to better support UI designs that use custom shapes, as only one texture and one stylebox would be necessary to support a wide array of elements of different sizes.
While it is not appropriate for some art styles (for example pixel art games, or textures that integrate a border due to the loss of uniformity), making it an option would allow the end user to decide whether they would benefit from this change in behavior.
If this enhancement will not be used often, can it be worked around with a few lines of script?
The only alternative I can think of is maintaining multiple styleboxes, which is not convenient.
Is there a reason why this should be core and not an add-on in the asset library?
This proposal is about solving a regression from 3.x to 4.x
The text was updated successfully, but these errors were encountered: