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"

Turn FSlateShaderResource into Texture/PNG?

Hi,

I'd like to create a plugin that takes given assets from content browser and saves their thumbnails as .png files. I was able to create a copy of thumbnails in my own editor window using MakeThumbnailWidget() function in FAssetThumbnail class, however I cannot figure out how (or if its even possible) to save its texture into file. I obviously need an array of pixels/colors and I know that I could get them from viewport that displays thumbnails but there is no access to it from FAssetThumbnail.

There is GetViewportRenderTargetTexture() which returns FSlateShaderResource but I'm not sure how/if I can get raw pixels/data from it.

I also digged around and noticed that if had my custom thumbnail renderer maybe I could capture raw data somewhere during the draw process. Although, it seems that thumbnails renderers are connected with a given class so I'm not sure if its a good idea.

Long story short: How can I save any asset thumbnail as png file?

Any tips appreciated,

Thanks

Edit:

I've got it working! Plugin will be ready soon ; )

Product Version: Not Selected
Tags:
more ▼

asked Feb 05 '15 at 02:18 PM in C++ Programming

avatar image

szyszek
590 15 10 36

avatar image TonyTonyChen Jul 14 '16 at 06:04 AM

I have the same problem too.

avatar image TonyTonyChen Jul 14 '16 at 09:02 AM

Hello szyszek, I also do the same task as you. Notice that you have resolved this problem (I've got it working! Plugin will be ready soon ; )). Could you tell me how to do? I write the following code:

TSharedPtr< SWidget > pSwidget = AssetThumbnail->MakeThumbnailWidget();

pSwidget->Invalidate(EInvalidateWidget::Layout);

FSlateTexture2DRHIRef * Texture = InThumbnailPool->AccessTexture(theAsset, Width, Height);

const TSharedPtr TextureData = Texture->GetTextureData();

But the TextureData always is NULL.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

use RenderThumbnail function can get the thumbnail of some assets (e.g. mesh asset).

more ▼

answered Jul 14 '16 at 06:09 AM

avatar image

TonyTonyChen
6 1 2 2

(comments are locked)
10|2000 characters needed characters left
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