Navigation
API > API/Runtime > API/Runtime/GeometryFramework > API/Runtime/GeometryFramework/Components
Inheritance Hierarchy
- UMeshComponent
- IToolFrameworkComponent
- IMeshVertexCommandChangeTarget
- IMeshCommandChangeTarget
- IMeshReplacementCommandChangeTarget
- UBaseDynamicMeshComponent
- UDynamicMeshComponent
- USVGBaseDynamicMeshComponent
- UJoinedSVGDynamicMeshComponent
- USVGDynamicMeshComponent
References
| Module | GeometryFramework |
| Header | /Engine/Source/Runtime/GeometryFramework/Public/Components/DynamicMeshComponent.h |
| Include | #include "Components/DynamicMeshComponent.h" |
Syntax
UCLASS (HideCategories=(LOD), Meta=(BlueprintSpawnableComponent), ClassGroup=Rendering, MinimalAPI)
class UDynamicMeshComponent :
public UBaseDynamicMeshComponent ,
public IInterface_CollisionDataProvider
Remarks
UDynamicMeshComponent is a mesh component similar to UProceduralMeshComponent, except it bases the renderable geometry off an internal UDynamicMesh instance (which encapsulates a FDynamicMesh3).
There is extensive support for partial updates to render buffers, customizing colors, internally decomposing the mesh into separate chunks for more efficient render updates, and support for attaching a 'Postprocessor' to generate a render mesh on-the-fly See comment sections below for details.
Variables
| Type | Name | Description | |
|---|---|---|---|
| FKAggregateGeom | AggGeom | Internals for managing collision representation and setup Simplified collision representation for the mesh component | |
| TArray< TObjectPtr< UBodySetup > > | AsyncBodySetupQueue | Queue for async body setups that are being cooked | |
| UE::Geometry::FMeshTangentsf | AutoCalculatedTangents | Set of per-triangle-vertex tangents computed for the current mesh. | |
| bool | bAutoCalculatedTangentsValid | True if AutoCalculatedTangents has been computed for current mesh | |
| bool | bCollisionUpdatePending | ||
| bool | bDeferCollisionUpdates | If true, updates to the mesh will not result in immediate collision regeneration. | |
| bool | bEnableComplexCollision | If true, current mesh will be used as Complex Collision source mesh. | |
| bool | bInvalidateProxyOnChange | If false, we don't completely invalidate the RenderProxy when ApplyChange() is called (assumption is it will be handled elsewhere) | |
| bool | bIsEditable | If set to false, this blocks external code from being able to modify the internal mesh. | |
| bool | bProxyValid | If the render proxy is invalidated (eg by MarkRenderStateDirty()), it will be destroyed at the end of the frame, but the base SceneProxy pointer is not nulled out immediately. | |
| bool | bProxyVerifyUsedMaterials | If true, the render proxy will verify that the mesh batch materials match the contents from the component GetUsedMaterials(). | |
| bool | bTransientDeferCollisionUpdates | ||
| bool | bUseAsyncCooking | Controls whether the physics cooking should be done off the game thread. | |
| TEnumAsByte< enum ECollisionTraceFlag > | CollisionType | Type of Collision Geometry to use for this Mesh | |
| TSharedPtr< FDistanceFieldVolumeData > | CurrentDistanceField | ||
| TUniquePtr< FMeshRenderDecomposition > | Decomposition | ||
| TAsyncComponentDataComputeQueue< FDistanceFieldVolumeData > | DistanceFieldComputeQueue | ||
| FCriticalSection | DistanceFieldLock | Distance Field Support | |
| UE::Geometry::FAxisAlignedBox3d | LocalBounds | Standard Component internals, for computing bounds and managing the SceneProxy Current local-space bounding box of Mesh | |
| TObjectPtr< UBodySetup > | MeshBodySetup | ||
| TObjectPtr< UDynamicMesh > | MeshObject | Internal FDynamicMesh is stored inside a UDynamicMesh container, which allows it to be used from BP, shared with other UObjects, and so on | |
| FDelegateHandle | MeshObjectChangedHandle | Handle for OnMeshObjectChanged which is registered with MeshObject::OnMeshChanged delegate | |
| FComponentChildrenChangedDelegate | OnChildAttachmentModified | The OnChildAttached() and OnChildDetached() implementations (from USceneComponent API) broadcast this delegate. | |
| FSimpleMulticastDelegate | OnMeshChanged | This delegate fires when the mesh has been changed | |
| FMeshVerticesModified | OnMeshVerticesChanged | ||
| TUniquePtr< FDynamicMesh3 > | RenderMesh | ||
| TUniquePtr< IRenderMeshPostProcessor > | RenderMeshPostProcessor | ||
| TUniqueFunction< bool(const FDynamicMesh3 *, int32)> | SecondaryTriFilterFunc | ||
| EDynamicMeshComponentTangentsMode | TangentsType | Tangent source defines whether we use the provided tangents on the Dynamic Mesh, autogenerate tangents, or do not use tangents | |
| TUniqueFunction< FColor(const FDynamicMesh3 *, int)> | TriangleColorFunc | If this function is set, we will use these colors instead of vertex colors | |
| TUniqueFunction< void(FVector4f &)> | VertexColorMappingFunc | If this function is set, DynamicMesh Attribute Color Overlay colors will be passed through this function before sending to render buffers |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UDynamicMeshComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | |||
| void | BeginDestroy () |
||
| FBoxSphereBounds | CalcBounds
(
const FTransform& LocalToWorld |
||
| void | ClearSimpleCollisionShapes
(
bool bUpdateCollision |
Clear the simple collision shapes associated with this mesh component | |
| void | ClearTriangleColorFunction
(
EDynamicMeshComponentRenderUpdateMode UpdateMode |
Clear an active triangle color function if one exists, and update the mesh | |
| void | Clear an active VertexColor Remapping function if one exists, and update the mesh | ||
| void | ConfigureMaterialSet
(
const TArray< UMaterialInterface* >& NewMaterialSet, |
Material Set API. DynamicMeshComponent supports changing the Material Set dynamically, even at Runtime. | |
| bool | ContainsPhysicsTriMeshData
(
bool InUseAllTriData |
||
| UBodySetup * | |||
| FPrimitiveSceneProxy * | |||
| void | Disable secondary triangle buffers. This invalidates the SceneProxy. | ||
| void | EditMesh
(
TFunctionRef< void(UE::Geometry::FDynamicMesh3&)> EditFunc, |
Allow external code to to edit the internal mesh. | |
| void | Physics APIs calls SetComplexAsSimpleCollisionEnabled(true, true) | ||
| void | EnableSecondaryTriangleBuffers
(
TUniqueFunction< bool(const FDynamicMesh3*, int32)> SecondaryTriFilterFunc |
Support for Secondary triangle index buffers. | |
| void | Call this instead of NotifyMeshUpdated() if you have only updated the vertex colors (or triangle color function). | ||
| void | FastNotifyPositionsUpdated
(
bool bNormals, |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex positions (and possibly some attributes). | |
| void | Call this instead of NotifyMeshUpdated() if you have only updated secondary triangle sorting. | ||
| void | FastNotifyTriangleVerticesUpdated
(
const TArray< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | |
| void | FastNotifyTriangleVerticesUpdated
(
const TSet< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | |
| void | FastNotifyTriangleVerticesUpdated_ApplyPrecompute
(
const TArray< int32 >& Triangles, |
This function updates vertex positions/attributes of existing SceneProxy render buffers if possible, for the given triangles. | |
| TFuture< bool > | FastNotifyTriangleVerticesUpdated_TryPrecompute
(
const TArray< int32 >& Triangles, |
If a Decomposition is set on this Component, and everything is currently valid (proxy/etc), precompute the set of buffers that will be modified, as well as the bounds of the modified region. | |
| void | Call this instead of NotifyMeshUpdated() if you have only updated the vertex uvs. | ||
| void | FastNotifyVertexAttributesUpdated
(
bool bNormals, |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex attributes (but not positions). | |
| void | FastNotifyVertexAttributesUpdated
(
EMeshRenderAttributeFlags UpdatedAttributes |
Call this instead of NotifyMeshUpdated() if you have only updated the vertex positions/attributes This function will update the existing RenderProxy buffers if possible, rather than create new ones. | |
| void | FinishPhysicsAsyncCook
(
bool bSuccess, |
Once async physics cook is done, create needed state | |
| const UE::Geometry::FMeshTangentsf * | |||
| UBodySetup * | GetBodySetup () |
||
| const UBodySetup * | GetBodySetup () |
||
| FDynamicMeshSceneProxy * | |||
| FColor | GetGroupColor
(
const FDynamicMesh3* Mesh, |
This function is passed via lambda to the RenderProxy when BaseDynamicMeshComponent::ColorMode == Polygroups | |
| bool | |||
| bool | GetPhysicsTriMeshData
(
FTriMeshCollisionData* CollisionData, |
||
| FDynamicMesh3 * | The SceneProxy should call these functions to get the post-processed RenderMesh. | ||
| const FDynamicMesh3 * | The SceneProxy should call these functions to get the post-processed RenderMesh. | ||
| const FKAggregateGeom & | |||
| EDynamicMeshComponentTangentsMode | |||
| FColor | GetTriangleColor
(
const FDynamicMesh3* Mesh, |
This function is passed via lambda to the RenderProxy to be able to access TriangleColorFunc | |
| bool | GetTriMeshSizeEstimates
(
FTriMeshCollisionDataEstimates& OutTriMeshEstimates, |
||
| bool | |||
| bool | |||
| void | This function marks the auto tangents as dirty, they will be recomputed before they are used again | ||
| void | |||
| bool | IsEditable () |
If set to false, this blocks external code from being able to modify the internal mesh. | |
| void | RenderBuffer Update Blueprint API. | ||
| void | NotifyMeshVertexAttributesModified
(
bool bPositions, |
Notify the Component that vertex attribute values of it's DynamicMesh have been modified externally. | |
| void | OnChildAttached
(
USceneComponent* ChildComponent |
||
| void | OnChildDetached
(
USceneComponent* ChildComponent |
||
| void | OnMeshObjectChanged
(
UDynamicMesh* ChangedMeshObject, |
Called whenever internal MeshObject is modified, fires OnMeshChanged and OnMeshVerticesChanged above | |
| void | OnNewDistanceFieldData_Async
(
TUniquePtr< FDistanceFieldVolumeData > NewData |
||
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
||
| void | |||
| void | PostLoad () |
||
| void | |||
| void | RemapVertexColor
(
FVector4f& VertexColorInOut |
This function is passed via lambda to the RenderProxy to be able to access VertexColorMappingFunc | |
| void | ResetProxy () |
Fully invalidate all rendering data for this Component. | |
| void | Serialize
(
FArchive& Ar |
||
| void | SetAllowsGeometrySelection
(
bool bInAllowsGeometrySelection |
Enable/Disable interactive geometry element selection for the mesh. | |
| void | SetBodySetup
(
UBodySetup* NewSetup |
||
| void | SetComplexAsSimpleCollisionEnabled
(
bool bEnabled, |
If bEnabled=true, sets bEnableComplexCollision=true and CollisionType=CTF_UseComplexAsSimple If bEnabled=true, sets bEnableComplexCollision=false and CollisionType=CTF_UseDefault | |
| void | SetDeferredCollisionUpdatesEnabled
(
bool bEnabled, |
Set value of bDeferCollisionUpdates, when enabled, collision is not automatically recomputed each time the mesh changes. | |
| void | SetDynamicMesh
(
UDynamicMesh* NewMesh |
Replace the current UDynamicMesh with a new one, and transfer ownership of NewMesh to this Component. | |
| void | SetExternalDecomposition
(
TUniquePtr< FMeshRenderDecomposition > Decomposition |
Support for a Render Decomposition, which is basically a segmentation of the mesh triangles into subsets which will be turned into separate RenderBuffers in the Render Proxy. | |
| void | SetInvalidateProxyOnChangeEnabled
(
bool bEnabled |
When a FMeshChange or FMeshVertexChange is applied, by default we currently fully invalidate the render proxy. | |
| void | SetIsEditable
(
bool bInIsEditable |
||
| void | SetRenderMeshPostProcessor
(
TUniquePtr< IRenderMeshPostProcessor > Processor |
IRenderMeshPostProcessor Support. | |
| void | SetSceneProxyVerifyUsedMaterials
(
bool bState |
Set whether or not to validate mesh batch materials against the component materials. | |
| void | SetSimpleCollisionShapes
(
const FKAggregateGeom& AggGeom, |
Update the simple collision shapes associated with this mesh component | |
| void | SetTangentsType
(
EDynamicMeshComponentTangentsMode NewTangentsType |
||
| void | SetTransientDeferCollisionUpdates
(
bool bEnabled |
The bDeferCollisionUpdates property is a serialized Component setting that controls when collision is regenerated. | |
| void | SetTriangleColorFunction
(
TUniqueFunction< FColor(const FDynamicMesh3*, int)> TriangleColorFuncIn, |
Support for specifying per-triangle colors as vertex colors. | |
| void | SetVertexColorRemappingFunction
(
TUniqueFunction< void(FVector4f&)> ColorMapFuncIn, |
Support for Vertex Color remapping/filtering. | |
| void | |||
| void | UpdateCollision
(
bool bOnlyIfPending |
Force an update of the Collision/Physics data for this Component. | |
| void | |||
| void | Recompute LocalBounds from the current Mesh | ||
| bool | ValidateMaterialSlots
(
bool bCreateIfMissing, |
Compute the maximum MaterialID on the DynamicMesh, and ensure that Material Slots match. | |
| bool |
Overridden from UBaseDynamicMeshComponent
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyTransform
(
const FTransform3d& Transform, |
Apply transform to internal mesh. In some cases this can be more efficient than a general edit. | |
| FBaseDynamicMeshSceneProxy * | Subclass must implement this to return scene proxy if available, or nullptr | ||
| UDynamicMesh * | |||
| const FDynamicMesh3 * | GetMesh () |
Avoid usage of this function, access via GetDynamicMesh() instead | |
| FDynamicMesh3 * | GetMesh () |
Mesh Access. | |
| void | This is called to tell our RenderProxy about modifications to the material set. | ||
| void | RenderBuffer Update API. | ||
| void | UBaseDynamicMeshComponent API. | ||
| void | ProcessMesh
(
TFunctionRef< void(const UE::Geometry::FDynamicMesh3&)> ProcessFunc |
Allow external code to read the internal mesh. | |
| void | SetMesh
(
UE::Geometry::FDynamicMesh3&& MoveMesh |
Initialize the internal mesh from a DynamicMesh |
Overridden from IMeshVertexCommandChangeTarget
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyChange
(
const FMeshVertexChange* Change, |
Change Support. |
Overridden from IMeshCommandChangeTarget
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyChange
(
const FMeshChange* Change, |
Apply a general mesh change to the mesh |
Overridden from IMeshReplacementCommandChangeTarget
| Type | Name | Description | |
|---|---|---|---|
| void | ApplyChange
(
const FMeshReplacementChange* Change, |
Apply a mesh replacement change to mesh |
Typedefs
| Name | Description |
|---|---|
| FComponentChildrenChangedDelegate | Support for Component attachment change notifications via delegates. |
| FMeshVerticesModified | This delegate fires when the mesh vertices have been changed via an FMeshVertexChange |
Constants
| Name | Description |
|---|---|
| UseDefaultTangentsType | Default what the 'Default' tangent type should map to. |