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

#include <SkeletalMeshOperations.h>

+ Inheritance diagram for FSkeletalMeshOperations:

Classes

struct  FSkeletalMeshAppendSettings
 

Static Public Member Functions

static SKELETALMESHDESCRIPTION_API void AppendSkinWeight (const FMeshDescription &SourceMesh, FMeshDescription &TargetMesh, FSkeletalMeshAppendSettings &AppendSettings)
 
static SKELETALMESHDESCRIPTION_API bool CopySkinWeightAttributeFromMesh (const FMeshDescription &InSourceMesh, FMeshDescription &InTargetMesh, const FName InSourceProfile, const FName InTargetProfile, const TMap< int32, int32 > *SourceBoneIndexToTargetBoneIndexMap)
 
static SKELETALMESHDESCRIPTION_API bool RemapBoneIndicesOnSkinWeightAttribute (FMeshDescription &InMesh, TConstArrayView< int32 > InBoneIndexMapping)
 
static SKELETALMESHDESCRIPTION_API bool GetPosedMesh (const FMeshDescription &InSourceMesh, FMeshDescription &OutTargetMesh, TConstArrayView< FTransform > InComponentSpaceTransforms, const FName InSkinWeightProfile=NAME_None, const TMap< FName, float > &InMorphTargetWeights={})
 
static SKELETALMESHDESCRIPTION_API bool GetPosedMesh (const FMeshDescription &InSourceMesh, FMeshDescription &OutTargetMesh, const TMap< FName, FTransform > &InBoneSpaceTransforms, const FName InSkinWeightProfile=NAME_None, const TMap< FName, float > &InMorphTargetWeights={})
 
static SKELETALMESHDESCRIPTION_API bool GetPosedMeshInPlace (FMeshDescription &InOutTargetMesh, TConstArrayView< FTransform > InComponentSpaceTransforms, const FName InSkinWeightProfile=NAME_None, const TMap< FName, float > &InMorphTargetWeights={}, bool bInSkipRecomputeNormalsTangents=false, bool bInWriteBonePose=false)
 
static SKELETALMESHDESCRIPTION_API bool GetUnposedMesh (const FMeshDescription &InPosedMesh, const FMeshDescription &InRefMesh, TArray< FTransform > &RefBoneTransforms, FMeshDescription &OutUnposedMesh, TConstArrayView< FTransform > InComponentSpaceTransforms, const FName InSkinWeightProfile, const TMap< FName, float > &InMorphTargetWeights)
 
static SKELETALMESHDESCRIPTION_API bool GetUnposedMeshInPlace (FMeshDescription &InOutTargetMesh, const FMeshDescription &InRefMesh, TArray< FTransform > &RefBoneTransforms, TConstArrayView< FTransform > InComponentSpaceTransforms, const FName InSkinWeightProfile, const TMap< FName, float > &InMorphTargetWeights, bool bInWriteBonePose=false)
 
static SKELETALMESHDESCRIPTION_API void ConvertHardEdgesToSmoothMasks (const FMeshDescription &InMeshDescription, TArray< uint32 > &OutSmoothMasks)
 
static SKELETALMESHDESCRIPTION_API void FixVertexInstanceStructure (FMeshDescription &SourceMeshDescription, FMeshDescription &TargetMeshDescription, const TArray< uint32 > &SourceSmoothingMasks, TArray< uint32 > &TargetFaceSmoothingMasks)
 
static SKELETALMESHDESCRIPTION_API void ValidateFixComputeMeshDescriptionData (FMeshDescription &MeshDescription, const TArray< uint32 > &FaceSmoothingMasks, int32 LODIndex, const bool bComputeWeightedNormals, const FString &SkeletalMeshPath)
 
static SKELETALMESHDESCRIPTION_API void ValidateAndFixInfluences (FMeshDescription &MeshDescription, bool &bOutInfluenceCountLimitHit)
 
static SKELETALMESHDESCRIPTION_API void ApplyRigToGeo (FMeshDescription &RigMeshDescription, FMeshDescription &GeoMeshDescription)
 
- Static Public Member Functions inherited from FStaticMeshOperations
static STATICMESHDESCRIPTION_API void ComputeTriangleTangentsAndNormals (FMeshDescription &MeshDescription, float ComparisonThreshold=0.0f, const TCHAR *DebugName=nullptr)
 
static STATICMESHDESCRIPTION_API void ComputeTangentsAndNormals (FMeshDescription &MeshDescription, EComputeNTBsFlags ComputeNTBsOptions)
 
static STATICMESHDESCRIPTION_API void RecomputeNormalsAndTangentsIfNeeded (FMeshDescription &MeshDescription, EComputeNTBsFlags ComputeNTBsOptions)
 
static STATICMESHDESCRIPTION_API void ComputeMikktTangents (FMeshDescription &MeshDescription, bool bIgnoreDegenerateTriangles)
 
static STATICMESHDESCRIPTION_API void DetermineEdgeHardnessesFromVertexInstanceNormals (FMeshDescription &MeshDescription, float Tolerance=UE_KINDA_SMALL_NUMBER)
 
static STATICMESHDESCRIPTION_API void ConvertToRawMesh (const FMeshDescription &SourceMeshDescription, FRawMesh &DestinationRawMesh, const TMap< FName, int32 > &MaterialMap)
 
static STATICMESHDESCRIPTION_API void ConvertFromRawMesh (const FRawMesh &SourceRawMesh, FMeshDescription &DestinationMeshDescription, const TMap< int32, FName > &MaterialMap, bool bSkipNormalsAndTangents=false, const TCHAR *DebugName=nullptr)
 
static STATICMESHDESCRIPTION_API void AppendMeshDescription (const FMeshDescription &SourceMesh, FMeshDescription &TargetMesh, const FAppendSettings &AppendSettings)
 
static STATICMESHDESCRIPTION_API void AppendMeshDescriptions (const TArray< const FMeshDescription * > &SourceMeshes, FMeshDescription &TargetMesh, const FAppendSettings &AppendSettings)
 
static STATICMESHDESCRIPTION_API void HasInvalidVertexInstanceNormalsOrTangents (const FMeshDescription &MeshDescription, bool &bHasInvalidNormals, bool &bHasInvalidTangents)
 
static void AreNormalsAndTangentsValid (const FMeshDescription &MeshDescription, bool &bHasInvalidNormals, bool &bHasInvalidTangents)
 
static STATICMESHDESCRIPTION_API void FindOverlappingCorners (FOverlappingCorners &OverlappingCorners, const FMeshDescription &MeshDescription, float ComparisonThreshold)
 
static STATICMESHDESCRIPTION_API int32 GetUVChartCount (FMeshDescription &MeshDescription, int32 SrcLightmapIndex, ELightmapUVVersion LightmapUVVersion, const FOverlappingCorners &OverlappingCorners)
 
static STATICMESHDESCRIPTION_API bool CreateLightMapUVLayout (FMeshDescription &MeshDescription, int32 SrcLightmapIndex, int32 DstLightmapIndex, int32 MinLightmapResolution, ELightmapUVVersion LightmapUVVersion, const FOverlappingCorners &OverlappingCorners)
 
static STATICMESHDESCRIPTION_API bool GenerateUniqueUVsForStaticMesh (const FMeshDescription &MeshDescription, int32 TextureResolution, bool bMergeIdenticalMaterials, TArray< FVector2D > &OutTexCoords)
 
static STATICMESHDESCRIPTION_API bool GenerateUV (const FMeshDescription &MeshDescription, const FGenerateUVOptions &Options, TArray< FVector2D > &OutTexCoords)
 
static STATICMESHDESCRIPTION_API bool AddUVChannel (FMeshDescription &MeshDescription)
 
static STATICMESHDESCRIPTION_API bool InsertUVChannel (FMeshDescription &MeshDescription, int32 UVChannelIndex)
 
static STATICMESHDESCRIPTION_API bool RemoveUVChannel (FMeshDescription &MeshDescription, int32 UVChannelIndex)
 
static STATICMESHDESCRIPTION_API void GeneratePlanarUV (const FMeshDescription &MeshDescription, const FUVMapParameters &Params, TMap< FVertexInstanceID, FVector2D > &OutTexCoords)
 
static STATICMESHDESCRIPTION_API void GenerateCylindricalUV (FMeshDescription &MeshDescription, const FUVMapParameters &Params, TMap< FVertexInstanceID, FVector2D > &OutTexCoords)
 
static STATICMESHDESCRIPTION_API void GenerateBoxUV (const FMeshDescription &MeshDescription, const FUVMapParameters &Params, TMap< FVertexInstanceID, FVector2D > &OutTexCoords)
 
static STATICMESHDESCRIPTION_API void SwapPolygonPolygonGroup (FMeshDescription &MeshDescription, int32 SectionIndex, int32 TriangleIndexStart, int32 TriangleIndexEnd, bool bRemoveEmptyPolygonGroup)
 
static STATICMESHDESCRIPTION_API void ConvertHardEdgesToSmoothGroup (const FMeshDescription &SourceMeshDescription, TArray< uint32 > &FaceSmoothingMasks)
 
static STATICMESHDESCRIPTION_API void ConvertSmoothGroupToHardEdges (const TArray< uint32 > &FaceSmoothingMasks, FMeshDescription &DestinationMeshDescription)
 
static STATICMESHDESCRIPTION_API bool HasVertexColor (const FMeshDescription &MeshDescription)
 
static STATICMESHDESCRIPTION_API void BuildWeldedVertexIDRemap (const FMeshDescription &MeshDescription, const float WeldingThreshold, TMap< FVertexID, FVertexID > &OutVertexIDRemap)
 
static STATICMESHDESCRIPTION_API FSHAHash ComputeSHAHash (const FMeshDescription &MeshDescription, bool bSkipTransientAttributes=false)
 
static STATICMESHDESCRIPTION_API void FlipPolygons (FMeshDescription &MeshDescription)
 
static STATICMESHDESCRIPTION_API void ApplyTransform (FMeshDescription &MeshDescription, const FTransform &Transform, bool bApplyCorrectNormalTransform=false)
 
static STATICMESHDESCRIPTION_API void ApplyTransform (FMeshDescription &MeshDescription, const FMatrix &Transform, bool bApplyCorrectNormalTransform=false)
 
static STATICMESHDESCRIPTION_API int32 GetUniqueVertexCount (const FMeshDescription &MeshDescription)
 
static STATICMESHDESCRIPTION_API int32 GetUniqueVertexCount (const FMeshDescription &MeshDescription, const FOverlappingCorners &OverlappingCorners)
 
static STATICMESHDESCRIPTION_API void ReorderMeshDescriptionPolygonGroups (const FMeshDescription &SourceMeshDescription, FMeshDescription &DestinationMeshDescription, TOptional< const FString > UnmatchMaterialNameWarning, TOptional< const FString > DestinationPolygonGroupCountDifferFromSource_Msg)
 
static STATICMESHDESCRIPTION_API bool ValidateAndFixData (FMeshDescription &MeshDescription, const FString &DebugName)
 
static STATICMESHDESCRIPTION_API float ComputeMeshArea (const FMeshDescription &InMeshDescription)
 

Additional Inherited Members

- Public Types inherited from FStaticMeshOperations
enum class  EGenerateUVMethod {
  Default , Legacy , UVAtlas , XAtlas ,
  PatchBuilder
}
 

Member Function Documentation

◆ AppendSkinWeight()

