UModelingSceneSnappingManager

[UModelingSceneSnappingManager](API\Plugins\ModelingComponents\Snapping\UModelingSceneSnappingManager) is an implementation of snapping suitable for use in Modeling Tools/Gizmos (and potentially other places).

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ModelingComponents

Header

/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Snapping/ModelingSceneSnappingManager.h

Include

#include "Snapping/ModelingSceneSnappingManager.h"

Syntax

UCLASS()
class UModelingSceneSnappingManager : public USceneSnappingManager

Remarks

UModelingSceneSnappingManager is an implementation of snapping suitable for use in Modeling Tools/Gizmos (and potentially other places).

Currently Supports:

  • snap to position/rotation grid

  • snap to mesh vertex position

  • snap to mesh edge position

Snapping to mesh vertex/edge positions currently works for Volume (BrushComponent), StaticMeshComponent, and DynamicMeshComponent.

Currently the StaticMesh vertex/edge snapping is dependent on the Physics system, and may fail or return nonsense results in some cases, due to the physics complex-collision mesh deviating from the source-model mesh.

Variables

Name Description

Protected variable

TMap< UPrimitiv...

 

ComponentToActorMap

This map allows us to identify the Components belonging to Actors.

Protected variable

TMap< UPrimitiv...

 

DynamicMeshComponents

Protected variable

FDelegateHandle

 

OnComponentTransformChangedHandle

Protected variable

FDelegateHandle

 

OnObjectModifiedHandler

Protected variable UProperty

TObjectPtr< UIn...

 

ParentContext

Protected variable

const IToolsCon...

 

QueriesAPI

Protected variable

TSharedPtr< UE:...

 

SpatialCache

Cache for objects in the level

Functions

Name Description

Public function Virtual

void

 

BuildSpatialCacheForWorld

(
    UWorld* World,
    TFunctionRef< bool*)> A...,
    TFunctionRef< bool...
)

Explicitly populate the spatial-cache tracking set with specific Actors/Components (alternative to OnActorAdded route)

Protected function Virtual Const

bool

 

ExecuteSceneSnapQueryPosition

(
    const FSceneSnapQueryRequest& Requ...,
    TArray< FSceneSnapQueryResult >& R...
)

Protected function Virtual Const

bool

 

ExecuteSceneSnapQueryRotation

(
    const FSceneSnapQueryRequest& Requ...,
    TArray< FSceneSnapQueryResult >& R...
)

Protected function

void

 

HandleDynamicMeshModifiedDelegate

(
    UDynamicMeshComponent* Compone...
)

Protected function

void

 

HandleGlobalComponentTransformChangedDelegate

(
    USceneComponent* Component
)

Protected function

void

 

HandleGlobalObjectModifiedDelegate

(
    UObject* Object
)

Public function Virtual

void

 

Initialize

Public function Virtual Const

bool

 

IsComponentTypeSupported

(
    const UPrimitiveComponent* Com...
)

API for managing the set of Actors/Components that the snapping system knows about.

Public function Virtual

void

 

OnActorAdded

(
    AActor* Actor,
    TFunctionRef< bool...
)

Enable spatial-cache tracking for the Components of the Actor that pass the PrimitiveFilter

Public function Virtual

void

 

OnActorRemoved

(
    AActor* Actor
)

Disable spatial-cache tracking for any Components of the Actor

Public function Virtual

void

 

OnComponentAdded

(
    UPrimitiveComponent* Component
)

Enable spatial-cache tracking for the Component

Public function Virtual

void

 

OnComponentModified

(
    UActorComponent* Component
)

Notify the internal spatial-cache tracking system that the Component has been modified (ie cache needs to be rebiult)

Public function Virtual

void

 

OnComponentRemoved

(
    UPrimitiveComponent* Component
)

Disable spatial-cache tracking for the Component

Public function Virtual

void

 

Shutdown()

Overridden from USceneSnappingManager

Name Description

Public function Virtual Const

bool

 

ExecuteSceneHitQuery

(
    const FSceneHitQueryRequest& Reque...,
    FSceneHitQueryResult& ResultOut
)

USceneSnappingManager API Try to find a Hit Point in the scene that satisfies the HitQuery Request.

Public function Virtual Const

bool

 

ExecuteSceneSnapQuery

(
    const FSceneSnapQueryRequest& Requ...,
    TArray< FSceneSnapQueryResult >& R...
)

Try to find Snap Targets in the scene that satisfy the Snap Query.