Navigation
API > API/Plugins > API/Plugins/ModelingComponents
TGenericDataBackgroundCompute is an infrastructure object that implements a common UI pattern in interactive 3D tools, where we want to run an expensive parameterized computation (via a TGenericDataOperator) in a background thread so as to not block the UI. If the user changes parameters while the Operator is running, it should be canceled and restarted.
The TGenericDataOperator are provided by the owner via a IGenericDataOperatorFactory implementation. The owner must also Tick() this object regularly to allow results to be extracted from the background thread and appropriate delegates fired when that occurs.
| Name | TGenericDataBackgroundCompute |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/MeshOpPreviewHelpers.h |
| Include Path | #include "MeshOpPreviewHelpers.h" |
Syntax
template<typename ResultDataType>
class TGenericDataBackgroundCompute
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ComputeSourceType | UE::Geometry::TBackgroundModelingComputeSource< OperatorType, FactoryType > | MeshOpPreviewHelpers.h | |
| FactoryType | UE::Geometry::IGenericDataOperatorFactory< ResultDataType > | MeshOpPreviewHelpers.h | |
| FOnOpCompleted | TMulticastDelegate_OneParam< void, const OperatorType * > | Change notification | MeshOpPreviewHelpers.h |
| FOnResultUpdated | TMulticastDelegate_OneParam< void, const TUniquePtr< ResultDataType > & > | MeshOpPreviewHelpers.h | |
| OperatorType | UE::Geometry::TGenericDataOperator< ResultDataType > | MeshOpPreviewHelpers.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnOpCompleted | FOnOpCompleted | OnOpCompleted is fired via Tick() when an Operator finishes, with the operator pointer as argument | MeshOpPreviewHelpers.h | |
| OnResultUpdated | FOnResultUpdated | OnResultUpdated is fired via Tick() when an Operator finishes, with the computed result as argument | MeshOpPreviewHelpers.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Cancel() |
Terminate any active computation without returning anything | MeshOpPreviewHelpers.h | |
float GetElapsedComputeTime() |
MeshOpPreviewHelpers.h | ||
bool HaveValidResult() |
MeshOpPreviewHelpers.h | ||
void InvalidateResult() |
Control flow Request that the current computation be canceled and a new one started | MeshOpPreviewHelpers.h | |
void Setup
(
FactoryType* OpGenerator |
Required calls to setup/update/shutdown this object | MeshOpPreviewHelpers.h | |
TUniquePtr< ResultDataType > Shutdown() |
Terminate any active computation and return the current Result | MeshOpPreviewHelpers.h | |
void Tick
(
float DeltaTime |
Tick the background computation to check for updated results | MeshOpPreviewHelpers.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void UpdateResults() |
Update CurrentResult if a new result is available from BackgroundCompute, and fires relevant signals | MeshOpPreviewHelpers.h |