Chapter 30 Event Utilities

Event utilities, which gate, convert, or sequence node behaviors, are used to build general interactive applications. Here are event utility commands support X3D worlds: BooleanFilter, BooleanSequencer, BooleanToggle, BooleanTrigger, IntegerSequencer, IntegerTrigger, TimeTrigger, Script, and Route. The toolbar buttons shown in figure 1, and menu items in figure 2 are associated with these commands.

toolbar buttons for utilities

Figure 1 The toolbar buttons for creating Event Utility nodes

menu items for utilities

Figure 2 The menu items for creating Event Utility nodes

These utility commands are accessible when editing X3D, Classic VRML, and VRML97 Models, but the first seven commands are not valid for VRML97 Models.

1. BooleanFilter

This command creates a BooleanFilter node. The BooleanFilter toolbar button and the BooleanFilter menu item are associated with this command. In a design environment, it is not necessary to set the node's field values, except the node name.

2. BooleanSequencer

This command creates a BooleanSequencer node. The BooleanSequencer toolbar button and the BooleanSequencer menu item are associated with this command.

To build a sequence, click the keyValuekeyValue field item to bring up the MFField dialog box. See the Tree View chapter for how to edit MFField field values. Figure 3 shows a BooleanSequencer node formed Scene Graph.

BooleanSequencer

Figure 3 A BooleanSequencer node's tree items

3. BooleanToggle

This command creates a BooleanToggle node, which records a boolean value for toggling on/off. The BooleanToggle toolbar button and the BooleanToggle menu item are associated with this command.

To set the toggle field value, click the Toggletoggle tree item to bring up the TRUE-FALSE box.

4. BooleanTrigger

This command creates a BooleanTrigger node. The BooleanTrigger toolbar button and the BooleanTrigger menu item are associated with this command. In a design environment, it is not necessary to set the node's field values, except the node name.

5. IntegerSequencer

This command creates an IntegerSequencer node, which generates sequential SFInt32 events for a single TimeSensor clock. The IntegerSequencer toolbar button and the IntegerSequencer menu item are associated with this command.

To build a sequence, click the keyValuekeyValue tree item to bring up the MFField dialog box. See the Tree View chapter for how to edit MFField field values. Figure 4 shows an IntegerSequencer node formed Scene Graph.

IntegerSequencer

Figure 4 An IntegerSequencer node's tree items

6. IntegerTrigger

This command creates an IntegerTrigger node, which sets an integer value for handling single field Boolean events. The IntegerTrigger toolbar button and the IntegerTrigger menu item are associated with this command.

To set a value for the IntegerTriggerintegerKey field, click the tree leaf item to activate the in-place editor, and input an integer.

7. TimeTrigger

This command creates a TimeTrigger node, which generates time events for X3D applications. The TimeTrigger toolbar button and the TimeTrigger menu item are associated with this command. In a design environment, it is not necessary to set the node's field values, except the node name.

8. Key Normalization

BooleanSequencer, IntegerSequencer, and Interpolator nodes have the key field, which records time based frame values. A function called Key normalization catches and saves these values for the above nodes: a range [t0, t1] and a partition number n. The range can be edited via a Frame Properties item on Options menu. The number n can be either the partition field value or the keyValue dimension, which depends on design contexts.

To activate this command, in Tree View, click the node's tree item, such as integerSequence, to bring up a dialog box , and select the Normalize item.

Normalization

Figure 5 The Normalization dialog box

9. Script

This command creates a Script node, which references programming language code via the field url or contains ECMAScript code. The Script toolbar button and the Script menu item are associated with this command.

Check the URL section in the Tree View chapter for how to edit URL field values.

To write Script code, use Code View.

10. Route

This command creates a ROUTE, which connects two fields and changes the values of one field at runtime. The Route toolbar button and the Route menu item are associated with this command.

In Tree View, a ROUTE node has four items: fromNode, fromField, toNode, and toField. See figure 6 (left).

The fromNode and fromField records input information comes from which node and which field.

The toNode and toFielditem record the output information that is to be sent to which node and which field.

In Tree View, to set these values, follow the steps below.

  1. Set the DEF field of a node if the field is null.
  2. Drag-and-drop a field item of the node to the fromField or tofield item. By this way, the Node name and Field name are automatically renewed.

In the following example, a Transform node is named as "t", a Box is named as "b", our task is: setting b's size to t's translation field for run-time events.

To set the fromNode and fromField values, drag-and-drop the size field item to fromField tree item.

To set the toNode and toField values, drag-and-drop the translation field item to toField tree item.

The following table shows ROUTE tree states.

Route node has Source and To branch a Trnaform node is named as "t" a Box is named as "b" drag-and-drop b's size field to Source drag-and-drop translation to TO

Figure 6 Setting fromField and toFied field values in Tree View

Besides drag-and-drop, this modeler provides selection dialog boxes for the four fields: clicking a leaf tree item brings up a selection box that lists all available node names or node attribute names.