Navigation
API > API/Plugins > API/Plugins/ModelingComponents
UBaseMeshProcessingTool is a base Tool (ie has no functionality of it's own and must be subclassed) that provides the following structure:
- a Background-Compute-With-Preview Temp Actor/Component is created based on the input mesh
- The Subclass provides FDynamicMeshOperator instances (via IDynamicMeshOperatorFactory) that process/modify and update this Preview
- PropertySets with custom visibility can be registered, and on change will invalidate the current computation
Optional support for a WeightMap property set and tracking of active weight map can be enabled by calling AddWeightMapPropertySet(), GetActiveWeightMap() will then return the active WeightMap, and changes to the WeightMap selection will invalidate the computation.
Most subclasses will only need to define their PropertySets and implement MakeNewOperator(), see eg SmoothMeshTool for a minimal example
Other functions:
- GetInitialMesh() : return reference to copy of initial mesh, used to initialize FDynamicMeshOperator
- GetUPreviewMesh() : return the UPreviewMesh inside the background compute (for configuration/etc - should not directly touch the mesh!)
- GetPreviewTransform() : return active FTransform on the Preview mesh, should be passed to FDynamicMeshOperator unless it is outputting world position
- InvalidateResult() : subclasses call this to notify the base class that current result/computation has been invalidated
The Base tool will do various optional precomputations or changes to the input mesh, which can be configured by overriding various functions below.
RequiresInitialVtxNormals() : return true (default=false) to calculate per-vertex normals on the input mesh, returned by GetInitialVtxNormals()
RequiresInitialBoundaryLoops() : return true (default=false) to calculate boundary loops on the input mesh, returned by GetInitialBoundaryLoops()
RequiresScaleNormalization() : return true (default=true) to apply an initial scale to the input mesh so that it has consistent size before being sent into the computation. Scaling factor (eg for scaling UI constants) can be accessed via GetScaleNormalizationFactor()
| Name | UBaseMeshProcessingTool |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/BaseTools/BaseMeshProcessingTool.h |
| Include Path | #include "BaseTools/BaseMeshProcessingTool.h" |
Syntax
UCLASS (MinimalAPI)
class UBaseMeshProcessingTool :
public USingleTargetWithSelectionTool ,
public UE::Geometry::IDynamicMeshOperatorFactory
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UInteractiveTool → USingleSelectionTool → USingleTargetWithSelectionTool → UBaseMeshProcessingTool
Implements Interfaces
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UBaseMeshProcessingTool() |
BaseTools/BaseMeshProcessingTool.h |
Structs
| Name | Remarks |
|---|---|
| FOptionalPropertySet |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FFrame3d | UE::Geometry::FFrame3d | BaseTools/BaseMeshProcessingTool.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActiveWeightMap | TSharedPtr< FIndexedWeightMap1f > | BaseTools/BaseMeshProcessingTool.h | ||
| bIsScaleNormalizationApplied | bool | Scale/translate applied to input mesh to regularize it | BaseTools/BaseMeshProcessingTool.h | |
| bResultValid | bool | BaseTools/BaseMeshProcessingTool.h | ||
| InitialBoundaryLoops | TSharedPtr< FMeshBoundaryLoops > | BaseTools/BaseMeshProcessingTool.h | ||
| InitialMesh | FDynamicMesh3 | Initial data, used to initialize background compute / etc | BaseTools/BaseMeshProcessingTool.h | |
| InitialVtxNormals | TSharedPtr< FMeshNormals > | BaseTools/BaseMeshProcessingTool.h | ||
| OverrideTransform | FTransform | Transform that does the opposite of scale/translate so that mesh stays in the right spot on screen | BaseTools/BaseMeshProcessingTool.h | |
| SrcScale | double | BaseTools/BaseMeshProcessingTool.h | ||
| SrcTranslate | FVector3d | BaseTools/BaseMeshProcessingTool.h | ||
| WeightMapPropertySet | TWeakObjectPtr< UWeightMapSetProperties > | BaseTools/BaseMeshProcessingTool.h | ||
| WeightMapPropertySetVisibleFunc | TUniqueFunction< bool()> | BaseTools/BaseMeshProcessingTool.h |
Functions
Public
Overridden from UInteractiveTool
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool CanAccept() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual bool HasAccept() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual bool HasCancel() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void OnTick
(
float DeltaTime |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void Render
(
IToolsContextRenderAPI* RenderAPI |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void Setup() |
InteractiveTool API - generally does not need to be modified by subclasses | BaseTools/BaseMeshProcessingTool.h | |
virtual void Shutdown
(
EToolShutdownType ShutdownType |
BaseTools/BaseMeshProcessingTool.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddOptionalPropertySet
(
UInteractiveToolPropertySet* PropSet, |
BaseTools/BaseMeshProcessingTool.h | ||
PropSetType * AddOptionalPropertySet
(
TUniqueFunction< bool()> VisibilityFunc, |
Register an optional property set with the given VisibilityFunc, and call OnModifiedFunc if any of the properties change | BaseTools/BaseMeshProcessingTool.h | |
PropSetType * AddOptionalPropertySet
(
TUniqueFunction< bool()> VisibilityFunc, |
Optional Property Set API - subclasses can use this to manage property sets with configurable visibility that invalidate the precompute Register an optional property set with the given VisibilityFunc | BaseTools/BaseMeshProcessingTool.h | |
PropSetType * AddWeightMapPropertySet
(
TUniqueFunction< bool()> VisibilityFunc |
Optional weight map support Weight map will only be enabled if base class registers a weight map property set | BaseTools/BaseMeshProcessingTool.h | |
virtual FText GetAcceptTransactionName() |
BaseTools/BaseMeshProcessingTool.h | ||
TSharedPtr< FIndexedWeightMap1f > & GetActiveWeightMap() |
BaseTools/BaseMeshProcessingTool.h | ||
TSharedPtr< FMeshBoundaryLoops > & GetInitialBoundaryLoops() |
BaseTools/BaseMeshProcessingTool.h | ||
const FDynamicMesh3 & GetInitialMesh () |
BaseTools/BaseMeshProcessingTool.h | ||
FDynamicMesh3 & GetInitialMesh () |
BaseTools/BaseMeshProcessingTool.h | ||
TSharedPtr< FMeshNormals > & GetInitialVtxNormals() |
BaseTools/BaseMeshProcessingTool.h | ||
const FTransform & GetPreviewTransform() |
BaseTools/BaseMeshProcessingTool.h | ||
double GetScaleNormalizationFactor() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual FText GetToolMessageString() |
UBaseMeshProcessingTool OPTIONAL API - subclasses may implement these functions | BaseTools/BaseMeshProcessingTool.h | |
UPreviewMesh * GetUPreviewMesh() |
BaseTools/BaseMeshProcessingTool.h | ||
bool HasActiveWeightMap() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual bool HasMeshTopologyChanged() |
Called when Tool is Accepted to determine whether it is safe to only update vertex positions, or if entire target mesh must be replaced. | BaseTools/BaseMeshProcessingTool.h | |
virtual void InitializeProperties() |
This function is called during Setup() to allow subclass to register property sets, before kicking off initial computation | BaseTools/BaseMeshProcessingTool.h | |
virtual void InvalidateResult() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void OnOptionalPropSetModified
(
int32 Index |
BaseTools/BaseMeshProcessingTool.h | ||
virtual bool RequiresInitialBoundaryLoops () |
Optional base mesh boundary loops. | BaseTools/BaseMeshProcessingTool.h | |
virtual bool RequiresInitialVtxNormals () |
Optional base mesh per-vertex normals. | BaseTools/BaseMeshProcessingTool.h | |
virtual bool RequiresScaleNormalization () |
Optional uniform scale applied to mesh. | BaseTools/BaseMeshProcessingTool.h | |
virtual void SavePropertySets() |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void SetupWeightMapPropertySet
(
UWeightMapSetProperties* Properties |
BaseTools/BaseMeshProcessingTool.h | ||
virtual void UpdateOptionalPropertyVisibility() |
Call this function to update optional property sets visibility. Should call base implementation | BaseTools/BaseMeshProcessingTool.h | |
virtual void UpdateResult() |
BaseTools/BaseMeshProcessingTool.h |
Overridden from USingleTargetWithSelectionTool
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnShutdown
(
EToolShutdownType ShutdownType |
This function is called during Shutdown so that subclass may perform final processing and save property sets | BaseTools/BaseMeshProcessingTool.h |
Overridden from IDynamicMeshOperatorFactory
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TUniquePtr< UE::Geometry::FDynamicMeshOperator > MakeNewOperator() |
UBaseMeshProcessingTool REQUIRED API - subclasses must implement these functions IDynamicMeshOperatorFactory implementation that subclass must override and implement | BaseTools/BaseMeshProcessingTool.h |