BaseInterface.hh 24.6 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
2
3
*                                                                            *
*                              OpenFlipper                                   *
Martin Schultz's avatar
Martin Schultz committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 *           Copyright (c) 2001-2015, RWTH-Aachen University                 *
 *           Department of Computer Graphics and Multimedia                  *
 *                          All rights reserved.                             *
 *                            www.openflipper.org                            *
 *                                                                           *
 *---------------------------------------------------------------------------*
 * This file is part of OpenFlipper.                                         *
 *---------------------------------------------------------------------------*
 *                                                                           *
 * Redistribution and use in source and binary forms, with or without        *
 * modification, are permitted provided that the following conditions        *
 * are met:                                                                  *
 *                                                                           *
 * 1. Redistributions of source code must retain the above copyright notice, *
 *    this list of conditions and the following disclaimer.                  *
 *                                                                           *
 * 2. Redistributions in binary form must reproduce the above copyright      *
 *    notice, this list of conditions and the following disclaimer in the    *
 *    documentation and/or other materials provided with the distribution.   *
 *                                                                           *
 * 3. Neither the name of the copyright holder nor the names of its          *
 *    contributors may be used to endorse or promote products derived from   *
 *    this software without specific prior written permission.               *
 *                                                                           *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           *
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  *
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,       *
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR        *
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      *
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        *
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              *
Jan Möbius's avatar
Jan Möbius committed
39
*                                                                            *
40
41
\*===========================================================================*/

42
#pragma once
Jan Möbius's avatar
 
Jan Möbius committed
43

44
#include <OpenFlipper/common/Types.hh>
45

46

47
48
49
50
/** \file BaseInterface.hh
*
* OpenFlippers main plugin Interface \ref baseInterfacePage.
*/
Jan Möbius's avatar
Jan Möbius committed
51

52
53

/** \brief Interface class from which all plugins have to be created.
54
  *
Jan Möbius's avatar
 
Jan Möbius committed
55
  * You have to implement at least name and description for your plugin.
56
  * All other functions and signals are optional. If you want to implement or use
57
58
  * them just add them to your plugin header. A detailed description of this interface
  * can be found in the \ref baseInterfacePage .
59
  *
60
61
62
63
  * See \ref pluginProgramming for a tutorial on plugin programming.
  *
  * Also see \ref dataFlow diagrams for a detailed overview of
  * OpenFlipper's data flow and interface function calls.
Jan Möbius's avatar
 
Jan Möbius committed
64
65
 */
class BaseInterface {
66

67
68
   //===========================================================================
    /** @name Initialization
Jan Möbius's avatar
Jan Möbius committed
69
70
71
    * @{
    * \anchor BaseInterfaceInitialization
    * */
72
   //===========================================================================
73

74
75
  private slots:
      /**  \brief Initialize Plugin
76
       *
Jan Möbius's avatar
 
Jan Möbius committed
77
       *   This slot is called if the plugin is loaded and has to be initialized. All initialization stuff
Jan Möbius's avatar
Jan Möbius committed
78
       *   in this slot has to stay inside the plugin, no external signals are allowed here (and will be ignored).
Jan Möbius's avatar
Jan Möbius committed
79
       *   Don't create any objects via PluginFunctions here. Use the pluginsInitialized() slot for external
Jan Möbius's avatar
Jan Möbius committed
80
       *   initialization. After execution of this slot your plugin should be fully functional.
81
       *   Only gui elements may be uninitialized and should be created in pluginsInitialized().
Jan Möbius's avatar
 
Jan Möbius committed
82
83
      */
      virtual void initializePlugin() {};
84

Jan Möbius's avatar
 
Jan Möbius committed
85
      /**  \brief Initialize Plugin step 2
86
       *
87
       *   This slot is called if all plugins are loaded and the core is ready. Afterwards you can already send
Jan Möbius's avatar
Jan Möbius committed
88
       *   signals to other plugins and the core (e.g. adding global textures). \note Do not create objects via addEmpty
89
       *   or load objects in this slot, as the rendering system is not ready yet.
Jan Möbius's avatar
 
Jan Möbius committed
90
91
      */
      virtual void pluginsInitialized() {};
92

93
94
95
96
97
98
99
100
101
102
      /**  \brief Initialize Plugin step 2 alternative
       *
       *   This slot is similar to the vanilla version without parameters but additionally passes plugin command line options
       *   as key-value pairs. For passing command line options, use e.g.:
       *   OpenFlipper -o key1=value1 -p key2=value2
       *   or
       *   OpenFlipper --pluginoptions key1=value1;key2=value2
      */
      virtual void pluginsInitialized(QVector<QPair<QString, QString>> const& _pluginOptions) {};

103

104
105
106
107
  /** @} */

  //===========================================================================
  /** @name Object/View updates
Jan Möbius's avatar
Jan Möbius committed
108
109
110
111
  * @{
  * \anchor BaseInterfaceUpdateSlots
  * */

112
113
114
115
116
  //===========================================================================

  signals :
    /** \brief Update current view in Main Application
      *
Jan Möbius's avatar
Jan Möbius committed
117
118
      *  Emit this Signal if the viewer widget in the main application should update the current view.
      *  If you do an updatedObject the core will trigger an update itself and you don't have to care
119
120
      *  about it.\n
      *  This signal can be called from any thread.\n
121
122
123
    */
    virtual void updateView() {};

124
125
126
127
128
129
130
131
132
133
134
    /** \brief Tell the core to prevent scenegraph updates.
     *
     *  Emit this Signal if you want to skip scenegraph updates. E.g. if you add a large number of objects
     *  or modify them it's much more efficient to block scenegraph updates until you finished and then
     *  do only one update run.
     *
     *  The function itself is counting the number of blocks internally to allow multiple plugins for concurrent
     *  blocks. The function is queued to ensure that it is processed in line with load save operations.
     */
    virtual void blockScenegraphUpdates(bool _block) {};

Jan Möbius's avatar
Jan Möbius committed
135
    /** \brief An object has been changed or added by this plugin
136
      *
137
      *  Emit this Signal, if you updated any part of an object.\n
Jan Möbius's avatar
Jan Möbius committed
138
      *  If you changed the element itself (geometry, topology,..) you also have to emit this signal.\n
139
      *  Don't emit this Signal in BaseInterface::slotObjectUpdated() as this causes an endless Loop!!
Jan Möbius's avatar
Jan Möbius committed
140
      *  Give the id of the new object as parameter or -1 if you updated all objects or deleted an object.
141
142
      *  For performance reasons try to always give the id and not -1!\n
      *  This signal can be called from any thread.\n
143
      *
Jan Möbius's avatar
Jan Möbius committed
144
      *  @param _objectId Id of the object or -1 if referring to all or deleted objects.
145
      */
146
    virtual void updatedObject(int _objectId) {};
147

Dirk Wilden's avatar
Dirk Wilden committed
148
149
150
151
    /** \brief An object has been changed or added by this plugin
      *
      *  Emit this Signal, if you updated any part of an object.\n
      *  If you changed the element itself (geometry, topology,..) you also have to emit this signal.\n
Jan Möbius's avatar
Jan Möbius committed
152
      *  Don't emit this Signal in BaseInterface::slotObjectUpdated() as this causes an endless Loop!!
Dirk Wilden's avatar
Dirk Wilden committed
153
      *  Give the id of the new object as parameter or -1 if you updated all objects or deleted an object.
154
155
      *  For performance reasons try to always give the id and not -1!\n
      *  This signal can be called from any thread.\n
Dirk Wilden's avatar
Dirk Wilden committed
156
      *
Jan Möbius's avatar
Jan Möbius committed
157
      * @param _identifier id of the object or -1 if referring to all or deleted objects.
Dirk Wilden's avatar
Dirk Wilden committed
158
159
      * @param _type the type states which part of the object (topology, selection, ..) has to be updated
      */
160
    virtual void updatedObject(int _identifier, const UpdateType& _type) {};
Dirk Wilden's avatar
Dirk Wilden committed
161
    
162
    /** \brief A scenegraph node has been shown or hidden
163
      *
164
      *  Emit this Signal, if you changed the visibility of a scenegraph node directly (not via object->show/hide).
165
      *  This is required to reset the near and far plane for the viewers to provide
166
      *  an optimal view. Use the id of the object the node is attached to or -1 if it is not connected to an object.
167
168
      *
      */
169
    virtual void nodeVisibilityChanged( int _identifier ) {};
170

171
172
  private slots:

Jan Möbius's avatar
Jan Möbius committed
173
    /**  \brief An object has been updated by another plugin
174
      *
Jan Möbius's avatar
Jan Möbius committed
175
      *   This slot is called by the main application if the number or status of existing objects changed or if
176
      *   an existing object has been changed. This could mean, that objects are added or deleted
Jan Möbius's avatar
Jan Möbius committed
177
      *   or that an existing object with the given id has been modified.
178
      *   If you store local information about one of these Objects, you should check if its still valid!\n
Jan Möbius's avatar
Jan Möbius committed
179
      *  Don't emit BaseInterface::updatedObject(int) in this slot as this causes an endless Loop!!
180
181
182
      *   You don't need to call updateView as the core triggers a redraw itself.\n
      *   This slot will be executed on the main thread.\n
      *
183
      *  @param _identifier Identifier of the updated/new object or -1 if one is deleted.
184
    */
185
    virtual void slotObjectUpdated( int _identifier ) {};
186

Dirk Wilden's avatar
Dirk Wilden committed
187
188
    /**  \brief An object has been updated by another plugin
      *
Jan Möbius's avatar
Jan Möbius committed
189
      *   This slot is called by the main application if the number or status of existing objects changed or if
Dirk Wilden's avatar
Dirk Wilden committed
190
191
192
      *   an existing object has been changed. This could mean, that objects are added or deleted
      *   or that an existing object with the given id has been modified.
      *   If you store local information about one of these Objects, you should check if its still valid!\n
Jan Möbius's avatar
Jan Möbius committed
193
      *  Don't emit BaseInterface::updatedObject(int) in this slot as this causes an endless Loop!!
194
195
196
      *   You don't need to call updateView as the core triggers a redraw itself.\n
      *   This slot will be executed on the main thread.\n
      *
Dirk Wilden's avatar
Dirk Wilden committed
197
198
199
      *  @param _identifier Identifier of the updated/new object or -1 if one is deleted.
      *  @param _type the type states which part of the object (topology, selection, ..) had been updated
    */
200
    virtual void slotObjectUpdated( int _identifier, const UpdateType& _type ) {};
Dirk Wilden's avatar
Dirk Wilden committed
201

202
    /**  \brief Called if the whole scene is cleared
Jan Möbius's avatar
Jan Möbius committed
203
204
205
      *
      * This slot is called if the main application cleared the whole scene. No objects will remain in memory
      * and all destructors of the objects are called before this signal is emitted.
206
207
208
209
210
211
      *
      */
    virtual void slotAllCleared( ) {};

      /**  \brief The active object has changed
      *
Jan Möbius's avatar
Jan Möbius committed
212
      *   This slot is called by the main application if the current selection of an object has changed.\n
213
      *   This means that the selection of source / target objects has changed.
Jan Möbius's avatar
Jan Möbius committed
214
      *   Additionally you get the id of the object that has been changed or -1 if all objects
215
      *   have been modified.
216
    */
217
    virtual void slotObjectSelectionChanged( int _identifier ) {};
218
219
220

    /** \brief An object has been shown or hidden
      *
Jan Möbius's avatar
Jan Möbius committed
221
      *  This slot is called if an object is shown or hidden.
222
223
224
225
      *  The id of the object is given as a parameter.
      *  If multiple or all objects have changed, the id will be -1.
      *
      */
226
    virtual void slotVisibilityChanged( int _identifier ) {};
227

Jan Möbius's avatar
Jan Möbius committed
228
229
230
231
232
233
234
    /**  \brief Object properties have been changed
      *
      *  This slot is called if the object properties (e.g. name ) have changed
      *  The id of the object is given as a parameter.
      *  If multiple or all objects have changed, the id will be -1.
      *
    */
235
    virtual void slotObjectPropertiesChanged( int _identifier ) {};
236
237
238
239
240
    
    /** \brief View has changed
      *
      * This slot is called when the view in one of the viewers changed
      * ( Viewing direction/viewer position )
Jan Möbius's avatar
Jan Möbius committed
241
      * !! Be careful to not change the view in this slot !!
242
243
244
      * !! This will of course lead to an endless loop !!
    */
    virtual void slotViewChanged() {};
Jan Möbius's avatar
Jan Möbius committed
245

246
247
248
249
250
251
252
253
254
255
256
257
    /** \brief triggered after a scene has been drawn
     *
     * This slot will be triggered every time, the OpenGl draw of one frame is completed.
     * Every time you emit an updateView, a scene redraw will be triggered (except, if
     * the minimal time between two frames is not yet reached). After drawing the scene, the
     * core will call this slot to inform the plugins, that a new view is visible.
     *
     * You can use this slot, if you need to control special updates in your plugin, that
     * react on the fps.
     */
    virtual void slotSceneDrawn() {};

258
259
260
261
262
    /** \brief A viewer changed its draw mode
     *
     * @param _viewerId Id of the viewer that changed its draw mode
     */
    virtual void slotDrawModeChanged(int _viewerId) {};
263
264
265
266
267
268
269
270
  /** @} */

  //===========================================================================
  /** @name Plugin identification
  * @{ */
  //===========================================================================
  public :

Jan Möbius's avatar
Jan Möbius committed
271
    /** \brief Return a name for the plugin
272
273
274
275
276
277
278
279
280
281
      *
      * This Function has to return the name of the plugin.
    */
    virtual QString name() = 0;

    /** \brief Return a description of what the plugin is doing
      *
      * This function has to return a basic description of the plugin
      */
    virtual QString description() = 0;
282
283
284
285

  public slots:
      /** \brief Return a version string for your plugin
       *
Jan Möbius's avatar
Jan Möbius committed
286
       * This function will be used to determine the current version of your plugin.
287
       * Should have the form x.x.x ( you do not need to give that many subversions )
Jan Möbius's avatar
Jan Möbius committed
288
289
       *
       * @return The version string of the plugin
290
291
292
       */
      virtual QString version() { return QString("-1"); };

293
  signals:
294

295
      /**  \brief Set a description for a public slot
296
       *
Jan Möbius's avatar
Jan Möbius committed
297
       *   public slots of each plugin are automatically available for scripting. \n
298
299
300
301
302
303
       *   Use this Signal to add a description for your slot so that everyone knows what it is used for. \n
       *
       *   @param _slotName the name of the slot
       *   @param _slotDescription a description for the slot
       *   @param _parameters list of parameters
       *   @param _descriptions list of descriptions for the parameters (_descriptions[i] corresponds to _parameters[i])
Jan Möbius's avatar
 
Jan Möbius committed
304
      */
305
306
      virtual void setSlotDescription(QString     _slotName    ,   QString     _slotDescription,
                                      QStringList _parameters  , QStringList _descriptions) {};
307

308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
   /** @} */

  //===========================================================================
   /** @name Renderer control
    * @{ */
  //===========================================================================
  signals:

     /** \brief Set a renderer for the given viewer
      *
      * @param _viewer Id of the viewer to set the renderer for
      * @param _rendererName Name of the renderer to be used
      */
     virtual void setRenderer(unsigned int _viewer, QString _rendererName) {};

Jan Möbius's avatar
Jan Möbius committed
323
324
325
326
327
328
329
     /** \brief Get the current renderer for the given viewer
      *
      * @param _viewer Id of the viewer to set the renderer for
      * @param _rendererName Name of the renderer that is currently active
      */
     virtual void getCurrentRenderer(unsigned int _viewer, QString& _rendererName) {};

330
331
  /** @} */

332
  public slots :
333
334
335
336
337
338
339

    /** This function is called when the application exits or when your plugin is about to be unloaded.
      * Here you can clean up your plugin, delete local variables...
      */
    virtual void exit(){};

    /** Using this function you can inform the core that your plugin can run without creating a widget.
Jan Möbius's avatar
Jan Möbius committed
340
      * If your plugin does not implement this function, it will not be loaded in scripting mode without gui.
Jan Möbius's avatar
Jan Möbius committed
341
      * You don't have to do anything in this function.
342
343
344
345
346
347
348
      */
    virtual void noguiSupported( ) {} ;

  public :

    /// Destructor
    virtual ~BaseInterface() {};
349

Jan Möbius's avatar
 
Jan Möbius committed
350
351
};

352
353
354
355
356

/** \page baseInterfacePage Base Interface
The BaseInterface has to be used by every plugin in OpenFlipper. As the minimum a plugin
has to implement the BaseInterface::name() and BaseInterface::description() functions from this interface.

Jan Möbius's avatar
Jan Möbius committed
357
358
359
360
361
362
363
364
To use the BaseInterface:
<ul>
<li> include BaseInterface.hh in your plugins header file
<li> derive your plugin from the class BaseInterface
<li> add Q_INTERFACES(BaseInterface) to your plugin class 
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them except BaseInterface::description() and BaseInterface::name() )
</ul>

365

Jan Möbius's avatar
Jan Möbius committed
366
\section baseInterfacePluginInitialization Plugin Initialization
367
The OpenFlipper startup process consists of several steps, which are shown in this image:
Jan Möbius's avatar
Jan Möbius committed
368
\image html OpenFlipperStartup.png
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
OpenFlipper first starts its core system. Therefore it loads the settings, parses command line options and initializes
the QT library. Afterwards the object and scenegraph management are initialized. The next step creates the core
user interface and the logging system. Now the plugins are loaded in the following way:
-# All the plugins are loaded into memory.
-# For each plugin, the interfaces get connected to the plugin and afterwards the BaseInterface::initializePlugin() function is called.
   (Here you can setup your internal variables). After execution of this slot your plugin should be fully functional. Only gui
   elements may be uninitialized and should be created in BaseInterface::pluginsInitialized(). The order how plugins are loaded is not fixed.
   So you should not rely or communicate with other plugins in this slot.
-# For each plugin the BaseInterface::pluginsInitialized() function is called. Here you can setup your gui elements and start
   sending signals to the core.
-# For each plugin the INIInterface::loadIniFileOptions() slot is called (if the interface is implemented). This slot can be used to load
   additional options from INI files. (DEPRECATED! Use the OpenFlipperSettings() class instead)

\note - Do not create objects via addEmpty or load objects during OpenFlipper startup, as the rendering system is not ready yet!
\note - The ini interface is deprecated for loading or storing plugin options. Please use OpenFlipperSettings() instead.

Afterwards the plugin initialization is complete and the core sets up the final gui.
386

387
\section baseInterfaceObjectUpdateNotification Object Update Notification
Jan Möbius's avatar
Jan Möbius committed
388
389
390
391
The objects in OpenFlippers scene are stored and managed in OpenFlippers core. If a plugin changes one of the
objects, it has to notify the core about that change. In turn OpenFlipper will then notify all other plugins about
this change. This functionality is provided by the signals and slots for \ref BaseInterfaceUpdateSlots "update handling" .

Jan Möbius's avatar
Jan Möbius committed
392
393
\subsection baseInterfacegeneralObjectUpdates General update notifications

394
\image html ObjectUpdateNotification.png 
Jan Möbius's avatar
Jan Möbius committed
395

Jan Möbius's avatar
Jan Möbius committed
396
397
If you change data you have to emit one of BaseInterface::updatedObject(int) or BaseInterface::updatedObject(int,const UpdateType&).\n

398
BaseInterface::updatedObject(int) forces an update of the whole object while BaseInterface::updatedObject(int,const UpdateType&)
Jan Möbius's avatar
Jan Möbius committed
399
can be restricted to a part of the object ( Geometry,Selection, ... ; see UpdateType ) and is therefore faster and should be preferred.
400
401

Both signals get the id of the object that has been updated or -1 if all should be updated( you should not use -1 if you know what object changed!).
Jan Möbius's avatar
Jan Möbius committed
402

403
If the signal is emitted, the core calls BaseInterface::slotObjectUpdated( int , const UpdateType& ) of every plugin. You can
Jan Möbius's avatar
Jan Möbius committed
404
405
implement this slot if you need to react on object changes.

Jan Möbius's avatar
Jan Möbius committed
406
407
408
\note Don't emit updatedObject from within slotObjectUpdated as this will cause an endless loop!
\note If the object id passed to the functions is -1 all objects should be treated as updated.

Jan Möbius's avatar
Jan Möbius committed
409
410
411
412
413
After all plugins have been informed, the node itself gets updated. This means that for the corresponding object the update function is
called (BaseObjectData::update() ). This function is implemented by every object type in OpenFlipper and has to take care of reacting
to modifications of the object. E.g. the TriMeshObject, this could mean, that the OpenMesh data has changed (UPDATE_GEOMETRY). The object
would than trigger an update of the rendering buffers which are used to draw the mesh.
\note You should not call the update functions of an object directly as this means unnecessary overhead (As the core will call the function anyway on an update).
414
415
416
417

For more details about the UpdateType read the documentation about UpdateType and \ref DefaultUpdateTypes "predefined update types".
A description for adding custom update types at runtime is available \ref UpdateTypeFunctions "here".

Jan Möbius's avatar
Jan Möbius committed
418
419
420
421
422
\note If you do not specify an UpdateType, it will fall back to the default value UPDATE_ALL for compatibility reasons
      which actually updates each of the types. Unless it is really necessary this should generally be avoided since it
      consumes a lot of computation time. So try to narrow the updated properties as uch as possible!

\subsection baseInterfaceNodeUpdates Node updates
423
It is also possible to insert custom nodes into the scenegraph. If you changed these nodes, you also have to inform the core.
Jan Möbius's avatar
Jan Möbius committed
424
425
This is achieved by the BaseInterface::nodeVisibilityChanged() function. As nodes are usually attached to objects in the scene,
you should pass the id of the object to the function or -1 if its a global node.
426

Jan Möbius's avatar
Jan Möbius committed
427
\subsection baseInterfaceObjectRemoval Object Removal notifications
428
If the complete scene gets cleared, the slot BaseInterface::slotAllCleared() will be executed after all objects have been removed from the scene.
429
A more fine grained information about objects added or removed from the scene is available via the \ref loadSaveInterfacePage .
430

Jan Möbius's avatar
Jan Möbius committed
431
\subsection baseInterfaceSpecialNotifications Special Notifications
432
433
434
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() )

435
\section baseInterfaceSceneUpdateNotification Scene Update Notifications
436
437

OpenFlipper manages the scene updates in its core. If objects get updated the scene will be automatically redrawn. Nevertheless,
Jan Möbius's avatar
Jan Möbius committed
438
439
440
you can force an update of the scene by emitting the signal BaseInterface::updateView(). OpenFlipper restricts the number of redraws
to avoid useless updates. In the Options you can set a maximal frame rate or disable the restriction.
The following image shows how the updates process is managed:
441

Jan Möbius's avatar
Jan Möbius committed
442
\image html SceneViewUpdate.png
443

444
445
446
If the view (viewer position /viewing direction) has been changed, the slot BaseInterface::slotViewChanged() will be called, before anything gets
rendered. If you need to modify renderings or anything else depending on the current view, you can use this slot and adapt
to the new view (e.g. modifying a shader).
Jan Möbius's avatar
Jan Möbius committed
447
\note Be careful, not to change the view in this function or you get an endless loop!
448
After the complete scene has been drawn, the core will inform the plugins via the BaseINterface::slotSceneRedrawn().
449

450
\section baseInterfaceManagementFunctions Management Functions
451
There are some basic functions for managing plugins. The BaseInterface::description() function can be used
Jan Möbius's avatar
Jan Möbius committed
452
to provide a description for the plugin which will be printed along with the plugin name. The BaseInterface::name()
453
454
455
456
457
458
459
function has to return the name of the plugin. This name will also be used inside the scripting system.
Additionally it is possible to provide a plugin version number with BaseInterface::version().

OpenFlippers scripting system can use all public slots defined in your plugin. If it should also provide a
small text description for your functions, you could set them with BaseInterface::setSlotDescription(). Even if
you do not implement scripting functions in your plugin, the core will then be able to provide this information
to the user.
Jan Möbius's avatar
Jan Möbius committed
460

461
462
463
464
Along with the scripting, OpenFlipper provides a batch mode, running without any user interface. If your plugin
will work without an user interface (e.g. only scripting functions), you can define a slot BaseInterface::noguiSupported().
This empty slot is used to tell the core, that the plugin can work in batch mode. Otherwise it will not be loaded
when running a batch file.
Jan Möbius's avatar
Jan Möbius committed
465

466
467
*/

468
Q_DECLARE_INTERFACE(BaseInterface,"OpenFlipper.BaseInterface/1.0")
469