The following page contains a description of all the core Vizard events. Here is an overview of the available events:
Event code |
Description |
A key is pressed |
|
A key is released |
|
A keyboard character as been entered |
|
A mouse button is pressed |
|
A mouse button is released |
|
The mouse wheel is scrolled |
|
The mouse has moved |
|
A mouse button is double clicked |
|
The graphics window is initialized |
|
The program is exiting |
|
A timer has expired |
|
A GUI object has changed state |
|
A GUI slider has been dragged |
|
A key was pressed in a GUI textbox |
|
A GUI droplist selection has changed |
|
The viewpoint has collided into an object |
|
Called every frame |
|
Received a network message |
|
Graphics window has been resized |
|
Avatar animation has completed |
|
A frame has rendered to the display |
|
Two physics objects have collided |
|
Two physics objects have finished colliding |
|
An action has started executing |
|
An action has finished executing |
|
An action pool has run out of actions |
|
Special events for audio/video objects |
|
Sensor button has been pressed |
|
Sensor button has been released |
|
viz.ASYNC_EVENT | An async operation has completed |
viz.PATH_EVENT | An animation path event has been triggered |
This event is generated when a key is pressed. If the key is held down, multiple keydown events will be generated. The viz.getInputTime() command can be used with key down events.
key
The character or code of the key that was pressed. Click here for a list of keyboard codes.
This event is generated when a key is released. The viz.getInputTime() command can be used with key up events.
key
The character or code of the key that was released. Click here for a list of keyboard codes.
This event is generated when a displayable character is entered through the keyboard. The viz.getInputTime() command can be used with key character events.
This event provides a single event structure e with the following attributes:
e.char
A unicode string containing the single character that was entered.
e.time
The input time of the event. Same as the value returned by viz.getInputTime().
This event is generated when a mouse button is pressed. The viz.getInputTime() command can be used with mouse down events.
button
The mouse button that was pressed. Can be one of the following mouse button codes:
Mouse buttons |
viz.MOUSEBUTTON_LEFT |
viz.MOUSEBUTTON_MIDDLE |
viz.MOUSEBUTTON_RIGHT |
This event is generated when a mouse button is released. The viz.getInputTime() command can be used with mouse up events.
button
The mouse button that was released. Can be one of the following mouse button codes:
Mouse buttons |
viz.MOUSEBUTTON_LEFT |
viz.MOUSEBUTTON_MIDDLE |
viz.MOUSEBUTTON_RIGHT |
This event is generated when a mouse wheel is scrolled. The viz.getInputTime() command can be used with mouse wheel events.
dir
The direction the mouse wheel was scrolled. A value greater than zero indicates the mouse wheel was scrolled upwards. A value less than zero indicates the mouse wheel was scrolled downwards.
This event is generated when the mouse is moved. The viz.getInputTime() command can be used with mouse move events. The event provides the absolute position of the mouse normalized to the graphics window and the relative movement of the mouse. The absolute position is not updated when the mouse leaves the graphics window, however the event will still be generated in order to provide the relative movement.
This event provides a single event structure e with the following attributes:
e.x
The absolute X position of the mouse relative to the left side of the graphics window. The value is in the range [0,1].
e.y
The absolute Y position of the mouse relative to the bottom of the graphics window. The value is in the range [0,1].
e.dx
The relative movement of the mouse in the X direction. The value is in raw mouse units. Negative values indicate the mouse was moved to the left. Positive values indicate the mouse was moved to the right.
e.dy
The relative movement of the mouse in the Y direction. The value is in raw mouse units. Negative values indicate the mouse was moved downward. Positive values indicate the mouse was moved upward.
This event is generated when a mouse button is double clicked. The viz.getInputTime() command can be used with double click events.
This event provides a single event structure e with the following attributes:
e.button
The mouse button that was double clicked. Can be one of the following mouse button codes:
Mouse buttons |
viz.MOUSEBUTTON_LEFT |
viz.MOUSEBUTTON_MIDDLE |
viz.MOUSEBUTTON_RIGHT |
This event is generated when the graphics window is initialized (i.e. after viz.go() is called).
None
This event is generated when the simulation exits.
None
This event is generated when a timer expires. The viz.elapsed() command can be used with timer events.
num
The timer number that expired.
This event is generated when a GUI button has changed state. This event is also used by other GUI objects to signal state changes.
obj
The node3d object that has changed state.
state
The new state of the object. Can be one of the following values:
Button States |
|
viz.DOWN |
Signals one of the following:
|
viz.UP |
Signals one of the following:
|
This event is generated when the value of GUI slider or progress bar has been changed by the user. This event is NOT generated if the value is manually modified through code.
obj
The slider or progress bar object that has changed value.
pos
The new value of the slider. The value is in the range [0,1].
This event is generated when a key has been pressed inside a GUI textbox. This event will be generated even if the actual text was not modified.
This event provides a single event structure e with the following attributes:
e.object
The textbox object generating the event.
e.oldText
The textbox value before the key was pressed.
e.newText
The textbox value after the key was pressed.
e.key
The character or code of the key that was pressed. Click here for a list of keyboard codes.
This event is generated when the selected item of a GUI droplist or tab group has changed.
This event provides a single event structure e with the following attributes:
e.object
The object generating the event.
e.oldSel
The zero-based index of the previously selected item.
e.newSel
The zero-based index of the newly selected item.
This event is generated when the viewpoint collides with an object. Viewpoint collision must be enabled for the event to be generated.
info
An intersect info object containing details of the collision. The object has the following attributes:
Attribute name |
Description |
object |
node3d object the viewpoint collided with |
point |
[x,y,z] position of collision |
normal |
[x,y,z] normal vector of collision point |
name |
Name of sub-node involved in collision |
This event is generated during the update cycle of every frame. The viz.elapsed() command can be used with update events.
This event provides a single event structure e with the following attributes:
e.elapsed
The elapsed time (in seconds) since the last frame. Same as the value returned by viz.getFrameElapsed()
e.frame
The frame number of the new frame. Same as the value returned by viz.getFrameNumber()
e.time
The start time of the new frame (in seconds) relative to the start of the main graphics loop. Same as the value returned by viz.getFrameTime()
This event is generated when Vizard receives a network message.
This event provides a single event structure e. It can be either a viz.NetworkEvent or viz.RawNetworkEvent object.
A viz.NetworkEvent object will be passed to the callback function if the data received was encoded using the Python pickle module. This applies to data that was:
The event stucture e has the following attributes:
Event attribute |
Description |
sender |
The name of the computer that sent the message. |
address |
The IP address of the computer that sent the message. |
port |
The port number the message was received on. |
data |
A tuple containing the positional data specified through the *args parameter. |
<keyword> |
The value of the specified keyword argument from the **kwargs parameter. |
A viz.RawNetworkEvent object will be passed to the callback function when a raw byte network packet is received. This is useful for receiving data from non-Python based applications. The event stucture e has the following attributes:
Event attribute |
Description |
address |
The IP address of the computer that sent the message. |
port |
The port number the message was received on. |
raw_data |
The raw byte data that was received, as a Python bytes object. |
This event is generated when the Vizard graphics window is resized. This event will be triggered before the first frame is rendered and when the window is resized manually through code.
This event provides a single event structure e with the following attributes:
e.width
The new width of the graphics window.
e.height
The new height of the graphics window.
This event is generated when an avatar finishes executing an animation.
This event provides a single event structure e with the following attributes:
e.object
The avatar object generating the event.
e.animation
The animation number that has finished executing.
e.userTriggered
Indicates whether the user triggered the end of the animation manually through code (i.e. the <node3d:avatar>.stopAction() command) . Can be either True or False.
This event is generated when a frame has finished being rendered and has been displayed on screen. When a user registers a callback for this event, Vizard will block at the end of the frame until the frame buffer has been copied to the screen.
This event provides a single event structure e with the following attributes:
e.time
The time of the frame display. The time value is relative to the viz.tick() command.
This event is generated when two physics objects collide. To be notified of physics collisions you need to first enable the viz.COLLIDE_NOTIFY flag on the node. If two objects that have collision notification enabled collide, two separate events will be generated.
This event provides a single event structure e with the following attributes:
e.obj1
The first object in the collision. This is the object which has collision notification enabled.
e.obj2
The second object in the collision.
e.pos
The [x,y,z] position of the collision point.
e.normal
The [x,y,z] normal vector of the collision point.
This event is generated when two physics objects finish colliding. To be notified of physics collisions you need to first enable the viz.COLLIDE_NOTIFY flag on the node. If two objects that have collision notification enabled collide, two separate events will be generated.
This event provides a single event structure e with the following attributes:
e.obj1
The first object in the collision. This is the object which has collision notification enabled.
e.obj2
The second object in the collision.
This event is generated when an action has started on an object.
This event provides a single event structure e with the following attributes:
e.object
The object generating the event.
e.action
The action object that has started executing. An instance of viz.ActionData.
e.pool
The pool number the action has started on.
e.instance
The viz.ActionClass instance of the action object.
This event is generated when an action is completed on an object. The event will occur even if the action is manually completed by the user through code (i.e. the <node3d>.endAction() command).
This event provides a single event structure e with the following attributes:
e.object
The object generating the event.
e.action
The action object that has finished completing. An instance of viz.ActionData.
e.pool
The pool number the action has completed on.
e.instance
The viz.ActionClass instance of the action object.
This event is generated when an action pool runs out of actions to execute.
This event provides a single event structure e with the following attributes:
e.object
The object generating the event.
e.pool
The pool number that has run out of actions.
This event is generated when a media object enters certain states.
This event provides a single event structure e with the following attributes:
e.object
The media object generating the event.
e.event
The event that occurred on the media object. Can be one of the following values:
Event code |
Description |
viz.MEDIA_END |
The media object has reached the end |
This event is generated when a sensor button is pressed.
This event provides a single event structure e with the following attributes:
e.object
The extension sensor object generating the event.
e.button
ID of the sensor button that was pressed.
This event is generated when a sensor button is released.
This event provides a single event structure e with the following attributes:
e.object
The extension sensor object generating the event.
e.button
ID of the sensor button that was released.
This event is generated when an async operation has completed.
This event provides a single event structure e with the following attributes:
e.object
The object generating the event.
e.status
The status of the async operation ( viz.ASYNC_SUCCESS or viz.ASYNC_FAIL ).
This event is generated when a user specific animation path event has been triggered.
This event provides a single event structure e with the following attributes:
e.object
The animation path object generating the event
e.name
The user specified name of the event trigger
e.time
The time within the path the event was scheduled to trigger