Commit 70d09c85 authored by Jan Möbius's avatar Jan Möbius

Renamed and extended functions to block scenegraph updates.

OpenFlipper::Options::loadingSettings 

replaced by 

sceneGraphUpdatesBlocked()
blockSceneGraphUpdates()
unblockSceneGraphUpdates()


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15114 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 87643ca6
...@@ -865,7 +865,7 @@ void Core::updateView() ...@@ -865,7 +865,7 @@ void Core::updateView()
redrawTime_->restart(); redrawTime_->restart();
if (!OpenFlipper::Options::loadingSettings() && !OpenFlipper::Options::redrawDisabled()) { if (!OpenFlipper::Options::sceneGraphUpdatesBlocked() && !OpenFlipper::Options::redrawDisabled()) {
for (unsigned int i = 0; i < OpenFlipper::Options::examinerWidgets(); ++i) for (unsigned int i = 0; i < OpenFlipper::Options::examinerWidgets(); ++i)
coreWidget_->examiner_widgets_[i]->updateGL(); coreWidget_->examiner_widgets_[i]->updateGL();
......
...@@ -420,7 +420,7 @@ void Core::openIniFile( QString _filename, ...@@ -420,7 +420,7 @@ void Core::openIniFile( QString _filename,
} }
// Tell plugins that we are currently reading an ini file // Tell plugins that we are currently reading an ini file
OpenFlipper::Options::loadingSettings(true); OpenFlipper::Options::blockSceneGraphUpdates();
// Load Core settings only if requested // Load Core settings only if requested
if ( _coreSettings ) if ( _coreSettings )
...@@ -525,7 +525,7 @@ void Core::openIniFile( QString _filename, ...@@ -525,7 +525,7 @@ void Core::openIniFile( QString _filename,
ini.disconnect(); ini.disconnect();
// As the reading has been completed, tell plugins that we do not read an ini file anymore. // As the reading has been completed, tell plugins that we do not read an ini file anymore.
OpenFlipper::Options::loadingSettings(false); OpenFlipper::Options::unblockSceneGraphUpdates();
// Reset scenegraph and reset trackball center // Reset scenegraph and reset trackball center
// This will also recompute the bounding boxes as well as the near and far plane // This will also recompute the bounding boxes as well as the near and far plane
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
void Core::resetScenegraph( bool _resetTrackBall ) { void Core::resetScenegraph( bool _resetTrackBall ) {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() ) { if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::sceneGraphUpdatesBlocked() ) {
unsigned int maxPases = 1; unsigned int maxPases = 1;
ACG::Vec3d bbmin,bbmax; ACG::Vec3d bbmin,bbmax;
...@@ -161,7 +161,7 @@ void Core::slotExecuteAfterStartup() { ...@@ -161,7 +161,7 @@ void Core::slotExecuteAfterStartup() {
slotCall( "scripting" ,"clearEditor()",ok); slotCall( "scripting" ,"clearEditor()",ok);
} }
OpenFlipper::Options::loadingSettings(true); OpenFlipper::Options::blockSceneGraphUpdates();
// Open all files given at the commandline // Open all files given at the commandline
for ( uint i = 0 ; i < commandLineFileNames_.size() ; ++i ) { for ( uint i = 0 ; i < commandLineFileNames_.size() ; ++i ) {
...@@ -181,7 +181,7 @@ void Core::slotExecuteAfterStartup() { ...@@ -181,7 +181,7 @@ void Core::slotExecuteAfterStartup() {
} }
} }
OpenFlipper::Options::loadingSettings(false); OpenFlipper::Options::unblockSceneGraphUpdates();
// Reset the scenegraph once to make sure everything is fine // Reset the scenegraph once to make sure everything is fine
resetScenegraph( true ); resetScenegraph( true );
...@@ -258,7 +258,7 @@ int Core::loadObject ( QString _filename ) { ...@@ -258,7 +258,7 @@ int Core::loadObject ( QString _filename ) {
if ( OpenFlipper::Options::gui() ) { if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename)); coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING ); coreWidget_->setStatus(ApplicationStatus::PROCESSING );
} }
...@@ -286,7 +286,7 @@ int Core::loadObject ( QString _filename ) { ...@@ -286,7 +286,7 @@ int Core::loadObject ( QString _filename ) {
} else } else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 ); coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY ); coreWidget_->setStatus(ApplicationStatus::READY );
} }
...@@ -347,7 +347,7 @@ int Core::loadObject( DataType _type, QString _filename) { ...@@ -347,7 +347,7 @@ int Core::loadObject( DataType _type, QString _filename) {
if ( OpenFlipper::Options::gui() ) { if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename)); coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING ); coreWidget_->setStatus(ApplicationStatus::PROCESSING );
} }
...@@ -374,7 +374,7 @@ int Core::loadObject( DataType _type, QString _filename) { ...@@ -374,7 +374,7 @@ int Core::loadObject( DataType _type, QString _filename) {
} else } else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 ); coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY ); coreWidget_->setStatus(ApplicationStatus::READY );
} }
...@@ -469,7 +469,7 @@ void Core::slotLoad(QString _filename, int _pluginID) { ...@@ -469,7 +469,7 @@ void Core::slotLoad(QString _filename, int _pluginID) {
if ( OpenFlipper::Options::gui() ) { if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename)); coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING ); coreWidget_->setStatus(ApplicationStatus::PROCESSING );
} }
...@@ -482,7 +482,7 @@ void Core::slotLoad(QString _filename, int _pluginID) { ...@@ -482,7 +482,7 @@ void Core::slotLoad(QString _filename, int _pluginID) {
else else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 ); coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() ) if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY ); coreWidget_->setStatus(ApplicationStatus::READY );
} }
...@@ -592,7 +592,7 @@ void Core::slotFileOpened ( int _id ) { ...@@ -592,7 +592,7 @@ void Core::slotFileOpened ( int _id ) {
// ================================================================================ // ================================================================================
// if this is the first object opend, reset the global view // if this is the first object opend, reset the global view
// ================================================================================ // ================================================================================
if ( PluginFunctions::objectCount() == 1 && OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() ) if ( PluginFunctions::objectCount() == 1 && OpenFlipper::Options::gui() && !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
coreWidget_->examiner_widgets_[i]->viewAll(); coreWidget_->examiner_widgets_[i]->viewAll();
} }
......
...@@ -189,8 +189,8 @@ static QString lastDataType_ = "Triangle Mesh"; ...@@ -189,8 +189,8 @@ static QString lastDataType_ = "Triangle Mesh";
/// Should backups be enabled /// Should backups be enabled
static bool enableBackup_ = true; static bool enableBackup_ = true;
/// Currently loading Settings? /// Updates currently blocked?
static bool loadingSettings_ = false; static int sceneGraphUpdatesBlocked_ = 0;
/// Currently loading recent file? /// Currently loading recent file?
static bool loadingRecentFile_ = false; static bool loadingRecentFile_ = false;
...@@ -665,12 +665,22 @@ void enableBackup(bool _enableBackup ) { ...@@ -665,12 +665,22 @@ void enableBackup(bool _enableBackup ) {
enableBackup_ = _enableBackup; enableBackup_ = _enableBackup;
} }
bool loadingSettings( ) { void blockSceneGraphUpdates( ) {
return loadingSettings_; ++sceneGraphUpdatesBlocked_;
} }
void loadingSettings(bool _loadingSettings ) { void unblockSceneGraphUpdates() {
loadingSettings_ = _loadingSettings; if ( sceneGraphUpdatesBlocked_ <= 0)
std::cerr << "Error: More unblocks than blocks! Ignoring this request" << std::endl;
else
--sceneGraphUpdatesBlocked_;
}
bool sceneGraphUpdatesBlocked( ) {
if ( sceneGraphUpdatesBlocked_ < 0)
std::cerr << "Error: updates blocked < 0 ... more unblocks than blocks" << std::endl;
return (sceneGraphUpdatesBlocked_ > 0);
} }
bool savingSettings( ) { bool savingSettings( ) {
......
...@@ -638,18 +638,32 @@ QString helpDirStr(); ...@@ -638,18 +638,32 @@ QString helpDirStr();
/** @} */ /** @} */
//=========================================================================== //===========================================================================
/** @name Settings /** @name Update blocking
* @{ */ *
//=========================================================================== * Used to speedup system when creating/removing a lot of objects.
* This disables the analysis of the scenegraph used for rendering.
* @{ */
//===========================================================================
/// currently loading Settings ? /// Block updates
DLLEXPORT DLLEXPORT
bool loadingSettings( ); void blockSceneGraphUpdates( );
/// currently loading Settings ? /// unblockUpdates
DLLEXPORT DLLEXPORT
void loadingSettings(bool _loadingSettings ); void unblockSceneGraphUpdates();
/// Updates currently blocked?
DLLEXPORT
bool sceneGraphUpdatesBlocked( );
/** @} */
//===========================================================================
/** @name Settings
* @{ */
//===========================================================================
/// currently saving Settings ? /// currently saving Settings ?
DLLEXPORT DLLEXPORT
......
...@@ -833,7 +833,7 @@ void ...@@ -833,7 +833,7 @@ void
CoreWidget::addRecent(QString _filename, DataType _type) CoreWidget::addRecent(QString _filename, DataType _type)
{ {
//dont add objects to recentMenu while loadind Settings //dont add objects to recentMenu while loadind Settings
if ( OpenFlipper::Options::loadingSettings() ) return; if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() ) return;
OpenFlipper::Options::addRecentFile(_filename, _type); OpenFlipper::Options::addRecentFile(_filename, _type);
......
...@@ -269,7 +269,7 @@ int FileOMPlugin::loadTriMeshObject(QString _filename){ ...@@ -269,7 +269,7 @@ int FileOMPlugin::loadTriMeshObject(QString _filename){
//set options //set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default; OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() && if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){ !OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexNormal_->isChecked()) if (loadVertexNormal_->isChecked())
...@@ -348,7 +348,7 @@ int FileOMPlugin::loadPolyMeshObject(QString _filename){ ...@@ -348,7 +348,7 @@ int FileOMPlugin::loadPolyMeshObject(QString _filename){
//set options //set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default; OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() && if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){ !OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexNormal_->isChecked()) if (loadVertexNormal_->isChecked())
......
...@@ -103,7 +103,7 @@ void MeshComparePlugin::initializePlugin() ...@@ -103,7 +103,7 @@ void MeshComparePlugin::initializePlugin()
void MeshComparePlugin::pluginsInitialized() { void MeshComparePlugin::pluginsInitialized() {
//=========================================================== //===========================================================
// Describe scrpting slots // Describe scripting slots
//=========================================================== //===========================================================
emit setSlotDescription(tr("compare(int,int)"), tr("Compare two meshes. Use lastMaximalDistance() and lastMaximalNormalDeviation() to get the results."), emit setSlotDescription(tr("compare(int,int)"), tr("Compare two meshes. Use lastMaximalDistance() and lastMaximalNormalDeviation() to get the results."),
QStringList(tr("ObjectId,ObjectId")), QStringList(tr("Id of the reference mesh, Id of the comparison mesh"))); QStringList(tr("ObjectId,ObjectId")), QStringList(tr("Id of the reference mesh, Id of the comparison mesh")));
......
...@@ -9,8 +9,6 @@ Qt ( >= 4.7.3 ) http://www.qtsoftware.com/downloads ...@@ -9,8 +9,6 @@ Qt ( >= 4.7.3 ) http://www.qtsoftware.com/downloads
OpenGL http://www.opengl.org OpenGL http://www.opengl.org
GLUT http://www.opengl.org/resources/libraries/glut GLUT http://www.opengl.org/resources/libraries/glut
GLEW http://glew.sourceforge.net GLEW http://glew.sourceforge.net
freetype2 optional http://www.freetype.org/freetype2/index.html
ftgl optional http://sourceforge.net/projects/ftgl/
qwt ( >=6.0 ) optional http://qwt.sourceforge.net/ qwt ( >=6.0 ) optional http://qwt.sourceforge.net/
Compiling OpenFlipper: Compiling OpenFlipper:
......
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