Blinker
engines directly modify the traversal state of
a scene graph by causing particular pieces of the graph to be cycled
through. The most obvious use of this is to cause objects to
repeatedly appear and disappear from view, hence the name
"Blinker
". This class of engine is derived from the
Switch
group node, which controls which of several pieces
of a scene graph can be traversed. The Blinker
adds an
animation effect by continually cycling traverals of its children, one
child at a time. Even if the Blinker
engine only has one
child, the effect of that child on the scene will alternately appear
and disappear.
The important fields are:
whichChild
: the index number of the child to begin the
traverse cycle with. Child nodes are indexed by the integers
0, 1, 2, etc. The default value is 0, the first child node.
speed
: the number of cycles per second.
The default value is 1.
on
: a boolean switch that decides if the engine is
currently running or not. The default value is TRUE
.
Here is a complete Inventor .iv file for an example that uses a
Blinker
engine node to alternate between displaying
a cube and a cone. Just cut and paste the text into a file named
test.iv
and then do ivview -q test.iv
:
#Inventor V2.0 ascii Separator { PerspectiveCamera { position 0 0.5 10 } Blinker { whichChild 0 speed 0.5 Separator { Translation { translation -2 0 0 } Cone { } } Separator { Translation { translation +2 0 0 } Cube { } } } }
You should note several things about this example:
Blinker
engine is also a grouping node just like
Separator
, so the children are contained within the
engine description.
whichChild
field of the Blinker
engine
is initially set to 0, which means that the first object to be
displayed is the Cone
object.
speed
field is set to 0.5, which means that each
cycle will take 2 seconds.
Cone
node is translated two units to the left,
while the Cube
node is translated two units to the right,
so that they will display side-by-side instead of being centred
at the same location.
Separator
nodes are used to group each translation
with the object that it is meant to translate, otherwise the effect
of each of those translations would continue to propagate down through
the rest of the scene description until the end of any enclosing
grouping node (the end of the Blinker
node in this case).
More information about Blinker
engines is available
in chapter 13 of Inventor Mentor and in the
man page for SoBlinker
.