void FSkeletalMeshOperations::AppendSkinWeight ( const FMeshDescription SourceMesh,
FMeshDescription TargetMesh,
FSkeletalMeshAppendSettings AppendSettings 
)
static

◆ ApplyRigToGeo()

void FSkeletalMeshOperations::ApplyRigToGeo ( FMeshDescription RigMeshDescription,
FMeshDescription GeoMeshDescription 
)
static

Applies the Rig / Skinning found in RigMeshDescription to the Geometry found in GeomeshDescription Desired behavior of this function was targeting FSkeletalMeshImportData::ApplyRigToGeo. Important distinction however: FSkeletalMeshImportData::ApplyRigToGeo seem to work based on VertexInstances, it also checks the VertexCandidate Normal and UVs and only finds the candidate legitimate if they match between Rig and Geo) As Influences (BoneIndex and BoneWeights) are Vertex (NOT VertexInstance) dependent. Whilst original implementation in FSkeletalMeshImportData::ApplyRigToGeo was checking and validating against normals and UVs for NearestWedges, with current implementation we try the NearestVertices with the same principle as the FindMatchingPositionVertexIndexes. (aka based on GetSmallestDeltaBetweenTriangleLists)

◆ ConvertHardEdgesToSmoothMasks()

void FSkeletalMeshOperations::ConvertHardEdgesToSmoothMasks ( const FMeshDescription InMeshDescription,
TArray< uint32 > &  OutSmoothMasks 
)
static

A simpler variant of FStaticMeshOperations::ConvertHardEdgesToSmoothGroup that assumes that hard edges always form closed regions.

◆ CopySkinWeightAttributeFromMesh()

bool FSkeletalMeshOperations::CopySkinWeightAttributeFromMesh ( const FMeshDescription InSourceMesh,
FMeshDescription InTargetMesh,
const FName  InSourceProfile,
const FName  InTargetProfile,
const TMap< int32, int32 > *  SourceBoneIndexToTargetBoneIndexMap 
)
static

Copies skin weight attribute from one mesh to another. Assumes the two geometries are identical or near-identical. Uses closest triangle on the target mesh to interpolate skin weights to each of the points on the target mesh. Attributes for the given profiles on both meshes should exist in order for this function to succeed.

Parameters
InSourceMeshThe mesh to copy skin weights from.
InTargetMeshThe mesh to copy skin weights to.
InSourceProfileThe name of the skin weight profile on the source mesh to read from.
InTargetProfileThe name of the skin weight profile on the target mesh to write to.
SourceBoneIndexToTargetBoneIndexMapAn optional mapping table to map bone indexes on the source mesh to the target mesh. The table needs to be complete for all the source bone indexes to valid target bone indexes, otherwise the behavior is undefined. If the table is not given, the bone indexes on the source and target meshes are assumed to be the same.

◆ FixVertexInstanceStructure()

void FSkeletalMeshOperations::FixVertexInstanceStructure ( FMeshDescription SourceMeshDescription,
FMeshDescription TargetMeshDescription,
const TArray< uint32 > &  SourceSmoothingMasks,
TArray< uint32 > &  TargetFaceSmoothingMasks 
)
static

