SM_Promise Class Reference

The SM_Promise class can be used to unblock the ScriptModule and allow other nodes to render by promising a CEL via a callback function when it is complete. The job will wait until the watchPath is available (a new file on disk). Once this path has been created, the completeFunction is called and the cel can be set. Note, the complete function must be thread-safe and not access any data from the scene – it should only be used to set the cel. More...

Public Slots

void set (const String &watchPath, int timeout, QScriptValue completeFunction, QScriptValue timeoutFunction)
 
void reset ()
 
const String & getWatchPath () const
 The path to the cel that is promised as a result to the script module. More...
 
int getTimeout () const
 The timeout – at which point the timeout function will be called. More...
 
QScriptValue getTimeoutFunction () const
 
QScriptValue getCompleteFunction () const
 
bool getPromiseSet () const
 
void promiseFinished ()
 Reset the promise. More...
 

Properties

String watchPath
 The data file that will be watched. Once its available, the cel will be loaded. More...
 
int timeout
 Timeout. More...
 

Detailed Description

The SM_Promise class can be used to unblock the ScriptModule and allow other nodes to render by promising a CEL via a callback function when it is complete. The job will wait until the watchPath is available (a new file on disk). Once this path has been created, the completeFunction is called and the cel can be set. Note, the complete function must be thread-safe and not access any data from the scene – it should only be used to set the cel.

The timeout function is called when the render times out (based on the supplied timeout argument), and is called with a boolean argument identifying if it has cancelled by the application. Ie: function timeOut( cancelled ){...}

Member Function Documentation

◆ getCompleteFunction

QScriptValue SM_Promise::getCompleteFunction ( ) const
slot

◆ getPromiseSet

bool SM_Promise::getPromiseSet ( ) const
inlineslot

◆ getTimeout

int SM_Promise::getTimeout ( ) const
slot

The timeout – at which point the timeout function will be called.

◆ getTimeoutFunction

QScriptValue SM_Promise::getTimeoutFunction ( ) const
slot

◆ getWatchPath

const String& SM_Promise::getWatchPath ( ) const
slot

The path to the cel that is promised as a result to the script module.

◆ promiseFinished

void SM_Promise::promiseFinished ( )
slot

Reset the promise.

◆ reset

void SM_Promise::reset ( )
slot

◆ set

void SM_Promise::set ( const String &  watchPath,
int  timeout,
QScriptValue  completeFunction,
QScriptValue  timeoutFunction 
)
slot

Property Documentation

◆ timeout

int SM_Promise::timeout
read

Timeout.

◆ watchPath

String SM_Promise::watchPath
read

The data file that will be watched. Once its available, the cel will be loaded.