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()
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)
coreWidget_->examiner_widgets_[i]->updateGL();
......
......@@ -420,7 +420,7 @@ void Core::openIniFile( QString _filename,
}
// Tell plugins that we are currently reading an ini file
OpenFlipper::Options::loadingSettings(true);
OpenFlipper::Options::blockSceneGraphUpdates();
// Load Core settings only if requested
if ( _coreSettings )
......@@ -525,7 +525,7 @@ void Core::openIniFile( QString _filename,
ini.disconnect();
// 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
// This will also recompute the bounding boxes as well as the near and far plane
......
......@@ -63,7 +63,7 @@
void Core::resetScenegraph( bool _resetTrackBall ) {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() ) {
if ( OpenFlipper::Options::gui() && !OpenFlipper::Options::sceneGraphUpdatesBlocked() ) {
unsigned int maxPases = 1;
ACG::Vec3d bbmin,bbmax;
......@@ -161,7 +161,7 @@ void Core::slotExecuteAfterStartup() {
slotCall( "scripting" ,"clearEditor()",ok);
}
OpenFlipper::Options::loadingSettings(true);
OpenFlipper::Options::blockSceneGraphUpdates();
// Open all files given at the commandline
for ( uint i = 0 ; i < commandLineFileNames_.size() ; ++i ) {
......@@ -181,7 +181,7 @@ void Core::slotExecuteAfterStartup() {
}
}
OpenFlipper::Options::loadingSettings(false);
OpenFlipper::Options::unblockSceneGraphUpdates();
// Reset the scenegraph once to make sure everything is fine
resetScenegraph( true );
......@@ -258,7 +258,7 @@ int Core::loadObject ( QString _filename ) {
if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING );
}
......@@ -286,7 +286,7 @@ int Core::loadObject ( QString _filename ) {
} else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY );
}
......@@ -347,7 +347,7 @@ int Core::loadObject( DataType _type, QString _filename) {
if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING );
}
......@@ -374,7 +374,7 @@ int Core::loadObject( DataType _type, QString _filename) {
} else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY );
}
......@@ -469,7 +469,7 @@ void Core::slotLoad(QString _filename, int _pluginID) {
if ( OpenFlipper::Options::gui() ) {
coreWidget_->statusMessage( tr("Loading %1 ... ").arg(_filename));
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::PROCESSING );
}
......@@ -482,7 +482,7 @@ void Core::slotLoad(QString _filename, int _pluginID) {
else
coreWidget_->statusMessage( tr("Loading %1 ... failed!").arg(_filename), 4000 );
if ( !OpenFlipper::Options::loadingSettings() )
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() )
coreWidget_->setStatus(ApplicationStatus::READY );
}
......@@ -592,7 +592,7 @@ void Core::slotFileOpened ( int _id ) {
// ================================================================================
// 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 ) {
coreWidget_->examiner_widgets_[i]->viewAll();
}
......
......@@ -189,8 +189,8 @@ static QString lastDataType_ = "Triangle Mesh";
/// Should backups be enabled
static bool enableBackup_ = true;
/// Currently loading Settings?
static bool loadingSettings_ = false;
/// Updates currently blocked?
static int sceneGraphUpdatesBlocked_ = 0;
/// Currently loading recent file?
static bool loadingRecentFile_ = false;
......@@ -665,12 +665,22 @@ void enableBackup(bool _enableBackup ) {
enableBackup_ = _enableBackup;
}
bool loadingSettings( ) {
return loadingSettings_;
void blockSceneGraphUpdates( ) {
++sceneGraphUpdatesBlocked_;
}
void loadingSettings(bool _loadingSettings ) {
loadingSettings_ = _loadingSettings;
void unblockSceneGraphUpdates() {
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( ) {
......
......@@ -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.
* @{ */
//===========================================================================
/// Block updates
DLLEXPORT
void blockSceneGraphUpdates( );
/// currently loading Settings ?
/// unblockUpdates
DLLEXPORT
bool loadingSettings( );
void unblockSceneGraphUpdates();
/// currently loading Settings ?
/// Updates currently blocked?
DLLEXPORT
void loadingSettings(bool _loadingSettings );
bool sceneGraphUpdatesBlocked( );
/** @} */
//===========================================================================
/** @name Settings
* @{ */
//===========================================================================
/// currently saving Settings ?
DLLEXPORT
......
......@@ -833,7 +833,7 @@ void
CoreWidget::addRecent(QString _filename, DataType _type)
{
//dont add objects to recentMenu while loadind Settings
if ( OpenFlipper::Options::loadingSettings() ) return;
if ( OpenFlipper::Options::sceneGraphUpdatesBlocked() ) return;
OpenFlipper::Options::addRecentFile(_filename, _type);
......
......@@ -269,7 +269,7 @@ int FileOMPlugin::loadTriMeshObject(QString _filename){
//set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() &&
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexNormal_->isChecked())
......@@ -348,7 +348,7 @@ int FileOMPlugin::loadPolyMeshObject(QString _filename){
//set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() &&
if ( !OpenFlipper::Options::sceneGraphUpdatesBlocked() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexNormal_->isChecked())
......
......@@ -103,7 +103,7 @@ void MeshComparePlugin::initializePlugin()
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."),
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
OpenGL http://www.opengl.org
GLUT http://www.opengl.org/resources/libraries/glut
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/
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