Developer Documentation
|
The LoadSaveInterface can be used by plugins to add new objects to the scene either by creating empty objects or by loading them from files. The interface also triggers saving of existing objects to files.
You can load a file from within your plugin via
and to save an object to a file, call LoadSaveInterface::
The corresponding File Plugin will than be activated and load or save the object. for load, the id of the new object is returned.
To add objects to the scene you can use the following two functions:
This will create a new object of the given DataType and return the id of it, while
will copy the given object and return the new object id.
You can delete a specific object via
or clear the whole scene with:
Additionally the interface informs plugins if new objects have been added to the scenes or if previous objects have been removed. LoadSaveInterface::fileOpened( int _id ) will be triggered each time an object is loaded from a file. If simply an empty object has been added, the slot LoadSaveInterface::addedEmptyObject( int _id ) will be called. If an object gets deleted, the LoadSaveInterface::objectDeleted( int _id ) will be called immediately before the object is removed from the scenegraph. So if this function is invoked, the object still exists. All plugins get informed via this slot.
If you want to know if the whole scene got cleared, use BaseInterface::slotAllCleared( ).
To use the LoadSaveInterface: