TBackgroundModelingComputeSource

[TBackgroundModelingComputeSource](API\Plugins\ModelingOperators\TBackgroundModelingComputeSource) is a container that can be used to repeatedly execute a background computation.

Windows
MacOS
Linux

References

Module

ModelingOperators

Header

/Engine/Plugins/Experimental/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:

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

Name Description

Protected variable

double

 

AccumTime

Protected variable

FAsyncTaskExecu...

 

ActiveBackgroundTask

Public variable

double

 

CancelActiveOpDelaySeconds

Default wait delay for cancel/restart cycle

Protected variable

double

 

LastInvalidateTime

Protected variable

double

 

LastStartTime

Protected variable

OpTypeFactory &...

 

OperatorSource

Protected variable

EBackgroundComp...

 

TaskState

Internal state flag

Constructors

Name Description

Public function

TBackgroundModelingComputeSource

(
    OpTypeFactory* OperatorSourceI...
)

Destructors

Functions

Name Description

Public function

void

 

CancelActiveCompute()

Cancel the active computation immediately and do not start a new one

Public function Const

EBackgroundC...

 

CheckStatus()

Return status of the active background computation.

Public function

TUniquePtr< ...

 

ExtractResult()

Public function Const

double

 

GetElapsedComputeTime()

Public function

void

 

NotifyActiveComputeInvalidated()

Cancel the active computation if one is running, after a delay of CancelActiveOpDelaySeconds.

Protected function

void

 

StartNewCompute()

Public function

void

 

Tick

(
    float DeltaTime
)

Tick the active computation.

Enums

Name

Description

Protected enum

EBackgroundComputeTaskState

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss