UPreviewMesh

[UPreviewMesh](API\Plugins\ModelingComponents\UPreviewMesh) is a utility object that spawns and owns a transient mesh object in the World.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

ModelingComponents

Header

/Engine/Plugins/Experimental/MeshModelingToolset/Source/ModelingComponents/Public/PreviewMesh.h

Include

#include "PreviewMesh.h"

Syntax

UCLASS (Transient)
class UPreviewMesh :
    public UObject ,
    public IMeshVertexCommandChangeTarget ,
    public IMeshCommandChangeTarget ,
    public IMeshReplacementCommandChangeTarget

Remarks

UPreviewMesh is a utility object that spawns and owns a transient mesh object in the World. This can be used to show live preview geometry during modeling operations. Call CreateInWorld() to set it up, and Disconnect() to shut it down.

Currently implemented via an internal Actor that has a USimpleDynamicMeshComponent root component, with an AABBTree created/updated if FProperty bBuildSpatialDataStructure=true. The Actor is destroyed on Disconnect() .

The intention with UPreviewMesh is to provide a higher-level interface than the Component. In future the internal Component may be replaced with another class (eg OctreeDynamicMeshComponent), or automatically swap between the two, etc.

As a result direct access to the Actor/Component, or a non-const FDynamicMesh3 , is intentionally not provided. Wrapper functions are provided (or should be added) for necessary Actor/Component parameters. To edit the mesh either a copy is done, or EditMesh() /ApplyChange() must be used. These functions automatically update necessary internal data structures.

Variables

Name Description

Public variable UProperty

bool

 

bBuildSpatialDataStructure

If true, we build a spatial data structure internally for the preview mesh, which allows for hit-testing

Public variable UProperty

bool

 

bDrawOnTop

Results in component drawing w/o z-testing and with editor compositing. Do not recommend using this flag, will be deprecated/removed.

Protected variable UProperty

USimpleDynamicM ...

 

DynamicMeshComponent

This component is set as the root component of TemporaryParentActor

Protected variable

FDynamicMeshAAB ...

 

MeshAABBTree

Spatial data structure that is initialized if bBuildSpatialDataStructure = true when UpdatePreview() is called

Protected variable

APreviewMeshAct ...

 

TemporaryParentActor

The temporary actor we create internally to own the preview mesh component

Constructors

Name Description

Public function

UPreviewMesh()

Destructors

Name Description

Public function Virtual

~UPreviewMesh()

Functions

Name Description

Public function

void

 

Bake

(
    FMeshDescription * MeshDescript...,
    bool bHaveModifiedToplogy
)

Write the internal mesh to a MeshDescription

Public function

void

 

ClearOverrideRenderMaterial()

Clear the override material for the preview mesh.

Public function

void

 

ClearPreview()

Read access to internal mesh Clear the preview mesh

Public function

void

 

ClearSecondaryRenderMaterial()

Clear the secondary material for the preview mesh.

Public function

void

 

ClearTriangleColorFunction

(
    ERenderUpdateMode UpdateMode
)

Clear the triangle color function for rendering / render data construction

Public function

void

 

CreateInWorld

(
    UWorld * World,
    const FTransform & WithTransform
)

Construction / destruction Create preview mesh in the World with the given transform

Public function

void

 

DeferredEditMesh

(
    TFunctionRef < void &)...,
    bool bRebuildSpatial
)

Apply EditFunc to the internal mesh, and update spatial data structure if requested, but do not update/rebuild rendering data structures.

Public function

void

 

DisableSecondaryTriangleBuffers()

Disable secondary triangle buffers

Public function

void

 

Disconnect()

Remove and destroy preview mesh

Public function

void

 

EditMesh

(
    TFunctionRef < void &)...
)

Apply EditFunc to the internal mesh and update internal data structures as necessary

Public function

void

 

EnableSecondaryTriangleBuffers

(
    TUniqueFunction < bool ...
)

Enable secondary triangle buffers.

Public function

void

 

EnableWireframe

(
    bool bEnable
)

Visualization parameters Enable/disable wireframe overlay rendering

Public function Const

TUniquePtr < ...

 

ExtractPreviewMesh()

Public function

FVector3d

 

FindNearestPoint

(
    const FVector3d & WorldPoint,
    bool bLinearSearch
)

Find nearest point on current mesh to given WorldPoint Requires that bBuildSpatialDataStructure = true unless bLinearSearch = true

Public function

bool

 

FindRayIntersection

(
    const FRay3d & WorldRay,
    FHitResult & HitOut
)

Find ray intersection with the preview mesh.

Public function

void

 

ForceRebuildSpatial()

Force rebuild of internal spatial data structure.

Public function Const

UMaterialInt ...

 

GetActiveMaterial

(
    int MaterialIndex
)

Public function Const

UMaterialInt ...

 

GetMaterial

(
    int MaterialIndex
)

Get material from the preview mesh

Public function Const

const FDynam ...

 

GetMesh()

Public function

FSimpleMulti...

 

GetOnMeshChanged()

Public function Const

const FDynam ...

 

GetPreviewDynamicMesh()

Public function

UPrimitiveCo ...

 

GetRootComponent()

Public function Const

FMeshTangent ...

 

GetTangents()

Public function Const

FTransform

 

GetTransform()

Get the current transform on the preview mesh

Public function

void

 

InitializeMesh

(
    FMeshDescription * MeshDescript...
)

Initialize the internal mesh based on the given MeshDescription

Public function Const

bool

 

IsVisible()

Public function

void

 

NotifyDeferredEditCompleted

(
    ERenderUpdateMode UpdateMode,
    bool bRebuildSpatial
)

Notify that a DeferredEditMesh sequence is complete and cause update of rendering data structures.

Public function

void

 

ReplaceMesh

(
    FDynamicMesh3 && NewMesh
)

Edit access to internal mesh, and change-tracking/notification Replace mesh with new mesh

Public function

void

 

SetMaterial

(
    UMaterialInterface * Material
)

Set material on the preview mesh

Public function

void

 

SetMaterial

(
    int MaterialIndex,
    UMaterialInterface * Material
)

Set material on the preview mesh

Public function

void

 

SetMaterials

(
    const TArray < UMaterialInterface &#...
)

Set the entire material set on the preview mesh

Public function

void

 

SetOverrideRenderMaterial

(
    UMaterialInterface * Material
)

Set an override material for the preview mesh. This material will override all the given materials.

Public function

void

 

SetSecondaryRenderMaterial

(
    UMaterialInterface * Material
)

Set an secondary material for the preview mesh.

Public function

void

 

SetTangentsMode

(
    EDynamicMeshTangentCalcType Tangent...
)

Set the tangents mode for the underlying component, if available.

Public function

void

 

SetTransform

(
    const FTransform & UseTransform
)

Set the transform on the preview mesh

Public function

void

 

SetTriangleColorFunction

(
    TFunction < FColor ...,
    ERenderUpdateMode UpdateMode
)

Set the triangle color function for rendering / render data construction

Public function

void

 

SetVisible

(
    bool bVisible
)

Set visibility state of the preview mesh

Public function

bool

 

TestRayIntersection

(
    const FRay3d & WorldRay
)

Queries Test for ray intersection with the preview mesh.

Public function

TUniquePtr < ...

 

TrackedEditMesh

(
    TFunctionRef < void &,...
)

Apply EditFunc to the internal mesh and update internal data structures as necessary.

Public function

void

 

UpdatePreview

(
    const FDynamicMesh3 * Mesh
)

Update the internal mesh by copying the given Mesh

Overridden from IMeshVertexCommandChangeTarget

Name Description

Public function Virtual

void

 

ApplyChange

(
    const FMeshVertexChange * Chang...,
    bool bRevert
)

Apply/Revert a vertex deformation change to the internal mesh (implements IMeshVertexCommandChangeTarget )

Overridden from IMeshCommandChangeTarget

Name Description

Public function Virtual

void

 

ApplyChange

(
    const FMeshChange * Change,
    bool bRevert
)

Apply/Revert a general mesh change to the internal mesh (implements IMeshCommandChangeTarget )

Overridden from IMeshReplacementCommandChangeTarget

Name Description

Public function Virtual

void

 

ApplyChange

(
    const FMeshReplacementChange * ...,
    bool bRevert
)

Apply/Revert a general mesh change to the internal mesh (implements IMeshReplacementCommandChangeTarget )

Enums

Name

Description

Public enum

ERenderUpdateMode

Render data update hint

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback