Advanced topics
Injecting data in included files
A typical case is that you have:- One scene file defining a pan-tilt unit
- Another scene file defining a stereo camera
To facilitate a more modular approach, peekabot allows injection of objects into included subtrees. Assume we want the stereo camera (defined in "sth.xml") added under the "pan.tilt" object from "ptu.xml". This is simple with <inject> element:
<?xml version="1.0">
<scene>
<include file="ptu.xml">
<inject at="pan.tilt">
<include file="sth.xml"/>
</inject>
</include>
</scene>
Of course, if you need to inject objects at several places can use several <inject> elements.
External blocks
To support interoperability with other tools and applications, scene definition files can contain<external> elements that are ignored by peekabot. Although markup contained in an external-block is ignored by peekabot, its contents still has to be well-formed.
External blocks are generally allowed everywhere in scene files - in the top scope of scene files, in color elements, in layer elements and object definition elements (e.g. <sphere>). They are not, however, allowed e.g. inside <scale>-elements.
A typical usage scenario where <external> blocks is storing non-peekabot data in the same file, e.g. information used by a simulator simulating the specified world.
- Example
<scene> <external> <g>9.82</g> <drag_coeff>2</drag_coeff> <disable_collisions/> </external> ... </scene>