Vizard 8 » Command Index » Vizard modules » vizact » <vizact>.onAsyncLoad
8.0

<vizact>.onAsyncLoad

Registers a function to handle async load events

<vizact>.onAsyncLoad(  
object  
func  
*args  
)  
object
The object that is being asynchronously loaded
func
The function to call when the object has finished asynchronously loading
*args
Arguments to pass to the function

Remarks

When the specified object has finished loading asynchronously, the given function will be called. The first argument passed to the callback func is the viz.ASYNC_EVENT event object.

Return Value

A vizact.EventFunction object with the following methods:

Method

Description

<event>.setEnabled(val)

Enable/Disable the event function. The associated function will not be called while the event function is disabled. viz.TOGGLE can be used to toggle the state. Event functions are initially enabled.

<event>.getEnabled()

Get the enabled state of the event function.

<event>.remove()

Permanently unregister the event function.

Example

model = viz.addChild('piazza.osgb',flags=viz.LOAD_ASYNC)

def onModelLoad(e):
    if e.status == viz.ASYNC_SUCCESS:
        print('Model loaded')
vizact.onAsyncLoad(model, onModelLoad)

See also

<viz>.addChild
<viz>.addAvatar
<viz>.addChildFromBuffer
<viz>.addTexture
<viz>.addTextureFromBuffer
<texture>.load
<texture>.loadBuffer
<texture>.getAsyncStatus
<node3d>.getAsyncStatus
<viztask>.waitAsyncLoad