FDynamicMeshEditor

[FDynamicMeshEditor](API\Plugins\DynamicMesh\FDynamicMeshEditor) implements low-level mesh editing operations.

Windows
MacOS
Linux

References

Module

DynamicMesh

Header

/Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Public/DynamicMeshEditor.h

Include

#include "DynamicMeshEditor.h"

Syntax

class FDynamicMeshEditor

Remarks

FDynamicMeshEditor implements low-level mesh editing operations. These operations can be used to construct higher-level operations. For example an Extrude operation could be implemented via DuplicateTriangles() and StitchLoopMinimal().

Variables

Name Description

Public variable

FDynamicMesh3 &...

 

Mesh

The mesh we will be editing

Constructors

Name Description

Public function

FDynamicMeshEditor

(
    FDynamicMesh3* MeshIn
)

Functions

Name Description

Public function

bool

 

AddTriangleFan_OrderedVertexLoop

(
    int CenterVertex,
    const TArray< int >& VertexLoop,
    int GroupID,
    FDynamicMeshEditResult& ResultOut
)

Fill hole with a triangle fan given an existing (unconnected) center vertex and an ordered loop of boundary vertices on the hole border.

Public function

void

 

AppendMesh

(
    const FDynamicMesh3* AppendMes...,
    FMeshIndexMappings& IndexMapsOut,
    TFunction< FVector3d...,
    TFunction< FVector3d...
)

Append input mesh to our internal mesh

Public function

void

 

AppendNormals

(
    const FDynamicMesh3* AppendMes...,
    const FDynamicMeshNormalOverlay...,
    FDynamicMeshNormalOverlay* ToN...,
    const FIndexMapi& VertexMap,
    const FIndexMapi& TriangleMap,
    TFunction< FVector3d...,
    FIndexMapi& NormalMapOut
)

Append normals from one attribute overlay to another.

Public function

void

 

AppendTriangles

(
    const FDynamicMesh3* SourceMes...,
    const TArrayView< const int >& Sou...,
    FMeshIndexMappings& IndexMaps,
    FDynamicMeshEditResult& ResultOut,
    bool bComputeTriangleMap
)

Append triangles of an existing mesh.

Public function

void

 

AppendUVs

(
    const FDynamicMesh3* AppendMes...,
    const FDynamicMeshUVOverlay* F...,
    FDynamicMeshUVOverlay* ToUVs,
    const FIndexMapi& VertexMap,
    const FIndexMapi& TriangleMap,
    FIndexMapi& UVMapOut
)

Append UVs from one attribute overlay to another.

Public function

FVector3f

 

ComputeAndSetQuadNormal

(
    const FIndex2i& QuadTris,
    bool bIsPlanar
)

Calculate and set the per-triangle normals of the two input quads.

Public function

void

 

CopyAttributes

(
    int FromTriangleID,
    int ToTriangleID,
    FMeshIndexMappings& IndexMaps,
    FDynamicMeshEditResult& ResultOut
)

Copy all attribute-layer values from one triangle to another, using the IndexMaps to track and re-use shared attribute values.

Public function

bool

 

DisconnectTriangles

(
    const TArray< int >& Triangles,
    TArray< FLoopPairSet >& LoopSetOut,
    bool bHandleBoundaryVertices
)

Finds boundary loops of connected components of a set of triangles, and duplicates the vertices along the boundary, such that the triangles become disconnected.

Public function

void

 

DisconnectTriangles

(
    const TArray< int >& Triangles,
    bool bPreventBowties
)

Disconnects triangles (without constructing boundary loops) such that the input Triangles are not connected to any other triangles in the mesh

Public function

void

 

DuplicateTriangles

(
    const TArray< int >& Triangles,
    FMeshIndexMappings& IndexMaps,
    FDynamicMeshEditResult& ResultOut
)

Duplicate triangles of a mesh.

Public function

int

 

FindOrCreateDuplicateGroup

(
    int TriangleID,
    FMeshIndexMappings& IndexMaps,
    FDynamicMeshEditResult& ResultOut
)

Find "new" group for input group under Index mapping, or create new if missing

Public function

int

 

FindOrCreateDuplicateNormal

(
    int ElementID,
    int NormalLayerIndex,
    FMeshIndexMappings& IndexMaps
)

Find "new" normal for input normal element under Index mapping, or create new if missing

Public function

int

 

FindOrCreateDuplicateUV

(
    int ElementID,
    int UVLayerIndex,
    FMeshIndexMappings& IndexMaps
)

Find "new" UV for input UV element under Index mapping, or create new if missing

Public function

int

 

FindOrCreateDuplicateVertex

(
    int VertexID,
    FMeshIndexMappings& IndexMaps,
    FDynamicMeshEditResult& ResultOut
)

Mesh element copying / duplication

Public function

void

 

InvertTriangleNormals

(
    const TArray< int >& Triangles
)

Flip the normals of the given triangles.

Public function

bool

 

ReinsertSubmesh

