Allow shaders to be applied to UI boxes#1062
Open
InvalidOS wants to merge 8 commits intoSteamodded:mainfrom
Open
Allow shaders to be applied to UI boxes#1062InvalidOS wants to merge 8 commits intoSteamodded:mainfrom
InvalidOS wants to merge 8 commits intoSteamodded:mainfrom
Conversation
stupxd
reviewed
Nov 2, 2025
lovely/ui_elements.toml
Outdated
| return | ||
| elseif send then | ||
| for _, v in ipairs(send) do | ||
| local val = v.val or (v.func and v.func(self)) |
Collaborator
There was a problem hiding this comment.
v.ref_table[v.ref_value] would be nice to have for consistency
Contributor
Author
There was a problem hiding this comment.
will do, this pr needs a lot more work anyways
Contributor
Author
There was a problem hiding this comment.
added, but still needs some additional debugging done
Contributor
Author
|
I attempted to get a different branch working using CanvasSprite but that ended up being too difficult for me to get working |
Contributor
Author
|
converting this to a draft again to add some changes by @lord-ruby |
Contributor
Author
|
didn't say this earlier but this should be ready to be merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a lovely patch that allows for shaders to be applied any UI element that is drawn using
UIElement:draw_pixellated_rect().In order to apply a shader to a UI element, you must add a new config parameter,
shader, to the UI node you want to apply a shader to. This may be structured in a few ways:shader = "shader_key", which will simply use the shaderSMODS.Shaders["shader_key"]with default arguments being sent.shader = { shader = "shader_key", send = tbl}, which usesSMODS.Shaders["shader_key"], while sending arguments defined bytbl(this works the same way as the_sendargument inSprite:draw_shader())Sprite:define_draw_steps()functions. Using the string"none"or"dissolve"as the shader key will instead result in no shader being used, which is useful for layered effects.UI element shaders, by default, use a different parameter set than the typical sprite shaders, so they must be custom-made to work with this. The only arguments shared between them are
screen_scale,time(which uses a placeholder value), and the one using the shader's key. UI element shaders additionally send both the position and size of the UI element asuibox_posanduibox_size, respectively.To see an example of this in action, Entropy currently has an implementation of UI element shaders I made earlier (which I modified to create this PR), used to apply a shader to its mod badge. Arrow API also has a separate implementation to apply the Polychrome shader to UI elements.
I may come back to this to add support for text nodes and DynaText objects, but I'm already very happy with this.
Additional Info: