UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FDynamicMeshToMeshDescription Class Reference

#include <DynamicMeshToMeshDescription.h>

Public Member Functions

void MESHCONVERSION_API SetMaterialIDMapFromInverseMap (TArrayView< const int32 > PolygroupIDToMaterialIDMap)
 
 FDynamicMeshToMeshDescription ()
 
 FDynamicMeshToMeshDescription (FConversionToMeshDescriptionOptions ConversionOptions)
 
MESHCONVERSION_API bool HaveMatchingElementCounts (const FDynamicMesh3 *DynamicMesh, const FMeshDescription *MeshDescription)
 
MESHCONVERSION_API void Convert (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, bool bCopyTangents=false)
 
MESHCONVERSION_API void UpdateUsingConversionOptions (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut)
 
MESHCONVERSION_API void Update (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, bool bUpdateNormals=true, bool bUpdateTangents=false, bool bUpdateUVs=false)
 
MESHCONVERSION_API void UpdateAttributes (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, bool bUpdateNormals, bool bUpdateTangents, bool bUpdateUVs)
 
MESHCONVERSION_API void UpdateTangents (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, const UE::Geometry::TMeshTangents< double > *SrcTangents)
 
MESHCONVERSION_API void UpdateTangents (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut)
 
MESHCONVERSION_API void UpdateVertexColors (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut)
 
MESHCONVERSION_API void Convert_NoAttributes (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut)
 
MESHCONVERSION_API void Convert_SharedInstances (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut)
 
MESHCONVERSION_API void Convert_NoSharedInstances (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, bool bCopyTangents)
 

Static Public Member Functions

static MESHCONVERSION_API bool HaveMatchingElementCounts (const FDynamicMesh3 *DynamicMesh, const FMeshDescription *MeshDescription, bool bVerticesOnly, bool bAttributesOnly)
 

Public Attributes

bool bPrintDebugMessages = false
 
FConversionToMeshDescriptionOptions ConversionOptions
 

Protected Member Functions

MESHCONVERSION_API void ConvertPolygroupLayers (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, const TArray< FTriangleID > &IndexToTriangleIDMap)
 
MESHCONVERSION_API void ConvertWeightLayers (const FDynamicMesh3 *MeshIn, FMeshDescription &MeshOut, const TArray< FVertexID > &IndexToVertexIDMap)
 
MESHCONVERSION_API void ApplyVertexColorTransform (FVector4f &Color) const
 

Detailed Description

Convert FDynamicMesh3 to FMeshDescription

Constructor & Destructor Documentation

◆ FDynamicMeshToMeshDescription() [1/2]

FDynamicMeshToMeshDescription::FDynamicMeshToMeshDescription ( )
inline

◆ FDynamicMeshToMeshDescription() [2/2]

FDynamicMeshToMeshDescription::FDynamicMeshToMeshDescription ( FConversionToMeshDescriptionOptions  ConversionOptions)
inline

Member Function Documentation

◆ ApplyVertexColorTransform()

void FDynamicMeshToMeshDescription::ApplyVertexColorTransform ( FVector4f Color) const
protected

Applies an optional sRGB-to-Linear color transform on the input. The color transform is controlled by ConversionOptions.bTransformVtxColorsSRGBToLinear.

The counterpart to this method is MeshDescriptionToDynamicMesh::ApplyVertexColorTransform which will undo this color transformation when the MeshDescription is read back.

Parameters
Colorcolor to transform

◆ Convert()

void FDynamicMeshToMeshDescription::Convert ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
bool  bCopyTangents = false 
)

Default conversion of DynamicMesh to MeshDescription. Calls functions below depending on mesh state

Parameters
bCopyTangents- should tangent, bitangent overlays exist on the MeshIn, this will use them when producing the MeshDescription MeshOut

Note: Don't copy tangents if the resulting MeshDescription corresponds to a StaticMesh with autogenerated tangents in this case the MeshDescription is expected to have empty tangents.

◆ Convert_NoAttributes()

void FDynamicMeshToMeshDescription::Convert_NoAttributes ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut 
)

Ignore any Attributes on input Mesh, calculate per-vertex normals and have MeshDescription compute tangents. One VertexInstance per input vertex is generated

◆ Convert_NoSharedInstances()

void FDynamicMeshToMeshDescription::Convert_NoSharedInstances ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
bool  bCopyTangents 
)

Convert with no shared VertexInstances. A new VertexInstance is created for each triangle vertex (ie corner). However vertex positions are shared and the shared UVs structures are populated.

Parameters
bCopyTangents- should tangent, bitangent overlays exist on the MeshIn, this will use them when producing the MeshDescription MeshOut

Note: Don't copy tangents if the resulting MeshDescription corresponds to a StaticMesh with autogenerated tangents in this case the MeshDescription is expected to have empty tangents.

◆ Convert_SharedInstances()

void FDynamicMeshToMeshDescription::Convert_SharedInstances ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut 
)

Convert while minimizing VertexInstance count, IE new VertexInstances are only created if a unique UV or Normal is required.

Note: This doesn't copy any tangents from the FDynamicMesh Note: This conversion is not currently being used. It is unclear if all consumers of FMeshDescription can handle such shared vertex instances

◆ ConvertPolygroupLayers()

void FDynamicMeshToMeshDescription::ConvertPolygroupLayers ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
const TArray< FTriangleID > &  IndexToTriangleIDMap 
)
protected

Transfer PolygroupLayers from DynamicMesh AttributeSet to MeshDescription. Will copy to existing MeshDescription TriangleAttribute<int32> if one with the same name exists. Otherwise will register a new one.

◆ ConvertWeightLayers()

void FDynamicMeshToMeshDescription::ConvertWeightLayers ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
const TArray< FVertexID > &  IndexToVertexIDMap 
)
protected

Transfer WeightLayers from DynamicMesh AttributeSet to MeshDescription. Will copy to existing MeshDescription VertexAttribute<float> if one with the same name exists. Otherwise will register a new one.

◆ HaveMatchingElementCounts() [1/2]

bool FDynamicMeshToMeshDescription::HaveMatchingElementCounts ( const FDynamicMesh3 DynamicMesh,
const FMeshDescription MeshDescription 
)

Checks if element counts match. If false then Update can't be called – you must call Convert Result is based on the current ConversionOptions (e.g. if you are only updating vertices, mismatched triangles are ok)

Parameters
DynamicMeshThe dynamic mesh with updated vertices or attributes
MeshDescriptionThe corresponding mesh description

◆ HaveMatchingElementCounts() [2/2]

bool FDynamicMeshToMeshDescription::HaveMatchingElementCounts ( const FDynamicMesh3 DynamicMesh,
const FMeshDescription MeshDescription,
bool  bVerticesOnly,
bool  bAttributesOnly 
)
static

Checks if element counts match. If false then Update can't be called – you must call Convert

Parameters
DynamicMeshThe dynamic mesh with updated vertices or attributes
MeshDescriptionThe corresponding mesh description
bVerticesOnlyIf true, only check vertex counts match
bAttributesOnlyIf true, only check what needs to be checked for UpdateAttributes (will check vertices or triangles depending on whether attributes are per vertex or in overlays)

◆ SetMaterialIDMapFromInverseMap()

void FDynamicMeshToMeshDescription::SetMaterialIDMapFromInverseMap ( TArrayView< const int32 PolygroupIDToMaterialIDMap)

◆ Update()

void FDynamicMeshToMeshDescription::Update ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
bool  bUpdateNormals = true,
bool  bUpdateTangents = false,
bool  bUpdateUVs = false 
)

Update existing MeshDescription based on DynamicMesh. Assumes mesh topology has not changed. Copies positions optionally, normals, tangents and UVs

◆ UpdateAttributes()

void FDynamicMeshToMeshDescription::UpdateAttributes ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
bool  bUpdateNormals,
bool  bUpdateTangents,
bool  bUpdateUVs 
)

Update only attributes, assuming the mesh topology has not changed. Does not touch positions. NOTE: assumes the order of triangles in the MeshIn correspond to the ordering you'd get by iterating over triangles, on MeshOut This matches conversion currently used in MeshDescriptionToDynamicMesh.cpp, but if that changes we will need to change this function to match!

Parameters
bUpdateNormalsSpecifies if the normals should be transfered from the MeshIn PrimaryNormal overlay if it exists
bUpdateTangentsSpecifies if the tangent and bitangent sign should be populated from the MeshIn PrimaryTangents and PrimaryBiTangents. this requires the PrimaryNormals to exist as well.
bUpdateUVsSpecifices if the UV layers should be transfered from the MeshIn overlays.

◆ UpdateTangents() [1/2]

void FDynamicMeshToMeshDescription::UpdateTangents ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut 
)

Use the MeshIn Overlays to update the Tangent and BinormalSign attributes of the MeshDescription, assuming mesh topology has not changed. Does not modify any other attributes. NOTE: assumes the order of triangles in the MeshIn correspond to the ordering you'd get by iterating over triangles, on MeshOut This matches conversion currently used in MeshDescriptionToDynamicMesh.cpp, but if that changes we will need to change this function to match!

◆ UpdateTangents() [2/2]

void FDynamicMeshToMeshDescription::UpdateTangents ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut,
const UE::Geometry::TMeshTangents< double > *  SrcTangents 
)

Use the TMeshTangents to update the Tangent and BinormalSign attributes of the MeshDescription, assuming mesh topology has not changed. Does not modify any other attributes. NOTE: this ignores any tangent or bitangent overlays on the MeshIn, and instead uses the tangent and bitangent information stored in the TMeshTangents NOTE: assumes the order of triangles in the MeshIn correspond to the ordering you'd get by iterating over triangles, on MeshOut This matches conversion currently used in MeshDescriptionToDynamicMesh.cpp, but if that changes we will need to change this function to match!

◆ UpdateUsingConversionOptions()

void FDynamicMeshToMeshDescription::UpdateUsingConversionOptions ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut 
)

Updates the given mesh description based conversion options provided in the constructor. Assumes the mesh topology has not changed. Annoyingly, this can't just be named Update() due to ambiguity with the function below, which existed beforehand and should probably have been this function instead.

◆ UpdateVertexColors()

void FDynamicMeshToMeshDescription::UpdateVertexColors ( const FDynamicMesh3 MeshIn,
FMeshDescription MeshOut 
)

Update only vertex colors, assuming the mesh topology has not changed. Does not touch positions or other attributes. NOTE: assumes the order of triangles in the MeshIn correspond to the ordering you'd get by iterating over triangles, on MeshOut This matches conversion currently used in MeshDescriptionToDynamicMesh.cpp, but if that changes we will need to change this function to match!

Member Data Documentation

◆ bPrintDebugMessages

bool FDynamicMeshToMeshDescription::bPrintDebugMessages = false

If true, will print some possibly-helpful debugging spew to output log

◆ ConversionOptions

FConversionToMeshDescriptionOptions FDynamicMeshToMeshDescription::ConversionOptions

General settings for conversions to mesh description


The documentation for this class was generated from the following files: