Commit b605a147 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'blockSceneGraphUpdates' into 'master'

Added signals slot to block scenegraph updates



See merge request !42
parents e229b3b3 1bc8bed5
Pipeline #262 passed with stage
......@@ -122,6 +122,17 @@ class BaseInterface {
*/
virtual void updateView() {};
/** \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) {};
/** \brief An object has been changed or added by this plugin
*
* Emit this Signal, if you updated any part of an object.\n
......
......@@ -934,7 +934,14 @@ void Core::updateUI() {
QApplication::processEvents();
}
//-----------------------------------------------------------------------------
void Core::blockScenegraphUpdates(bool _block) {
if (_block)
OpenFlipper::Options::blockSceneGraphUpdates();
else
OpenFlipper::Options::unblockSceneGraphUpdates();
}
//-----------------------------------------------------------------------------
......
......@@ -650,6 +650,9 @@ public slots:
/// Called when a plugin requests an update in the viewer
void updateView();
/// Called when a plugin wants to lock or unlock scenegraph updates
void blockScenegraphUpdates(bool _block);
/// process events during script execution to keep the ui alive
void updateUI();
......
......@@ -875,6 +875,8 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( checkSignal(plugin,"updateView()") )
connect(plugin,SIGNAL(updateView()),this,SLOT(updateView()), Qt::AutoConnection);
if ( checkSignal(plugin,"blockScenegraphUpdates(bool)") )
connect(plugin,SIGNAL(blockScenegraphUpdates(bool)),this,SLOT(blockScenegraphUpdates(bool)), Qt::QueuedConnection);
if ( checkSignal(plugin,"updatedObject(int)") && checkSignal(plugin,"updatedObject(int,const UpdateType&)") ){
......
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