Helper function to follow behavior generated in FSkeletalMeshImportData::GetMeshDescription, just straight on FMeshDescriptions. FSkeletalMeshImportData::GetMeshDescription makes the VertexInstances a single usage semantics. It also re-orders the vertexInstances to be in a straight increasing sequence, which seems to affect the normal and tangent (FSkeletalMeshOperations::Compute..) generation. (Which means, we can't do the restructuring in place.) For that reason we re-create the MeshDescription into the TargetMeshDescription which is expected to be empty.

◆ GetPosedMesh() [1/2]

bool FSkeletalMeshOperations::GetPosedMesh ( const FMeshDescription InSourceMesh,
FMeshDescription OutTargetMesh,
const TMap< FName, FTransform > &  InBoneSpaceTransforms,
const FName  InSkinWeightProfile = NAME_None,
const TMap< FName, float > &  InMorphTargetWeights = {} 
)
static

Returns a mesh in the pose given by the bone-space transforms passed in. The transforms simply replace the matching ref pose transforms stored in the bone data on the mesh. Any named transform, that does not match a bone on the mesh, is ignored.
If there are no skin weights on the mesh, or the named skin weight profile doesn't exist, the function also returns false. The resulting bones on the mesh will have their bone-space transforms updated so that the same mesh can be re-posed as needed.

Parameters
InSourceMeshThe mesh to deform.
OutTargetMeshThe deformed mesh result.
InBoneSpaceTransformsA map of named bone-space transforms.
InSkinWeightProfileThe skin weight profile to use as the source of skin weights for the deformation.
InMorphTargetWeightsOptional morph target weights to apply. Any morph target that doesn't exist is ignored.
Returns
true if the operation succeeded.

◆ GetPosedMesh() [2/2]

bool FSkeletalMeshOperations::GetPosedMesh ( const FMeshDescription InSourceMesh,
FMeshDescription OutTargetMesh,
TConstArrayView< FTransform InComponentSpaceTransforms,
const FName  InSkinWeightProfile = NAME_None,
const TMap< FName, float > &  InMorphTargetWeights = {} 
)
static

Returns a mesh in the pose given by the component-space transforms passed in. The list of transforms should match exactly the list of bones stored on the mesh. If not, the function fails and returns false. If there are no skin weights on the mesh, or the named skin weight profile doesn't exist, the function also returns false. The resulting bones on the mesh will have their bone-space transforms updated so that the same mesh can be re-posed as needed.

Parameters
InSourceMeshThe mesh to deform.
OutTargetMeshThe deformed mesh result.
InComponentSpaceTransformsThe component space transforms used to move the mesh joints for deforming, using linear-blend skinning.
InSkinWeightProfileThe skin weight profile to use as the source of skin weights for the deformation.
InMorphTargetWeightsOptional morph target weights to apply. Any morph target that doesn't exist is ignored.
Returns
true if the operation succeeded.

◆ GetPosedMeshInPlace()

bool FSkeletalMeshOperations::GetPosedMeshInPlace ( FMeshDescription InOutTargetMesh,
TConstArrayView< FTransform InComponentSpaceTransforms,
const FName  InSkinWeightProfile = NAME_None,
const TMap< FName, float > &  InMorphTargetWeights = {},
bool  bInSkipRecomputeNormalsTangents = false,
bool  bInWriteBonePose = false 
)
static

Returns a mesh in the pose given by the component-space transforms passed in. The list of transforms should match exactly the list of bones stored on the mesh. If not, the function fails and returns false. If there are no skin weights on the mesh, or the named skin weight profile doesn't exist, the function also returns false. if bInWriteBonePose is true, the resulting bones on the mesh will have their bone-space transforms updated so that the same mesh can be re-posed as needed.

Parameters
InOutTargetMeshrest pose mesh to be deformed in place
InComponentSpaceTransformsThe component space transforms used to move the mesh joints for deforming, using linear-blend skinning.
InSkinWeightProfileThe skin weight profile to use as the source of skin weights for the deformation.
InMorphTargetWeightsOptional morph target weights to apply. Any morph target that doesn't exist is ignored.
bInSkipRecomputeNormalsTangentsskip recompute normals and tangents to improve performance
bInWriteBonePosewhether to write the current bone pose into the mesh description.
Returns
true if the operation succeeded.

◆ GetUnposedMesh()

bool FSkeletalMeshOperations::GetUnposedMesh ( const FMeshDescription InPosedMesh,
const FMeshDescription InRefMesh,
TArray< FTransform > &  RefBoneTransforms,
FMeshDescription OutUnposedMesh,
TConstArrayView< FTransform InComponentSpaceTransforms,
const FName  InSkinWeightProfile,
const TMap< FName, float > &  InMorphTargetWeights 
)
static

Returns the unposed version of the provided posed mesh

Parameters
InPosedMeshThe posed mesh,
InRefMeshRef mesh containing morph target deltas of existing morphs
RefBoneTransformsRef component space bone transforms
OutUnposedMeshThe mesh with pose reset to reference
InComponentSpaceTransformsCurrent component space bone transforms
InSkinWeightProfileThe skin weight profile to use as the source of skin weights for the deformation.
InMorphTargetWeightsActive morph target weights producing the fully deformed mesh. Don't include the weight of the morph target you want to extract
Returns
true if the operation succeeded.

◆ GetUnposedMeshInPlace()

bool FSkeletalMeshOperations::GetUnposedMeshInPlace ( FMeshDescription InOutTargetMesh,
const FMeshDescription InRefMesh,
TArray< FTransform > &  RefBoneTransforms,
TConstArrayView< FTransform InComponentSpaceTransforms,
const FName  InSkinWeightProfile,
const TMap< FName, float > &  InMorphTargetWeights,
bool  bInWriteBonePose = false 
)
static

Returns the unposed version of the provided posed mesh

Parameters
InOutTargetMeshinput is the posed mesh, output is the mesh reset to ref pose
InRefMeshRef mesh containing morph target deltas of existing morphs
RefBoneTransformsRef component space bone transforms
InComponentSpaceTransformsCurrent component space bone transforms
InSkinWeightProfileThe skin weight profile to use as the source of skin weights for the deformation.
InMorphTargetWeightsActive morph target weights producing the fully deformed mesh. Don't include the weight of the morph target you want to extract
Returns
true if the operation succeeded.

◆ RemapBoneIndicesOnSkinWeightAttribute()

bool FSkeletalMeshOperations::RemapBoneIndicesOnSkinWeightAttribute ( FMeshDescription InMesh,
TConstArrayView< int32 InBoneIndexMapping 
)
static

Remaps the bone indices on all skin weight attributes from one index to another. The array view should contain a full mapping of all the bone indices contained in the skin weights. The array is indexed by the current bone index and the value at that index is the new bone index. If the mapping is incomplete or if two entries map to the same bone, the result is undefined. No prior checking is performed.

Parameters
InMeshThe mesh on which to modify all skin weight attributes to remap their bone indices.
InBoneIndexMappingThe mapping from one bone index to another. The old bone index is used to index into the array, the value at that position is the new bone index.
Returns
true if the operation was successful. If the mapping array was incomplete then this will return false. If there are no skin weight attributes on the mesh, then the operation is still deemed successful.

◆ ValidateAndFixInfluences()

void FSkeletalMeshOperations::ValidateAndFixInfluences ( FMeshDescription MeshDescription,
bool bOutInfluenceCountLimitHit 
)
static

Function will do the following steps on the MeshDescription (SkeletalMeshDescription) :

  • Sort influences by weight and BoneIndex.
  • Normalize influence weights.
  • provide flag if InfluenceCount exceeds MAX_TOTAL_INFLUENCES
  • Make sure all verts have influences set (if none exist bone 0 with weight 1)

◆ ValidateFixComputeMeshDescriptionData()

void FSkeletalMeshOperations::ValidateFixComputeMeshDescriptionData ( FMeshDescription MeshDescription,
const TArray< uint32 > &  FaceSmoothingMasks,
int32  LODIndex,
const bool  bComputeWeightedNormals,
const FString &  SkeletalMeshPath 
)
static

Helper function to follow behavior generated in FSkeletalMeshImportData::GetMeshDescription, just straight on FMeshDescriptions It will do the following steps:

  • ConvertSmoothGroupToHardEdges
  • ValidateAndFixData
  • HasInvalidVertexInstanceNormalsOrTangents -> ComputeTriangleTangentsAndNormals
  • (Re)BuildIndexers

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