FTexture2DBuilder

Texture2DBuilder is a utility class for creating/modifying various types of [UTexture2D](API\Runtime\Engine\Engine\UTexture2D).

Windows
MacOS
Linux

References

Module

ModelingComponents

Header

/Engine/Plugins/Experimental/MeshModelingToolset/Source/ModelingComponents/Public/AssetUtils/Texture2DBuilder.h

Include

#include "AssetUtils/Texture2DBuilder.h"

Syntax

class FTexture2DBuilder

Remarks

Texture2DBuilder is a utility class for creating/modifying various types of UTexture2D. Use Initialize() functions to configure, can either generate a new UTexture2D (in the Transient package) or modify an existing UTexture2D.

Currently the generated UTexture2D will only have Mip 0, and only Mip 0 can be edited. The generated UTexture2D has format PF_B8G8R8A8.

Use Commit() to lock and update the texture after editing is complete. LockForEditing() can be used to re-open. By default textures are locked for editing on Initialize()

If you have generated a UTexture2D by other means, you can use the static function ::CopyPlatformDataToSourceData() to populate the Source data from the PlatformData, which is required to save it as a UAsset.

Variables

Name Description

Protected variable

ETextureType

 

BuildType

Protected variable

FColor *

 

CurrentMipData

Protected variable

FImageDimension...

 

Dimensions

Protected variable

UTexture2D *...

 

RawTexture2D

Destructors

Name Description

Public function Virtual

~FTexture2DBuilder()

Functions

Name Description

Public function

void

 

Cancel()

Public function

void

 

Clear

(
    const FColor& ClearColor
)

Clear all texels in the current Mip to the given ClearColor

Public function

void

 

Clear()

Clear all texels in the current Mip to the clear/default color for the texture build type

Public function

void

 

ClearTexel

(
    int64 LinearIndex
)

Set the texel at the given linear index to the clear/default color

Public function

void

 

Commit

(
    bool bUpdateSourceData
)

Unlock the Mip 0 buffer and update the texture rendering data.

Public function

bool

 

Copy

(
    const TImageBuilder< FVector4f >& ...,
    const bool bSRGB
)

Populate texel values from floating-point SourceImage

Public function

bool

 

Copy

(
    const TImageBuilder< FVector3f >& ...,
    const bool bSRGB
)

Populate texel values from floating-point SourceImage

Public function Static

bool

 

CopyPlatformDataToSourceData

(
    UTexture2D* Texture,
    ETextureType TextureType
)

Use a FTexture2DBuilder to copy the PlatformData to the UTexture2D Source data, so it can be saved as an Asset

Public function

void

 

CopyTexel

(
    int64 FromLinearIndex,
    int64 ToLinearIndex
)

Copy texel value from one linear index to another

Public function Const

bool

 

CopyTo

(
    TImageBuilder< FVector4f >& DestIm...
)

Copy existing texel values to floating-point DestImage

Public function Const

const FColor...

 

GetClearColor()

Public function Const

const FImage...

 

GetDimensions()

Public function

FColor *

 

GetRawTexelBufferUnsafe()

This point is invalid after the texture is Committed!

Public function Const

const FColor...

 

GetRawTexelBufferUnsafe()

This point is invalid after the texture is Committed!

Public function Const

const FColor...

 

GetTexel

(
    int64 LinearIndex
)

Get the texel at the given linear index

Public function Const

const FColor...

 

GetTexel

(
    const FVector2i& ImageCoords
)

Get the texel at the given X/Y coordinates

Public function Const

UTexture2D &...

 

GetTexture2D()

Public function Const

const ETextu...

 

GetTextureType()

Public function

bool

 

Initialize

(
    UTexture2D* ExistingTexture,
    ETextureType BuildTypeIn,
    bool bLockForEditing
)

Initialize the builder with an existing UTexture2D

Public function

bool

 

Initialize

(
    ETextureType BuildTypeIn,
    FImageDimensions DimensionsIn
)

Create a new UTexture2D configured with the given BuildType and Dimensions

Public function Const

bool

 

IsEditable()

Public function

bool

 

LockForEditing()

Lock the Mip 0 buffer for editing

Public function

void

 

SetTexel

(
    const FVector2i& ImageCoords,
    const FColor& NewValue
)

Set the texel at the given X/Y coordinates to the given FColor

Public function

void

 

SetTexel

(
    int64 LinearIndex,
    const FColor& NewValue
)

Set the texel at the given linear index to the given FColor

Public function

void

 

UpdateSourceData()

Copy the current PlatformData to the UTexture2D Source Data.

Enums

Name

Description

Public enum

ETextureType

Supported texture types

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss