Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.39 KB

Thumbnail_API.md

File metadata and controls

51 lines (34 loc) · 1.39 KB

The Thumbnail API

The UE4 python api exposes two main functions to access thumbnails:

thumbnail = uobject.get_thumbnail([force_create])

This function tries to get the thumbnail of an object from the cache, or (if not found in the cache) from the package file.

The boolean argument, if True, forces the function to generate a new thumbnail (with the default size) if not available in the asset/package

The returned object is of type FObjectThumbail (see below)

thumbnail = uobject.render_thumbnail([width, height, no_flush])

This function generates a new FObjectThumbail from an object. By default texture streaming is flushed after the creation of the thumbnail. By specyfing 'no_flush' the streaming will not be flushed.

The FObjectThumbnail object

This class represents a thumbnail

The following methods are available:

width = thumbnail.get_image_width()
height = thumbnail.get_image_height()
# caould return zero if the thumbnail is not compressed
size = thumbnail.get_compressed_data_size()
# returns BGRA bytearray of pixels
data = thumbnail.get_uncompressed_image_data()
# if this is a newly created thumbnail, force compression
thumbnail.compress_image_data()

For a handy example about the thumbnail api check https://github.com/20tab/UnrealEnginePython/blob/master/examples/thumbnail_viewer.py