diff --git a/BasePlugin/BaseInterface.hh b/BasePlugin/BaseInterface.hh index 74ac1f159d47cf82b211905a50a9eab0698b182e..fe2c4bdcf5aef901a909a5d499d8cfe1cd2cdb33 100644 --- a/BasePlugin/BaseInterface.hh +++ b/BasePlugin/BaseInterface.hh @@ -219,6 +219,18 @@ class BaseInterface { */ virtual void slotViewChanged() {}; + /** \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() {}; + /** \brief A viewer changed its draw mode * * @param _viewerId Id of the viewer that changed its draw mode @@ -407,6 +419,7 @@ If the view (viewer position /viewing direction) has been changed, the slot Base 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). \note Be careful, not to change the view in this function or you get an endless loop! +After the complete scene has been drawn, the core will inform the plugins via the BaseINterface::slotSceneRedrawn(). \section baseInterfaceManagementFunctions Management Functions There are some basic functions for managing plugins. The BaseInterface::description() function can be used diff --git a/Core/Core.cc b/Core/Core.cc index c50555fb2e0c52eb451473675087580e72261fe9..cb944d725838fa9a59436f08432ddd4e04333b19 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -859,7 +859,12 @@ void Core::updateView() for (unsigned int i = 0; i < OpenFlipper::Options::examinerWidgets(); ++i) coreWidget_->examiner_widgets_[i]->updateGL(); + + // Inform plugins of the scene update + emit pluginSceneDrawn(); } + + } diff --git a/Core/Core.hh b/Core/Core.hh index 07c0771eebf06451b0e95dbdc97882fd88958062..261ed3b5a5a5b4830c87afe1f7cb66ab55c1c3b0 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -183,6 +183,9 @@ signals: /// This signal is emitted if one of the viewers updated its view void pluginViewChanged(); + /// This signal is emitted after the scene has been drawn + void pluginSceneDrawn(); + /// The texture with the given name and filename has been added void addTexture( QString, QString , uint, int ); diff --git a/Core/PluginLoader.cc b/Core/PluginLoader.cc index f7ef0cc16d745556a4e70915e4da512d21f1ad6c..9385b1d1fcb403e778f7db239dce6dcd67119f4f 100644 --- a/Core/PluginLoader.cc +++ b/Core/PluginLoader.cc @@ -881,6 +881,9 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO if ( checkSlot( plugin , "slotViewChanged()" ) ) connect(this,SIGNAL(pluginViewChanged()),plugin,SLOT(slotViewChanged()), Qt::DirectConnection); + if ( checkSlot( plugin , "slotSceneDrawn()" ) ) + connect(this,SIGNAL(pluginSceneDrawn()),plugin,SLOT(slotSceneDrawn()), Qt::DirectConnection); + if ( checkSlot( plugin , "slotDrawModeChanged(int)" ) ) connect(coreWidget_,SIGNAL(drawModeChanged(int)),plugin,SLOT(slotDrawModeChanged(int)), Qt::DirectConnection); diff --git a/Documentation/DeveloperHelpSources/pics/SceneViewUpdate.png b/Documentation/DeveloperHelpSources/pics/SceneViewUpdate.png index b3a30cd6e7dcc39e767056304680fdc386855407..757f2d425f769a657732d0a6d4196747f10aa695 100644 Binary files a/Documentation/DeveloperHelpSources/pics/SceneViewUpdate.png and b/Documentation/DeveloperHelpSources/pics/SceneViewUpdate.png differ diff --git a/Documentation/DeveloperHelpSources/tikz/SceneViewUpdate.tex b/Documentation/DeveloperHelpSources/tikz/SceneViewUpdate.tex index 634479c627e5cd0a2b7fb5e69214937aef6fd94d..8e7c22439479c265320620c73c2e19093daef18e 100644 --- a/Documentation/DeveloperHelpSources/tikz/SceneViewUpdate.tex +++ b/Documentation/DeveloperHelpSources/tikz/SceneViewUpdate.tex @@ -51,7 +51,10 @@ text centered, text=black, text width=3.5cm] \textbf{slot BaseInterface::slotViewChanged()} }; - +\node (slotSceneDrawn)[abstract, rectangle, below=of slotViewChanged, yshift=-2.4cm ] +{ +\textbf{slot BaseInterface::slotSceneDrawn()} +}; \node (coreUpdateHandling) [abstract, rectangle, left= of signalUpdateView, xshift=-1.6cm ] @@ -91,6 +94,7 @@ text centered, text=black, text width=3.5cm] \node [label=above:per plugin,yshift=-3] (X) at ($ (viewManagement)!.78!(slotViewChanged.west) $) {}; \node [label=right:update time reached] (X) at ($ (viewManagement)!.57!(redraw) $) {}; \node [label=left:too many updates] (X) at ($ (viewManagement)!.4!(timer) $) {}; +\node [label=above:per plugin,yshift=-3] (X) at ($ (redraw.south)!.78!(slotSceneDrawn.west) $) {}; \draw[flow] (pluginViewChange.west) -- ++(0,0) -| (viewManagement.north); \draw[flow] (userViewChange.south) -- ++(0,-0.5cm) -| (viewManagement.north); @@ -101,10 +105,11 @@ text centered, text=black, text width=3.5cm] \draw[flow] (viewManagement.south) -- ++(0,-0.9) -| (timer.north); \draw[flow] (signalUpdateView.west) -- ++(0,0) |- (coreUpdateHandling.east); \draw[flow] (timer.south) -- ++(0,-0.4) -| (redraw.north); +\draw[flow] (redraw.south) -- ++(0,0) |- (slotSceneDrawn.west); \begin{pgfonlayer}{background} \node[CoreGroup,fit=(Core) (redraw) (userViewChange) ] (Core) {}; -\node[PluginGroup,fit=(Plugins) (signalUpdatedObject) (slotViewChanged) ] (Plugin) {}; +\node[PluginGroup,fit=(Plugins) (signalUpdatedObject) (slotSceneDrawn) ] (Plugin) {}; \end{pgfonlayer}