UMeshSculptToolBase

Base Tool for mesh sculpting tools, provides some shared functionality

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MeshModelingToolsExp

Header

/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Public/Sculpting/MeshSculptToolBase.h

Include

#include "Sculpting/MeshSculptToolBase.h"

Syntax

UCLASS()
class UMeshSculptToolBase : public UMeshSurfacePointTool

Remarks

Base Tool for mesh sculpting tools, provides some shared functionality

Variables

Name Description

Protected variable

FFrame3d

 

ActiveBrushTargetPlaneWorld

Brush Target Plane is plane that some brushes move on

Public variable UProperty

TObjectPtr< UMa...

 

ActiveOverrideMaterial

Protected variable

double

 

ActivePressure

Protected variable

double

 

ActiveStrokePathArcLen

Protected variable

double

 

ActiveStrokeTime

For tracking stroke time and length, to apply spacing and flow rate settings

Protected variable

bool

 

bBrushOpPropsVisible

Protected variable

bool

 

bInStroke

Stroke Modifiers

Protected variable

bool

 

bInvert

Protected variable

bool

 

bIsStampPending

Stamps

Protected variable UProperty

bool

 

bIsVolumetricIndicator

Protected variable UProperty

TObjectPtr< UBr...

 

BrushIndicator

Protected variable UProperty

TObjectPtr< UMa...

 

BrushIndicatorMaterial

Protected variable UProperty

TObjectPtr< UPr...

 

BrushIndicatorMesh

Protected variable

TMap< int32, TU...

 

BrushOpFactories

Protected variable UProperty

TMap< int32, TO...

 

BrushOpPropSets

Public variable UProperty

TObjectPtr< USc...

 

BrushProperties

Properties that control brush size/etc

Protected variable

UE::Geometry::F...

 

BrushRelativeSizeRange

Brush Size

Protected variable

bool

 

bSmoothing

Protected variable

FViewCameraStat...

 

CameraState

Protected variable

double

 

CurrentBrushFalloff

Protected variable

double

 

CurrentBrushRadius

Protected variable

FSculptBrushSta...

 

CurrentStamp

Protected variable

UE::Geometry::F...

 

CurTargetTransform

Active transformation on target mesh, includes baked scale

Protected variable

TValueWatcher< ...

 

GizmoPositionWatcher

Public variable UProperty

TObjectPtr< UWo...

 

GizmoProperties

Properties for 3D workplane / gizmo

Protected variable

TValueWatcher< ...

 

GizmoRotationWatcher

Protected variable

FSculptBrushSta...

 

HoverStamp

Protected variable

UE::Geometry::F...

 

InitialTargetTransform

Initial transformation on target mesh

Protected variable

FFrame3d

 

LastBrushFrameLocal

Protected variable

FFrame3d

 

LastBrushFrameWorld

Brush/Stroke stuff

Protected variable

int32

 

LastBrushTriangleID

Protected variable

int

 

LastFlowTimeStamp

Protected variable

int

 

LastSpacingTimestamp

Protected variable

FSculptBrushSta...

 

LastStamp

Protected variable

FRay

 

PendingStampRay

Protected variable

EPendingWorkPla...

 

PendingWorkPlaneUpdate

Public variable UProperty

TObjectPtr< UCo...

 

PlaneTransformGizmo

Plane gizmo

Public variable UProperty

TObjectPtr< UTr...

 

PlaneTransformProxy

Protected variable

TUniquePtr< FMe...

 

PrimaryBrushOp

Protected variable

TSharedPtr< FMe...

 

PrimaryFalloff

Protected variable

UMeshSculptBrus...

 

PrimaryVisiblePropSet

Protected variable

TArray< FBrushT...

 

RegisteredPrimaryBrushTypes

Protected variable

TArray< FFallof...

 

RegisteredPrimaryFalloffTypes

Protected variable

TArray< FBrushT...

 

RegisteredSecondaryBrushTypes

Protected variable

TUniquePtr< FMe...

 

SecondaryBrushOp

Protected variable

TMap< int32, TU...

 

SecondaryBrushOpFactories

Protected variable UProperty

TMap< int32, TO...

 

SecondaryBrushOpPropSets

Protected variable

UMeshSculptBrus...

 

SecondaryVisiblePropSet

Protected variable

FFrame3d

 

StampRegionPlane

Stamp ROI Plane is a plane used by some brush ops

Protected variable

FFrame3d

 

StrokePlane

Stroke plane is a plane used by some brush ops

Protected variable

UWorld *

 

TargetWorld

Public variable UProperty

TObjectPtr< UMe...

 

ViewProperties

Display / Material

Functions

Name Description

Protected function Virtual

void

 

AccumulateStrokeTime

(
    float DeltaTime
)

Protected function

void

 

AlignBrushToView()

Protected function Virtual

void

 

CalculateBrushRadius()

Protected function Virtual

void

 

CommitResult

(
    UBaseDynamicMeshComponent* Com...,
    bool bModifiedTopology
)

Subclass can override this to change what results are written.

Protected function Virtual

FFrame3d

 

ComputeStampRegionPlane

(
    const FFrame3d& StampFrame,
    const TSet< int32 >& StampTriangle...,
    bool bIgnoreDepth,
    bool bViewAligned,
    bool bInvDistFalloff
)

Protected function Virtual

FFrame3d

 

ComputeStampRegionPlane

(
    const FFrame3d& StampFrame,
    const TArray< int32 >& StampTriang...,
    bool bIgnoreDepth,
    bool bViewAligned,
    bool bInvDistFalloff
)

Protected function Virtual

void

 

ConfigureIndicator

(
    bool bVolumetric
)

Public function Virtual

void

 

DecreaseBrushRadiusAction()

Public function Virtual

void

 

DecreaseBrushRadiusSmallStepAction()

Public function Virtual

void

 

DecreaseBrushSpeedAction()

Protected function Virtual

int32

 

FindHitSculptMeshTriangle

(
    const FRay3d& LocalRay
)

Protected function Virtual

int32

 

FindHitTargetMeshTriangle

(
    const FRay3d& LocalRay
)

Protected function Virtual

TUniquePtr< ...

 

GetActiveBrushOp()

Protected function Virtual Const

double

 

GetActivePressure()

Protected function Virtual

FDynamicMesh...

 

GetBaseMesh()

Protected function Virtual Const

const FDynam...

 

GetBaseMesh()

Protected function Const

bool

 

GetBrushCanHitBackFaces()

Protected function Const

const FFrame...

 

GetBrushFrameLocal()

Protected function Const

const FFrame...

 

GetBrushFrameWorld()

Protected function Const

int32

 

GetBrushTriangleID()

Protected function Virtual

double

 

GetCurrentBrushDepth()

Protected function Virtual Const

double

 

GetCurrentBrushFalloff()

Protected function Virtual Const

double

 

GetCurrentBrushRadius()

Protected function Virtual

double

 

GetCurrentBrushStrength()

Protected function Virtual Const

const FFrame...

 

GetCurrentStrokeReferencePlane()

Protected function Virtual Const

bool

 

GetIndicatorVisibility()

Protected function Virtual Const

bool

 

GetInInvertStroke()

Protected function Virtual Const

bool

 

GetInSmoothingStroke()

Protected function Virtual

bool

 

GetIsVolumetricIndicator()

Protected function Const

FRay3d

 

GetLocalRay

(
    const FRay& WorldRay
)

Protected function Virtual Const

const FRay &

 

GetPendingStampRayWorld()

Public function Const

const TArray...

 

GetRegisteredPrimaryBrushTypes()

Public function Const

const TArray...

 

GetRegisteredPrimaryFalloffTypes()

Public function Const

const TArray...

 

GetRegisteredSecondaryBrushTypes()

Protected function Virtual

FDynamicMesh...

 

GetSculptMesh()

