Bootstrap Chameleon Logo

PythonTextureLib

Function Name Description
create_texture2d_from_raw Create a Texture2D from pixel RawData
create_texture2d Create a Texture2D with specified size
finish_compilation_texture Blocks until completion of the requested textures
set_render_target_data Set the RenderTexture2D By Raw Data.
get_render_target_raw_data Get the Raw Data from RenderTarget2D
get_texture2d_content Get the Raw Data from Texture2D

create_texture2d_from_raw

Create a Texture2D from pixel RawData

unreal.PythonTextureLib.create_texture2d_from_raw(raw_data, width, height, channel_num, use_srgb=False, texture_filter_value=-1, bgr=False, flip_y=False) -> Texture2D
    Create a Texture2D from pixel RawData
    note: The Texture2D type is EPixelFormat::PF_R8G8B8A8
    note: added in v1.0.7

    Args:
        raw_data (Array[uint8]): The flatten uint8 raw data of image, len(RawData) == RawDataWidth * RawDataHeight * RawDataChannelNum
        width (int32): The width of the Texture2D
        height (int32): The Height of the Texture2D
        channel_num (int32): The Number of RawData's Channel. 1: grayscale; 2: grayscale with alpha; 3: rgb; 4 rgb with alpha
        use_srgb (bool): Use SRGB or no0t
        texture_filter_value (int32): The filter of texture: 0: Nearest, 1: Bilinear, 2: Trilinear, 3: Use setting from the Texture Group.
        bgr (bool): Is the order of RawData is Blue, Green, Red, otherwise RGB
        flip_y (bool):

    Returns:
        Texture2D: The created Texture2D

create_texture2d

Create a Texture2D with specified size

unreal.PythonTextureLib.create_texture2d(width, height, use_srgb=False, texture_filter_value=-1) -> Texture2D
    Create a Texture2D with specified size
    note: The Texture2D type is EPixelFormat::PF_B8G8R8A8
    note: added in v1.2.0

    Args:
        width (int32): The width of the Texture2D
        height (int32): The Height of the Texture2D
        use_srgb (bool): Use SRGB or not
        texture_filter_value (int32): The filter of texture: 0: Nearest, 1: Bilinear, 2: Trilinear, 3: Use setting from the Texture Group.

    Returns:
        Texture2D: The created Texture2D

finish_compilation_texture

Blocks until completion of the requested textures

unreal.PythonTextureLib.finish_compilation_texture(texture) -> Texture2D
    Blocks until completion of the requested textures
    note: added in v1.2.0
    note: need UE5

    Args:
        texture (Texture2D):

    Returns:
        Texture2D: Texture2D

set_render_target_data

Set the RenderTexture2D By Raw Data.

unreal.PythonTextureLib.set_render_target_data(render_target_texture, raw_data, raw_data_width, raw_data_height, raw_data_channel_num, use_srgb=False, texture_filter_value=-1, bgr=False) -> None
    Set the RenderTexture2D By Raw Data.
    note: The order of RawData is row first. Lower left corner is the first pixel, and upper right is the last
    note: added in v1.0.7

    Args:
        render_target_texture (TextureRenderTarget2D): The target RenderTarget2D
        raw_data (Array[uint8]): The flatten uint8 raw data of image, len(RawData) == RawDataWidth * RawDataHeight * RawDataChannelNum
        raw_data_width (int32): The width of the RawData, we can fill the rt with smaller RawData
        raw_data_height (int32): The Height of the RawData
        raw_data_channel_num (int32): The Number of RawData's Channel. 1: grayscale; 2: grayscale with alpha; 3: rgb; 4 rgb with alpha
        use_srgb (bool): Use SRGB or not
        texture_filter_value (int32): The filter of texture: 0: Nearest, 1: Bilinear, 2: Trilinear, Use setting from the Texture Group.
        bgr (bool): Is the order of RawData is Blue, Green, Red, otherwise RGB

get_render_target_raw_data

Get the Raw Data from RenderTarget2D

unreal.PythonTextureLib.get_render_target_raw_data(render_target_texture) -> Array[uint8]
    Get the Raw Data from RenderTarget2D
    note: added in v1.0.7

    Args:
        render_target_texture (TextureRenderTarget2D): The source RenderTarget2D

    Returns:
        Array[uint8]:

        out_raw_data (Array[uint8]):

get_texture2d_content

Get the Raw Data from Texture2D

unreal.PythonTextureLib.get_texture2d_content(texture, mip_level) -> Array[uint8] or None
    Get the Raw Data from Texture2D
    note: added in v1.2.1

    Args:
        texture (Texture2D): The source Texture2D
        mip_level (int32): The mip level of the Texture2D

    Returns:
        Array[uint8] or None: The raw data of the Texture2D, pixel order is BGRA

        dst_data (Array[uint8]):

Other Editor Python Libs: