Visionary Render can automatically generate common scripts using Events. To create an Event, right-click on a node in the tree and select Create > Event from the context menu. A default Key Press Event will be added to your scene as in the image below.
An Event consists of an EventHandler node with a child EventScript node. To edit the script, show the properties of the EventHandler node and click on the Script cell in the Action column. This will open the script in the Script Editor.
Visionary Render provides a drag and drop interface to automatically generate some basic script actions. These are covered in the Visionary Render User Manual.
Guards permit you to set an extra condition to be met before a script is executed. A Guard may be one of the following:
A key on the keyboard (modifiers can be used, e.g. Ctrl, Alt, Shift).
A time value in seconds.
Registers are global variables that can be accessed from your scripts. They appear as an autocomplete list when you type _ into the Script Editor. The following table describes the available registers:
The event node that was triggered (available in all events).
The name of the gesture that was made.
The hand that triggered the event (right hand = true, left hand = false).
right hand = true
left hand = false
The value of the key that was pressed. Tracker buttons start at 1000, mouse buttons start at 2000.
Whether the key in __KeyCode was pressed or released (1 = pressed).
1 = pressed
Event specific node.
The name of the pose that was made.
The state of the pose (entered = true, exited = false).
entered = true
exited = false
The script node containing the code being executed. This is available in all events.
The node that the event node is attached to (e.g. an Assembly). This is available in all events.
The total number of seconds since the application started. This is available in all events.
The time in seconds since the last call to the event.
The user who triggered the event. This is available in all events.
There are various types of event that can trigger a script to execute. The table below lists the available events, and which event-specific registers are set. References to "the node" refer to the node to which the EventHandler is attached. The following types of event can be fired:
Fired when vrActivate is called. The caller of vrActivate can set the value of __Other to whatever is required inside this event. It is also triggered by double clicking on some node types in the tree.
Fired when two objects stop touching each other in the scene. __Self is this object, __Other is the object that it touched. The guard condition can be set to an Assembly to only fire Break events for that Assembly instead of any node in the scene. Note: you’ll need to add a Collision node to __Self for this event to be fired.
Fired when a 3D GUI item receives a full click (i.e. a press followed by a release).
Fired when the node is created, loaded from file, or when the event script is compiled.
Fired when a 3D GUI item receives a double click.
Fired when a fly-to operation arrives at the node.
Fired when a gesture is made that matches one of the recorded ones.
Fired when a key on the keyboard is pressed, or the mouse is clicked, or a tracker button is pressed.
Fired when a key, mouse, or tracker button is released.
Fired when a subsequent fly-to operation flies somewhere else.
Fired when an assembly is moved in the scene.
Fired when a pose is made.
Fired when a pose is left.
Fired when a 3D GUI item is pressed (i.e. the cursor is held down).
Fired when a 3D GUI item is released.
Fired when the node is renamed.
Fired when the sequencer reaches an event frame.
Fired every frame.
Fired when a 3D GUI item toggle state changes.
Fired when two objects touch each other in the scene. __Self is this object, __Other is the object that it touched. The guard condition can be set to an Assembly to only fire Touch events for that Assembly instead of any node in the scene. Note: you’ll need to add a Collision node to __Self for this event to be fired.
Fired when a node is deselected. __Other contains the view selection node containing the selection. Note: selecting in the Scenes or Developer tree will fire this event twice (once for each view, as the selection is synchronised).
Fired when a node is selected. __Other contains the view selection node containing the selection. Note: selecting in the Scenes or Developer tree will fire this event twice (once for each view, as the selection is synchronised).
Execution order is undefined for events that are fired together on the same node. The only exception is that Create events are executed before other types of event.
Using the Script Editor
Creating a Lua Plugin