3.1. The Scene Database

The Inventor scene database consists of information representing one or more 3D scenes. This database, SoDB SoDB SoDB , can contain several scene graphs, as shown in Figure 3.1, “ An Inventor Database. Each scene graph consists of a related set of 3D objects and attributes. In Figure 3.1, “ An Inventor Database, for example, the scene graphs might represent a car, a small house, another car, a large house, and a person.

An Inventor Database

Figure 3.1.  An Inventor Database

You can perform two basic operations, or methods, directly on the scene database. First, you initialize it:


This must be the first Inventor call you make. If you use the Inventor Component Library, the database is initialized automatically when you call SoXt::init() (see Chapter 18, Inventor Component Library). If you are not using components, but you are using interaction or node kits, or both, call SoInteraction::init(), which initializes the database, interaction, and node kits.

Second, you can read from a file into the scene database, which adds new scene graphs to it:

SoSeparator readAll (SoInput *in)
SbBool read(SoInput *in, SoNode *&rootNode) const
SoSeparator ReadAll(SoInput in)
bool Read(SoInput in, SoNode rootNode)
SoSeparator readAll(SoInput in)
SoNode read(SoInput in)


SbBool read(SoInput *in, SoPath *&path) const
bool Read(SoInput in, SoPath path)
SoPath readPath(SoInput in)

Using the first syntax, Inventor reads all graphs from a file specified by in and returns a pointer to a separator that contains the root nodes of all the scene graphs in the file. Using the second syntax, Inventor reads from a file specified by in and returns a pointer to the resulting root node ( rootNode). Using the third syntax, Inventor reads a file specified by in and returns a pointer to the resulting path (path). (See Section 3.6, “Paths”.) If an error occurs, the methods return FALSE. (Also see Chapter 12, Importing data for more information on SoInput SoInput SoInput .)