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

<vizact>.onPathEvent

Registers a function to handle animation path events

<vizact>.onPathEvent(  
path  
name  
func  
*args  
)  
path
Animation path object
name
Name of animation path event
func
The function to call when the path event is triggered
*args
Arguments to pass to the function

Remarks

When the specified event name is triggered on the animation path, the given function will be called.

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

# Create event when end of path is reached
path.addEventAtEnd('end')

# Register callback when end is reached
def onEndReached():
    print('end reached')
vizact.onPathEvent(path, 'end', onEndReached)

See also

<animationpath>.addEventAtControlPoint
<animationpath>.addEventAtDistance
<animationpath>.addEventAtEnd
<animationpath>.addEventAtTime
<animationpath>.clearEvents
<animationpath>.removeEvent
<viztask>.waitPathEvent
viz.PATH_EVENT