UMG - Slate style texture swapping

Sorry if this has been asked, but can a Texture of Material Asset in a Slate Style be changed at run-time by a function in a blueprint widget?

I expected Set Texture to be exposed, as a component,but only Set Text seems be available

For instance, if I wanted to have a texture pulse while waiting for a button to be clicked
or swap from red when pressed to green until pressed again.

So the issue currently is that styles are assets, as they should be. But because of that we need to go to some lengths in the API to make it trivial to create dynamic versions of those assets at runtime so that you can do things like, make a standard button style, but override this one thing only when it’s Tuesday.

The style system is a hold-over from the raw slate days, and we wont likely be able to address it with a new more awesome system until post October.

That being said, there are some solutions you can currently use, and I should have time before 4.5 to make them improved, but not radically different.

  1. Having something pulse is easy, you just adjust the color on the button background that will multiply with the style texture.
  2. You can adjust a standalone image in the system pretty easily, the image widget has a fair number of functions you can call to set it dynamically from a material or texture, and ways to get a dynamic material instance to adjust material parameters at runtime.
  3. You could create two styles and swap them, the styles themselves also have color options you can set for different states.

For 4.5, what I’m going to try and do is get in a way for you to at least clone a style, maybe it get cloned on access, not sure yet. Anyway, you’d get the cloned style, then you’d have the freedom to access the material on it and replace it with a dynamic instance that lets you adjust the properties on it…etc.

For Far Future, the plan is to have some kind of appearance system. Where instead of it being just an asset like a style, it’s a blueprint, with logic. Then you could create a FlashyButtonAppearance class that extends from ButtonAppearance. Now any button can have this appearance, and it has the capability sniff all of slates and the buttons state in order to change how it appears.

Thoughts / Ideas?

Cheers,
Nick

Well, ideas… not many … keep up the good work!! I appreciate your reply. I had thought of unloading one button and loading another but decided that’s not very lite-weight. It’ll do in the meantime. I’ll try playing around with instance parameters too.

I think that a thing I’d like in UMG is to be able to put a widget’s Designer tab (and selected item properties) on one monitor and its widget Eventgraph on another monitor. Swapping back and forth can be disorienting.

I did not see any image functions to access the properties of the buttons I was making. Does that depend on if you are using a texture vs a material instance? I tried to load a material in a button style and it didn’t like that at all.

I still have lots of learning to do on this topic, so that’s about all I can say.

What I mean is there are several functions for dealing with Images (on the Image widget). The problem with buttons is that they are not just an image. There’s logic in the button to access different images on the style and images for Slate and UMG are not just images, they’re brushes, that have additional metadata like, whether or not they should use a 9-scale box when rendered. Lots of layers :smiley:

Though I want to get to what you’re looking for. I want to make it easy to just say, Button->SetMaterial, or SetTexture(), and just have the widget create the necessary style information based on a handful of data.

Make sure you’re not coding things you don’t have to though, unless you need to actively send the material information to render, you can create a button style and assign a different material for the pressed state brush vs. the normal brush. You can make a material that pulses pretty easily.

Cheers,
Nick