x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
Tags:
more ▼

asked Aug 20 '14 at 07:05 AM in Blueprint Scripting

avatar image

tomofnz
1.2k 46 47 88

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Aug 21 '14 at 12:27 AM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 37 151

avatar image tomofnz Aug 21 '14 at 03:22 AM

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.

avatar image Nick Darnell ♦♦ STAFF Aug 21 '14 at 11:57 AM

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 :D

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question