Protected function Virtual Const

const FDynam...

 

GetSculptMesh()

Protected function Virtual

UBaseDynamic...

 

GetSculptMeshComponent()

Subclass must implement this and return relevant rendering component

Public function Virtual

void

 

IncreaseBrushRadiusAction()

Public function Virtual

void

 

IncreaseBrushRadiusSmallStepAction()

Public function Virtual

void

 

IncreaseBrushSpeedAction()

Client currently needs to implement these...

Protected function Virtual

void

 

InitializeBrushSizeRange

(
    const UE::Geometry::FAxisAlignedBox...
)

Protected function Virtual

void

 

InitializeIndicator()

Subclasses should call this to create indicator in their Setup()

Protected function

void

 

InitializeSculptMeshComponent

(
    UBaseDynamicMeshComponent* Com...,
    AActor* Actor
)

Subclass calls this to set up editing component

Protected function Virtual Const

bool

 

InStroke()

Protected function Virtual Const

bool

 

IsStampPending()

Protected function Virtual

UPreviewMesh...

 

MakeBrushIndicatorMesh

(
    UObject* Parent,
    UWorld* World
)

Called by InitializeIndicator to create a mesh for the brush ROI indicator. Default is sphere.

Public function Virtual

void

 

NextBrushModeAction()

Protected function Virtual

void

 

OnBeginStroke

(
    const FRay& WorldRay
)

Protected function Virtual

void

 

OnCompleteSetup()

Protected function Virtual

void

 

OnEndStroke()

Protected function Virtual

void

 

PlaneTransformChanged

(
    UTransformProxy* Proxy,
    FTransform Transform
)

Public function Virtual

void

 

PreviousBrushModeAction()

Protected function

void

 

RegisterBrushType

(
    int32 Identifier,
    FText Name,
    TUniquePtr< FMeshSculptBrushOpFacto...,
    UMeshSculptBrushOpProps* PropS...
)

Protected function

void

 

RegisterSecondaryBrushType

(
    int32 Identifier,
    FText Name,
    TUniquePtr< FMeshSculptBrushOpFacto...,
    UMeshSculptBrushOpProps* PropS...
)

Protected function

void

 

RegisterStandardFalloffTypes()

Protected function Virtual

void

 

ResetStrokeTime()

Protected function Virtual

void

 

RestoreAllBrushTypeProperties

(
    UInteractiveTool* RestoreToToo...
)

Protected function Virtual

void

 

SaveActiveStrokeModifiers()

Protected function Virtual

void

 

SaveAllBrushTypeProperties

(
    UInteractiveTool* SaveFromTool
)

Protected function

void

 

SetActivePrimaryBrushType

(
    int32 Identifier
)

Protected function

void

 

SetActiveSecondaryBrushType

(
    int32 Identifier
)

Protected function

void

 

SetBrushOpPropsVisibility

(
    bool bVisible
)

Protected function Virtual

void

 

SetFixedSculptPlaneFromWorldPos

(
    const FVector& Position,
    const FVector& Normal,
    EPendingWorkPlaneUpdate UpdateType
)

Protected function Virtual

void

 

SetIndicatorVisibility

(
    bool bVisible
)

Public function Virtual

void

 

SetPrimaryFalloffType

(
    EMeshSculptFalloffType Falloff
)

Set the active falloff type for the primary brush

Protected function Virtual

void

 

SetViewPropertiesEnabled

(
    bool bNewValue
)

Public function Virtual

void

 

SetWorld

(
    UWorld* World
)

Protected function Virtual Const

bool

 

ShowWorkPlane()

Protected function

void

 

UpdateBrushFrameWorld

(
    const FVector3d& NewPosition,
    const FVector3d& NewNormal
)

Protected function Virtual

bool

 

UpdateBrushPositionOnActivePlane

(
    const FRay& WorldRay
)

Protected function Virtual

bool

 

UpdateBrushPositionOnSculptMesh

