Lemur replace material and add some styledefaults


i would like to ask if there is a preferred way of replacing the base material that is being used for the gui elements?
Additionally i would like to add some styling properties on the already existing elements that are then forwarded to the material?

I would prefer to not fork lemur and make the changes there.

I believe the first part is relatively easy. 99% sure that everything calls GuiGlobals createMaterial(). So when initializing GUI globals, you could instead pass a subclass that creates your own material.

The second part is harder because there are no setters/getters for your new properties and no StyleAttribute annotations.

…but now I wonder what exactly you are trying to do because maybe there is an easier way.

None of the GUI elements actually draw anything and thus rely on component stacks… and if styling the ‘new materials’ is what you are really after then you may only have to mess with some component subclasses. I’d need to know the situation to better advise.

1 Like

My Material allows to set BackgroundColor, BackgroundHighlight, BorderColor and BorderHighlightColor as well as some modifiers.

The shader mixes the final color depending on the channels of the background image.

The most optimal solution would be that i can can set my color values in the same way inside the groovy stylesheet like i do with the default components.

So this is for fonts? Or?

No this would be for the backgroud of regular components. The highlight color is basically a slight animation in the shader

When you style a GUI element, you can specify the background, border, etc. layers.

So if you are using QuadBackground component for these then one option is to extend QuadBackgroundComponent or whatever to have your material options and then just set the right background component in styling… or the right properties on your cloned background component.

To me, it doesn’t seem to be so different betwee:

selector(...) {
    myCustomProperty = "foo"


selector(...) {
   background.myCustomProperty = "foo"

…assuming background is a clone of a base CustomBackground or whatever:

def myCustomBackground = ...
selector( ....) {
    background = myCustomBackground.clone();
    background.myCustomProperty = "foo"
1 Like


I have missed the QuadBackgroundComponent/TbtQuadBackgroundComponent. I was browsing trough the TbtQuad, GuiControl, and the actual Components and have missed the “glue it together” stuff. Yeah. i think with extending TbtQuadBackgroundComponent i am able to achieve what i try to do

This may be review but I wanted to highlight something in case it’s helpful:

The ComponentStack class is the glue that puts all of that together.

GuiControl has a ComponentStack that enforces the layering on that wiki page.