Navigation
Unreal Engine C++ API Reference > Plugins > ModelingOperators
References
Module | ModelingOperators |
Header | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingOperators/Public/BackgroundModelingComputeSource.h |
Include | #include "BackgroundModelingComputeSource.h" |
Syntax
template<typename OpType, typename OpTypeFactory>
class TBackgroundModelingComputeSource
Remarks
TBackgroundModelingComputeSource is a container that can be used to repeatedly execute a background computation. The assumption is that this background computation may need to be canceled and restarted, ie if input parameters change due to user input/actions.
Clients of the template must provide an OpType, which is the operation to execute, and a OpTypeFactory, which creates OpType instances on demand. The APIs that must be provided in these types are minimal: OpTypeFactory:
- TUniquePtr
MakeNewOperator() OpType: - void CalculateResult(FProgressCancel*)
The Client cancels the active computation and spawns a new one by calling NotifyActiveComputeInvalidated(). This does not immediately terminate the computation, it waits for a delay of .CancelActiveOpDelaySeconds for this active compute to finish. This both (1) allows for partial updates to appear at UI levels if the compute is fast enough and (2) avoids constantly respawning new computes as the user (for example) drags a slider parameter.
However as a result of this delay the Client must Tick() this class regularly.
CheckStatus() can be used to determine if the computation has finished, in which case a new result is available. ExtractResult() will return this result.
Note that a cancelled computation does not necessarily immediately terminate even after the timeout. This requires that the OpType implementation test the provided ProgressCancel instance frequently. When the Operator is "cancelled" it is moved to a separate task that waits for the owning FAsyncTask to finish and then deletes it (and the contained Operator)
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
double | AccumTime | |
![]() |
FAsyncTaskExecuterWithAbort< TModelingOpTask< OpType > > * | ActiveBackgroundTask | |
![]() |
double | CancelActiveOpDelaySeconds | Default wait delay for cancel/restart cycle |
![]() |
double | LastEndTime | |
![]() |
double | LastInvalidateTime | |
![]() |
double | LastStartTime | |
![]() |
OpTypeFactory * | OperatorSource | |
![]() |
EBackgroundComputeTaskState | TaskState | Internal state flag |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
TBackgroundModelingComputeSource
(
OpTypeFactory* OperatorSourceIn |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | Cancel the active computation immediately and do not start a new one | |
![]() ![]() |
FStatus | CheckStatus () |
Return status of the active background computation. |
![]() |
TUniquePtr< OpType > | ||
![]() ![]() |
double | ||
![]() |
void | Cancel the active computation if one is running, after a delay of CancelActiveOpDelaySeconds. | |
![]() |
void | ||
![]() |
void | Tick
(
float DeltaTime |
Tick the active computation. |
Classes
Type | Name | Description | |
---|---|---|---|
![]() |
FStatus |
Enums
Type | Name | Description | |
---|---|---|---|
![]() |
EBackgroundComputeTaskState |