(
    const FDynamicSubmesh3& Submesh,
    FOptionallySparseIndexMap& SubToNe...,
    TArray< int >* NewTris,
    EDuplicateTriBehavior DuplicateBeha...
)

Update a Base Mesh from a Submesh; See FMeshRegionOperator::BackPropropagate for a usage example.

Public function

bool

 

RemoveTriangles

(
    const TArray< int >& Triangles,
    bool bRemoveIsolatedVerts,
    TFunctionRef< void> OnRemoveTr...
)

Remove a list of triangles from the mesh, and optionally any vertices that are now orphaned

Public function

bool

 

RemoveTriangles

(
    const TArray< int >& Triangles,
    bool bRemoveIsolatedVerts
)

Remove a list of triangles from the mesh, and optionally any vertices that are now orphaned

Public function

void

 

RescaleAttributeUVs

(
    float UVScale,
    bool bWorldSpace,
    int UVLayerIndex,
    TOptional< FTransform3d > ToWorld
)

Rescale UVs for the whole mesh, for the given UV attribute layer

Public function

void

 

ReverseTriangleOrientations

(
    const TArray< int >& Triangles,
    bool bInvertNormals
)

Normal utility functions.

Public function

void

 

SetGeneralTubeUVs

(
    const TArray< int >& Triangles,
    const TArray< int >& VertexIDs1,
    const TArray< int >& MatchedIndice...,
    const TArray< int >& VertexIDs2,
    const TArray< int >& MatchedIndice...,
    const TArray< float >& UValues,
    const FVector3f& VDir,
    float UVScaleFactor,
    const FVector2f& UVTranslation,
    int UVLayerIndex
)

For triangles connecting loops of corresponded vertices, set UVs in a cylindrical pattern so that the U coordinate starts at 0 for the first corresponded pair of vertices, and cycles around to 1 Assumes Triangles array stores indices of triangles in progressively filling the tube, starting with VertexIDs*[0].

Public function

void

 

SetQuadNormals

(
    const FIndex2i& QuadTris,
    const FVector3f& Normal
)

Create and set new shared per-triangle normals for a pair of triangles that share one edge (ie a quad)

Public function

void

 

SetQuadUVsFromProjection

(
    const FIndex2i& QuadTris,
    const FFrame3d& ProjectionFrame,
    float UVScaleFactor,
    const FVector2f& UVTranslation,
    int UVLayerIndex
)

UV utility functions.

Public function

void

 

SetTriangleNormals

(
    const TArray< int >& Triangles
)

Create and set new shared per-triangle normals for a list of triangles.

Public function

void

 

SetTriangleNormals

(
    const TArray< int >& Triangles,
    const FVector3f& Normal
)

Create and set new shared per-triangle normals for a list of triangles

Public function

void

 

SetTriangleUVsFromProjection

(
    const TArray< int32 >& Triangles,
    const FFrame3d& ProjectionFrame,
    float UVScaleFactor,
    const FVector2f& UVTranslation,
    bool bShiftToOrigin,
    int32 UVLayerIndex
)

Project triangles onto a plane defined by the ProjectionFrame and use that to create/set new shared per-triangle UVs.

Public function

void

 

SetTubeNormals

(
    const TArray< int >& Triangles,
    const TArray< int >& VertexIDs1,
    const TArray< int >& MatchedIndice...,
    const TArray< int >& VertexIDs2,
    const TArray< int >& MatchedIndice...
)

For a 'tube' of triangles connecting loops of corresponded vertices, set smooth normals such that corresponding vertices have corresponding normals

Public function

void

 

SplitBowties

(
    FDynamicMeshEditResult& ResultOut
)

Splits all bowties across the whole mesh

Public function

void

 

SplitBowties

(
    int VertexID,
    FDynamicMeshEditResult& ResultOut
)

Splits any bowties specifically on the given vertex, and updates (does not reset!) ResultOut with any added vertices

Public function Static

bool

 

SplitMesh

(
    const FDynamicMesh3* SourceMes...,
    TArray< FDynamicMesh3 >& SplitMesh...,
    TFunctionRef< int(int)> TriIDToMesh...,
    int DeleteMeshID
)

Create multiple meshes out of the source mesh by splitting triangles out.

Public function

bool

 

StitchSparselyCorrespondedVertexLoops

(
    const TArray< int >& VertexIDs1,
    const TArray< int >& MatchedIndice...,
    const TArray< int >& VertexIDs2,
    const TArray< int >& MatchedIndice...,
    FDynamicMeshEditResult& ResultOut
)

Stitch together two loops of vertices where vertices are only sparsely corresponded

Public function

bool

 

StitchVertexLoopsMinimal

(
    const TArray< int >& VertexLoop1,
    const TArray< int >& VertexLoop2,
    FDynamicMeshEditResult& ResultOut
)

Create and Remove Triangle Functions.

Classes

Name

Description

Public struct

FLoopPairSet

Pair of associated vertex and edge loops.

Enums

Name

Description

Public enum

EDuplicateTriBehavior

In ReinsertSubmesh, a problem can arise where the mesh we are inserting has duplicate triangles of the base mesh.

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