(
    const FRay& WorldRay,
    bool bFallbackToViewPlane
)

Protected function Virtual

bool

 

UpdateBrushPositionOnTargetMesh

(
    const FRay& WorldRay,
    bool bFallbackToViewPlane
)

Protected function Virtual

void

 

UpdateBrushTargetPlaneFromHit

(
    const FRay& WorldRay,
    const FHitResult& Hit
)

Protected function Virtual

void

 

UpdateColorSetting

(
    FLinearColor NewColor
)

Protected function Virtual

void

 

UpdateCustomMaterial

Protected function Virtual

void

 

UpdateFixedPlaneGizmoVisibility

(
    bool bVisible
)

Protected function Virtual

void

 

UpdateFixedSculptPlanePosition

(
    const FVector& Position
)

Protected function Virtual

void

 

UpdateFixedSculptPlaneRotation

(
    const FQuat& Rotation
)

Protected function Virtual

void

 

UpdateFlatShadingSetting

(
    bool bNewValue
)

Protected function Virtual

void

 

UpdateGizmoFromProperties()

Protected function Virtual

void

 

UpdateHoverStamp

(
    const FFrame3d& StampFrame
)

Protected function Virtual

void

 

UpdateImageSetting

(
    UTexture2D* NewImage
)

Protected function Virtual

void

 

UpdateMaterialMode

(
    EMeshEditingMaterialModes NewMode
)

Protected function Virtual

void

 

UpdateOpacitySetting

(
    double Opacity
)

Protected function Virtual

void

 

UpdateStampPendingState()

When in a stroke, this function determines when a new stamp should be emitted, based on spacing and flow rate settings

Protected function Virtual

void

 

UpdateStrokeReferencePlaneForROI

(
    const FFrame3d& StampFrame,
    const TArray< int32 >& TriangleROI,
    bool bViewAligned
)

Protected function Virtual

void

 

UpdateStrokeReferencePlaneFromWorkPlane()

Protected function Virtual

void

 

UpdateTransparentColorSetting

(
    FLinearColor NewColor
)

Protected function Virtual

void

 

UpdateTwoSidedSetting

(
    bool bOn
)

Protected function Virtual

void

 

UpdateWireframeVisibility

(
    bool bNewValue
)

Protected function Virtual

void

 

UpdateWorkPlane()

Overridden from UMeshSurfacePointTool

Name Description

Public function Virtual

bool

 

HitTest

(
    const FRay& Ray,
    FHitResult& OutHit
)

UMeshSurfacePointTool API.

Public function Virtual

void

 

OnBeginDrag

(
    const FRay& Ray
)

This function is called when the user begins a click-drag-release interaction

Public function Virtual

void

 

OnEndDrag

(
    const FRay& Ray
)

This function is called when the user releases the button driving a click-drag-release interaction

Public function Virtual

void

 

OnUpdateDrag

(
    const FRay& Ray
)

This function is called each frame that the user is in a click-drag-release interaction

Overridden from UInteractiveTool

Name Description

Protected function Virtual

void

 

OnTick

(
    float DeltaTime
)

Action support/system

Public function Virtual

void

 

RegisterActions

(
    FInteractiveToolActionSet& ActionS...
)

Override this function to register the set of Actions this Tool supports, using FInteractiveToolActionSet::RegisterAction.

Public function Virtual

void

 

Render

(
    IToolsContextRenderAPI* Render...
)

Allow the Tool to do any custom drawing (ie via PDI/RHI)

Public function Virtual

void

 

Setup()

Register InputBehaviors, etc

Public function Virtual

void

 

Shutdown

(
    EToolShutdownType ShutdownType
)

Called by ToolManager to shut down the Tool

Classes

Name

Description

Public struct

FBrushTypeInfo

Brush Types

Public struct

FFalloffTypeInfo

Falloff types

Enums

Name

Description

Protected enum

EPendingWorkPlaneUpdate

Typedefs

Name

Description

FFrame3d

FTransform3d