Developer Documentation
|
This interface is used to register new types in OpenFlipper. The type plugins are loaded before all other plugins. They have only the registerType function which registers the type to the core and a function to create objects of the new type. The type itself has to be defined in the ObjectTypes subdirectory.
Adding a custom data type to OpenFlipper needs the following requirements in order to work:
See detailed examples for each of the three points for already existing data types in OpenFlipperRoot/ObjectTypes.
Once the object class is specified, the type plugin will be responsible for its handling including
So, type plugins usually consist of only few lines of code. Here an example of a type plugin handling an example object data type as mentioned above:
Now, each time a plugin emits addEmptyObject(DATA_MY_DATA), the addEmpty() function will add the object to the scenegraph and return the newly created object's id.
Backups are very specific to the underlying data structures of certain types. Therefore the type plugins also manage backups. Backups itself are managed by perObjectData objects based on the BackupData class. When the slot gets called, we first have to check, if an BackupData is already available. If not, we create one. Than the backup is generated and passed to the backup data attached to the object.
You have to derive your backups from the BaseBackup class, where you only need to implement the apply function and your constructor. In the following example, this class is named TriMeshBackup.
To use the TypeInterface: