
Note: This syntax will probably change somewhat in future releases of Pueblo to make
it more consistent. The old syntax will be supported.
<img xch_graph="event nodeName fieldType eventName args" xch_graph_vrml="vrml code">
xch_graph
| nodeName
| is any node named by the DEF keyword. It may also may be a period-delimited
qualified name, such as MySeparator.MyRotation
|
| fieldType
| is the VRML type of the field to change. Currently supported are SFRotation,
SFLong, SFVec3f, and SFNode. This must correspond to the correct field type of
the field to be changed. See the VRML spec for descriptions of the SFRotation,
SFLong, and SFVec3f field types. Type SFNode corresponds to a single node, and
is specified by either name (for an existing node to be operated upon) or VRML
code (for a new node to be added).
|
| eventName
| name of the event to send. This is usually the name of the field to change,
prepended by “set_”.
|
| args
| arguments to the field change event.
|
| vrml code
| is actual VRML code to be used in the event. Do not precede it with the
standard VRML 1.0 header, this is assumed. This code is compiled and then used by the
event, such as adding it as a child node. It must compile to one top-level
node. That node may have any number of children, of course.
To use embedded double quotes, such as those around SFString fields, use HTML entities for the quotation marks, either ‘"’ or ‘"’. Note: You should keep this code as short as possible through the use of WWWInline nodes. There is a limit of 4,000 characters for each HTML tag. |
|
|
|
| Event Name
| Node Types
Affected | Event Type
| Field Affected &
(comments) | Arguments
|
| add_children
| Separator
Group Switch | SFNode
| (add a child)
| No args; VRML code should be supplied as the argument to xch_graph_vrml. See
the note below regarding the types of nodes which can be added.
|
| remove_children
| Separator
Group Switch | SFNode
| (remove a child)
| Name of child to remove. See the note below regarding the types of nodes
which can be added.
|
| set_center
| Transform
| SFVec3f
| center
| new center vector
|
| set_rotation
| Transform
Rotation SpinGroup | SFRotation
| rotation
| new rotation, as four floats:
xAxis, yAxis, zAxis, angle |
| set_scaleFactor
| Transform
Scale | SFVec3f
| scaleFactor
| new scale vector
|
| set_scaleOrientation
| Transform
| SFRotation
| scaleOrientation
| new orientation rotation
|
| set_translation
| Transform
Translation | SFVec3f
| translation
| new translation vector
|
| set_whichChild
| Switch
| SFLong
| whichChild
(to select a child of the switch) | number of child, zero-based
|
|
|
|
|
|
|
| Background
| BaseColor
| Environment
| Group
|
| Coordinate3
| Info
| FontStyle
| Material
|
| MaterialBinding
| MatrixTransform
| Normal
| NormalBinding
|
| Rotation
| Scale
| ShapeHints
| Texture2
|
| Texture2Transform
| TextureCoordinate2
| Transform
| Translation
|
Examples
The following code loads a 2-dimensional JPEG image into the graphics pane:
<img xch_graph=load href="http://www.chaco.com/~coyote/graf/smronny.jpg">
This example loads a 3-dimensional scene into the graphics pane:
<img xch_graph=load href="http://bradley.bradley.edu/~dware/mystars.wrl">
This example sets the current viewpoint to camera #1. It assumes the standard VRML convention that there is a Switch node called Cameras. (Note that not all VRML files have such a node.)
<img xch_graph="event Cameras SFLong set_whichChild 1">
The following adds a VRML node to a Separator node. By placing a Transform inside the new Separator, we’ve made it possible to manipulate the location of the contents of the WWWInline later. Fetching of the WWWInline will start immediately after adding this new sub-tree to the VRML scene.
<img xch_graph="event MyRoot SFNode add_children" xch_graph_vrml="DEF MyGreenCylinder Separator{DEF MyTransform Transform {} WWWInline {name mycylinder.wrl} AsciiText { string "It's Ralph" } }">
The following changes the rotation affecting the WWWInline child added above.
<img xch_graph="event MyRoot.MyGreenCylinder.MyTransform SFRotation set_rotation 0. 1. 1. 1.">
To send multiple lines of VRML in one "add_children" event, use HTML "encodings". The HTML encoding for a linefeed is " ", so to send the following VRML code on multiple lines, you would use a construct like this:
<img xch_graph="event AvatarRoot SFNode add_children" xch_graph_vrml="DEF MyGreenCylinder Separator {
WWWInline { name m1red.wrl.gz } }" >
Note that you may want to use xch_mode=purehtml for these multiple line VRML code fragments. See the xch_mode documentation for more information.
Also see
event
xch_mode