Commit 93cff168 authored by Jan Möbius's avatar Jan Möbius

Load Save Interface Documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11143 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f23050fc
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
* *
* You have to implement at least name and description for your plugin. * You have to implement at least name and description for your plugin.
* All other functions and signals are optional. If you want to implement or use * All other functions and signals are optional. If you want to implement or use
* them just add them to your plugin header. * them just add them to your plugin header. A detailed description of this interface
* can be found in the \ref baseInterfacePage .
* *
* See \ref pluginProgramming for a tutorial on plugin programming. * See \ref pluginProgramming for a tutorial on plugin programming.
* *
...@@ -332,6 +333,7 @@ This is achieved by the BaseInterface::nodeVisibilityChanged() function. As node ...@@ -332,6 +333,7 @@ This is achieved by the BaseInterface::nodeVisibilityChanged() function. As node
you should pass the id of the object to the function or -1 if its a global node (which should not be used!). you should pass the id of the object to the function or -1 if its a global node (which should not be used!).
If the complete scene gets cleared, the slot BaseInterface::slotAllCleared() will be executed after all objects have been removed from the scene. If the complete scene gets cleared, the slot BaseInterface::slotAllCleared() will be executed after all objects have been removed from the scene.
A more fine grained information about objects added or removed from the scene is available via the \ref loadSaveInterfacePage .
There are three additional slots that are called by the core, if the object selection(source/target BaseInterface::slotObjectSelectionChanged() ), There are three additional slots that are called by the core, if the object selection(source/target BaseInterface::slotObjectSelectionChanged() ),
the object visibility(Show/Hide BaseInterface::slotVisibilityChanged()) or other properties changed (e.g. name BaseInterface::slotObjectPropertiesChanged() ) the object visibility(Show/Hide BaseInterface::slotVisibilityChanged()) or other properties changed (e.g. name BaseInterface::slotObjectPropertiesChanged() )
......
...@@ -71,7 +71,7 @@ class LoadSaveInterface { ...@@ -71,7 +71,7 @@ class LoadSaveInterface {
* @param _id Object to Save * @param _id Object to Save
* @param _filename Filename to save it to (Leave as "" to automatically determine filename) * @param _filename Filename to save it to (Leave as "" to automatically determine filename)
*/ */
virtual void save(int /*_id*/ , QString /*_filename*/ ) {} virtual void save(int _id , QString _filename ) {}
/** \brief Load object from file with a specific DataType /** \brief Load object from file with a specific DataType
* *
...@@ -79,7 +79,7 @@ class LoadSaveInterface { ...@@ -79,7 +79,7 @@ class LoadSaveInterface {
* @param _type Type to be loaded * @param _type Type to be loaded
* @param _id Here the id of the loaded object is returned. id its -1 something went wrong * @param _id Here the id of the loaded object is returned. id its -1 something went wrong
*/ */
virtual void load(QString /*_filename*/, DataType /*_type*/, int& /*_id*/) {}; virtual void load(QString _filename, DataType _type, int& _id) {};
/** Add an empty object of the given type /** Add an empty object of the given type
...@@ -87,26 +87,29 @@ class LoadSaveInterface { ...@@ -87,26 +87,29 @@ class LoadSaveInterface {
* @param _type Type to be created * @param _type Type to be created
* @param _id Here the id of the loaded object is returned. id its -1 something went wrong * @param _id Here the id of the loaded object is returned. id its -1 something went wrong
*/ */
virtual void addEmptyObject( DataType /*_type*/, int& /*_id*/) {}; virtual void addEmptyObject( DataType _type, int& _id) {};
/** Create a copy of an existing object /** Create a copy of an existing object
* *
* @param _oldId id of the object to copy * @param _oldId id of the object to copy
* @param _newId id of the new object created * @param _newId id of the new object created
*/ */
virtual void copyObject( int /*_oldId*/, int& /*_newId*/) {}; virtual void copyObject( int _oldId, int& _newId) {};
/** \brief Emit this signal if an empty object has been created /** \brief DEPRECATED! Emit this signal if an empty object has been created
*
* Deprecated! Objects are added by the Type Plugins and this is signal is in the TypeInterface now
*
* @param _id Id of the added object * @param _id Id of the added object
*/ */
virtual void emptyObjectAdded( int /*_id*/ ) {}; virtual void emptyObjectAdded( int _id ) {};
/** \brief Delete an object /** \brief Delete an object
* *
* @param _id Id of the object * @param _id Id of the object
*/ */
virtual void deleteObject( int /*_id*/ ){}; virtual void deleteObject( int _id ){};
/** \brief Delete all Objects /** \brief Delete all Objects
* *
...@@ -120,18 +123,18 @@ class LoadSaveInterface { ...@@ -120,18 +123,18 @@ class LoadSaveInterface {
* This slot is called if a file has been opened by the core.\n * This slot is called if a file has been opened by the core.\n
* @param _id Id of the new object * @param _id Id of the new object
*/ */
virtual void fileOpened( int /*_id*/ ) {}; virtual void fileOpened( int _id ) {};
/** \brief An empty object has been added /** \brief An empty object has been added
* *
* This slot is called if an empty object has been added by the core.\n * This slot is called if an empty object has been added by the core.\n
* @param _id Id of the new object * @param _id Id of the new object
*/ */
virtual void addedEmptyObject( int /*_id*/ ) {}; virtual void addedEmptyObject( int _id ) {};
/** \brief An object was deleted /** \brief An object was deleted
* *
* This function is called bz the core if an object gets deleted. It is called immediatly * This function is called by the core if an object gets deleted. It is called immediately
* before the object is removed from the scenegraph. So if this function is invoked, the object still * 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.\ * exists. All plugins get informed via this slot.\
* *
...@@ -140,7 +143,7 @@ class LoadSaveInterface { ...@@ -140,7 +143,7 @@ class LoadSaveInterface {
* *
* @param _id Id of the object that is deleted. * @param _id Id of the object that is deleted.
*/ */
virtual void objectDeleted( int /*_id*/ ){}; virtual void objectDeleted( int _id ){};
}; };
...@@ -149,9 +152,53 @@ class LoadSaveInterface { ...@@ -149,9 +152,53 @@ class LoadSaveInterface {
The LoadSaveInterface can be used by plugins to add new objects to the scene either by creating empty objects 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. or by loading them from files. The interface also triggers saving of existing objects to files.
\section loadSaveInterface_load_save Load/Save Files
You can load a file from within your plugin via
\code
emit LoadSaveInterface::load(QString _filename, DataType _type, int& _id);
\endcode
and to save an object to a file, call LoadSaveInterface::
\code
emit LoadSaveInterface::save(int _id , QString _filename );
\endcode
The corresponding File Plugin will than be activated and load or save the object. for load, the id of the new object
is returned.
\section loadSaveInterface_createObjects Creating/Copying Objects
To add objects to the scene you can use the following two functions:
\code
emit LoadSaveInterface::addEmptyObject( DataType _type, int& _id);
\endcode
This will create a new object of the given DataType and return the id of it, while
\code
emit LoadSaveInterface::copyObject( int _oldId, int& _newId);
\endcode
will copy the given object and return the new object id.
\section loadSaveInterface_deleteObjects Deleting Objects
You can delete a specific object via
\code
emit LoadSaveInterface::deleteObject( int _id );
\endcode
or clear the whole scene with:
\code
emit LoadSaveInterface::deleteAllObjects();
\endcode
\section loadSaveInterface_callbacks Object Information
Additionally the interface informs plugins if new objects have been added to the scenes or if previous objects Additionally the interface informs plugins if new objects have been added to the scenes or if previous objects
have been removed. 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( ).
\section Usage
To use the LoadSaveInterface: To use the LoadSaveInterface:
<ul> <ul>
<li> include LoadSaveInterface in your plugins header file <li> include LoadSaveInterface in your plugins header file
...@@ -160,9 +207,6 @@ To use the LoadSaveInterface: ...@@ -160,9 +207,6 @@ To use the LoadSaveInterface:
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them) <li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
</ul> </ul>
*/ */
......
...@@ -57,7 +57,6 @@ The following groups of Interfaces are available: ...@@ -57,7 +57,6 @@ The following groups of Interfaces are available:
BackupInterface BackupInterface
FileInterface FileInterface
IniInterface IniInterface
LoadSaveInterface
PickingInterface PickingInterface
ProcessInterface ProcessInterface
TextureInterface TextureInterface
...@@ -68,12 +67,6 @@ ViewInterface ...@@ -68,12 +67,6 @@ ViewInterface
This page gives an overview over the available interfaces which control other parts of OpenFlipper. This page gives an overview over the available interfaces which control other parts of OpenFlipper.
\subsection LoadSavePlugin Load / Save Interface
\image html loadSaveInterface.png
Provides functions to handle mesh files and load / unload geometry
objects into the scene graph ( LoadSaveInterface ).
\subsection TexturePlugin Texture Interface \subsection TexturePlugin Texture Interface
\image html TextureInterface.png \image html TextureInterface.png
Allows your plugin to provide a texture. ( TextureInterface ) Allows your plugin to provide a texture. ( TextureInterface )
...@@ -156,6 +149,13 @@ Specify own view modes setting which toolboxes/toolbars/context menus will be vi ...@@ -156,6 +149,13 @@ Specify own view modes setting which toolboxes/toolbars/context menus will be vi
/** \page pluginInterfacesDataHandling Object and Data Handling /** \page pluginInterfacesDataHandling Object and Data Handling
This page shows interfaces for controlling and adding Objects. This page shows interfaces for controlling and adding Objects.
\subpage loadSaveInterfacePage
\image html loadSaveInterface.png
Provides functions to control loading/saving of files and generate new objects. Additionally
this interface informs plugins, when objects get added or removed( \ref loadSaveInterfacePage ).
\subpage typeInterfacePage \subpage typeInterfacePage
\image html TypeInterface.png \image html TypeInterface.png
Allows plugins to specify custom data types and makes them available Allows plugins to specify custom data types and makes them available
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment