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"

Get widget size in shader editor?

I have a procedural round box that I want to use for the texture on the widget. The widget will be able to scramble and I want the shader to adjust to the size of the widget. How do I get the size of the widget through the editor shader?

alt text

Product Version: UE 4.22
Tags:
juwuh9tala.png (785.2 kB)
more ▼

asked Jun 02 '19 at 04:35 PM in Using UE4

avatar image

Darcvizer
3 1 2

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

2 answers: sort voted first

Hm, you can't get it (afaik) but you can pipe the data in through a parameter. You'd need to create a Dynamic Material Instance with a parameter and update the material when the widget changes size. You may need to call Force Layout Prepass just after updating widget size but before getting Desired Size to ensure you're not fetching stale data.


I'm assuming you need more from this than just a border that autoscales as there's a much better solution to this that fiddling with a material. Leaving a link just in case - Setting Image States:

https://docs.unrealengine.com/en-US/Engine/UMG/UserGuide/Styling/index.html

more ▼

answered Jun 02 '19 at 05:47 PM

avatar image

Everynone
15.2k 77 25 62

avatar image Darcvizer Jun 02 '19 at 06:32 PM

The fact is that I will have a huge number of widgets(1000+) and there will not be 3D graphics. I wanted to minimize the number of components in the widget that would unload the CPU.

avatar image Everynone Jun 02 '19 at 06:48 PM

In this case 9-slice would about 1000 x performant than a widget with a material... (eyeballing it!)

You do not need to add any new components, it's just a clever way to stretch a plain image.

avatar image Everynone Jun 02 '19 at 07:49 PM

I'll just add a tip, perhaps it will save you some time. If you decide to use the styles, design the smallest border you need and use that. Otherwise scaling down may compromise quality.

If the smallest you'll ever get is 32x16, for example - design a 16x16 border. Also, the margins are percentages. So margin of .1 means 10% of the actual size - so for a 32x32 border, the margin of 10% would be 3 pixels.

Good luck with the rest.

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

Hi I think what yu try to achieve can be done with the box/border style setting of an image. documentation

more ▼

answered Jun 02 '19 at 06:54 PM

avatar image

lkav
1.4k 9 5 10

(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