Developer Documentation
|
OpenFlipper comes with some build in iterators which are defined in PluginFunctions.hh .These iterators can be used to iterate over the objects in the current scene. They are described in the following sections.
The PluginFunctions::ObjectIterator iterates over all objects that have a visible representation in the scene (Meshes, Points, Lights, Skeletons, ...). If you also want to iterate over invisible objects (like groups) use the BaseObjectIterator. You can restrict it to source(PluginFunctions::SOURCE_OBJECTS) and target(PluginFunctions::TARGET_OBJECTS) objects or iterate over all objects (PluginFunctions::ALL_OBJECTS).
Additionally you can specify the DataType that will be returned by the iterator ( e.g. DATA_TRIANGLE_MESH, DATA_POLY_MESH ). The DataType can also be combined such that all specified types will be returned:
The type for iterating over all objects is: DATA_ALL.
Here is a simple example how you can use the iterator to get all target triangle meshes.
Second example how you can use the iterator to get all source skeletons.
If you combine data types or iterate over all objects you need to check the DataType
The PluginFunctions::BaseObjectIterator works like the ObjectIterator, but also returns objects that do not have a visible representation in the scene. A simple example is given in the following code: