Navigation
API > API/Plugins > API/Plugins/ModelingComponents > API/Plugins/ModelingComponents/AssetUtils
References
| Module | ModelingComponents |
| Header | /Engine/Plugins/Runtime/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 or PF_FloatRGBA.
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
| Type | Name | Description | |
|---|---|---|---|
| ETextureType | BuildType | ||
| FColor * | CurrentMipData | ||
| FFloat16Color * | CurrentMipDataFloat16 | ||
| EPixelFormat | CurrentPixelFormat | ||
| FImageDimensions | Dimensions | ||
| UTexture2D * | RawTexture2D |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| UTexture2D * | BuildTextureFromImage
(
const TImageBuilder< PixelType >& SourceImage, |
Create a new UTexture2D of the given TextureType from the given SourceImage | |
| void | Cancel () |
Cancel active editing and unlock the texture data | |
| void | Clear
(
const FFloat16Color& ClearColor |
Clear all texels in the current Mip to the given ClearColor | |
| void | Clear all texels in the current Mip to the given ClearColor | ||
| void | Clear () |
Clear all texels in the current Mip to the clear/default color for the texture build type | |
| void | Commit
(
bool bUpdateSourceData |
Unlock the Mip 0 buffer and update the texture rendering data. | |
| bool | Copy
(
const TImageBuilder< FVector4f >& SourceImage, |
Populate texel values from floating-point SourceImage. | |
| bool | Copy
(
const TImageBuilder< FVector3f >& SourceImage, |
Populate texel values from floating-point SourceImage | |
| bool | CopyImageToSourceData
(
const TImageBuilder< FVector4f >& SourceImage, |
Populate Source Data texel values from a floating point SourceImage | |
| bool | CopyPlatformDataToSourceData
(
UTexture2D* Texture, |
Use a FTexture2DBuilder to copy the PlatformData to the UTexture2D Source data, so it can be saved as an Asset | |
| void | CopyTexel
(
int64 FromLinearIndex, |
Copy texel value from one linear index to another | |
| bool | CopyTo
(
TImageBuilder< FVector4f >& DestImage |
Copy existing texel values to floating-point DestImage. | |
| const FColor & | |||
| FFloat16Color | |||
| const FImageDimensions & | |||
| const void * | This point is invalid after the texture is Committed! | ||
| void * | This point is invalid after the texture is Committed! | ||
| const FColor & | Get the FColor texel at the given X/Y coordinates | ||
| const FColor & | GetTexel
(
int64 LinearIndex |
Get the FColor texel at the given linear index | |
| const FFloat16Color & | GetTexelFloat16
(
const FVector2i& ImageCoords |
Get the FFloat16Color texel at the given X/Y coordinates | |
| const FFloat16Color & | GetTexelFloat16
(
int64 LinearIndex |
Get the FFloat16Color texel at the given linear index | |
| UTexture2D * | GetTexture2D () |
||
| const EPixelFormat | |||
| const ETextureType | |||
| bool | Initialize
(
ETextureType BuildTypeIn, |
Create a new UTexture2D configured with the given BuildType and Dimensions | |
| bool | Initialize
(
UTexture2D* ExistingTexture, |
Initialize the builder with an existing UTexture2D | |
| bool | InitializeAndReplaceExistingTexture
(
UTexture2D* ExistingTexture, |
Create a new UTexture2D 'over' an existing UTexture2D, with the given BuildType and Dimensions | |
| bool | InitializeAndReplaceExistingTexture
(
UTexture2D* ExistingTexture, |
Create a new UTexture2D 'over' an existing UTexture2D using the same texture settings as a given source UTexture2D. | |
| const bool | |||
| bool | IsEditable () |
||
| const bool | |||
| bool | Lock the Mip 0 buffer for editing | ||
| void | Set the texel at the given linear index to the given FColor | ||
| void | SetTexel
(
int64 LinearIndex, |
Set the texel at the given linear index to the given FFloat16Color | |
| void | SetTexel
(
const FVector2i& ImageCoords, |
Set the texel at the given X/Y coordinates to the given FFloat16Color | |
| void | Set the texel at the given X/Y coordinates to the given FColor | ||
| void | Copy the current PlatformData to the UTexture2D Source Data. |
Enums
| Type | Name | Description | |
|---|---|---|---|
| ETextureType | Supported texture types. |