Developer Documentation
Core.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 
44 
45 
46 
47 
48 //=============================================================================
49 //
50 // CLASS Core - IMPLEMENTATION
51 //
52 //=============================================================================
53 
54 
55 //== INCLUDES =================================================================
56 
57 // -------------------- mview
58 #include "Core.hh"
59 // -------------------- ACG
60 
61 #include <ACG/QtWidgets/QtFileDialog.hh>
62 // -------------------- Qt
63 
64 
69 #include "OpenFlipper/BasePlugin/TextureInterface.hh"
70 #include "OpenFlipper/BasePlugin/INIInterface.hh"
71 
72 #include <OpenFlipper/common/RecentFiles.hh>
73 
74 #include "OpenFlipper/BasePlugin/PluginFunctionsCore.hh"
75 
77 
79 
82 
83 #include <OpenFlipper/widgets/messageBox/StaysOnTopMessageBox.hh>
84 
86 
87 #include <ACG/Scenegraph/MaterialNode.hh>
88 #include <ACG/Scenegraph/SeparatorNode.hh>
89 
90 #define WIDGET_HEIGHT 800
91 #define WIDGET_WIDTH 800
92 
93 //== IMPLEMENTATION ==========================================================
94 
103 Core::
104 Core() :
105  QObject(),
106  capture_(false),
107  processManager_(0),
108  nextBackupId_(0),
109  nextBackupGroupId_(0),
110  objectRoot_(0),
111  coreWidget_(0),
112  splash_(0)
113 {
114 
115  //init logFile
116  logStream_ = 0;
117  logFile_ = 0;
118 
119  //init nodes
120  root_node_scenegraph_ = new ACG::SceneGraph::SeparatorNode(0, "SceneGraph Root Node");
121 
122  // init global data node
124 
125  // This separator will manage the cores nodes
127 
128  // Coordsys rendering nodes
129  coordsysMaterialNode_ = new ACG::SceneGraph::MaterialNode(core_nodes_,"Coordsys Material Node");
132 
133  // Separator handling the nodes for data
135 
136  // Separator handling the nodes for data
138 
139  // Add ViewMode All
140  ViewMode* vm = new ViewMode();
141  vm->name = "All";
142  vm->icon = "viewmode_all.png";
143  vm->custom = false;
144  vm->visibleToolboxes = QStringList();
145 
146  viewModes_.push_front(vm);
147 
148  //init ViewerProperties (always for 4 Viewers!)
149  std::vector< Viewer::ViewerProperties* > viewerProperties;
150 
151  for (int i=0; i < 4; i++) {
152  Viewer::ViewerProperties* viewerProperty = new Viewer::ViewerProperties(i);
153  viewerProperty->snapshotBaseFileName("snap-Viewer-" + QString::number(i) + ".png");
154  viewerProperties.push_back( viewerProperty );
155  }
156 
157  PluginFunctions::setViewerProperties(viewerProperties);
158 
159  //set viewer defaults
160  OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_FREE, 0 );
161  OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_TOP, 1 );
162  OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_LEFT, 2 );
163  OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_FRONT, 3 );
164 
165  // Get all relevant Paths and Options from option files
166  setupOptions();
167 
168  // set discriptions for scriptable slots
169  setDescriptions();
170 
171  // Initialize the build in dataTypes
172  initializeTypes();
173 
174  // Initialize the build in updateTypes
175  initializeUpdateTypes();
176 }
177 
187 void
189 
190  // Check library versions
192 
193  // Make root_node available to the plugins ( defined in PluginFunctions.hh)
195 
196  // Topmost node of the scenegraph
198 
199  // Node below the global status nodes. All nodes with global rendering
200  // will be attached here.
202 
203  // Initialize the first object as the root Object for the object tree
204  objectRoot_ = dynamic_cast< BaseObject* > ( new GroupObject("ObjectRoot") );
206 
207  // Bring up the object manager ( has to be done after the rootobject is created)
208  connect(getObjectManager(),SIGNAL(newObject(int)), this ,SLOT(newObject(int)));
209 
210  connect(getObjectManager(),SIGNAL(deletedObject(int)), this ,SLOT(deletedObject(int)));
211 
212  if ( OpenFlipper::Options::gui() ) {
213 
214  // Initialize redraw timer. Will be used to restrict the rendering framerate.
215  redrawTimer_ = new QTimer();
216  redrawTimer_->setSingleShot(true);
217  connect(redrawTimer_, SIGNAL(timeout()), this, SLOT(updateView()),Qt::DirectConnection);
218 
219  // Initialice scenegraph check timer. Will be used to check for changes in the scenegraph
220  scenegraphCheckTimer_ = new QTimer();
221  scenegraphCheckTimer_->setSingleShot(false);
222  connect(scenegraphCheckTimer_, SIGNAL(timeout()), this, SLOT(checkScenegraphDirty()),Qt::DirectConnection);
223 
224  // Will measure the time between redraws
225  redrawTime_ = new QTime();
226  redrawTime_->start ();
227 
228  if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
229  QPixmap splashPixmap(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "splash.png");
230 
231  splash_ = new QSplashScreen(splashPixmap, Qt::SplashScreen | Qt::WindowStaysOnTopHint);
232  splash_->show();
233 
234  splash_->showMessage(tr("Initializing mainwindow") ,
235  Qt::AlignBottom | Qt::AlignLeft , Qt::white);
236  }
237 
239 
240  spinBoxEventFilter_.registerScrollArea(coreWidget_->getToolboxScrollArea());
241  spinBoxEventFilter_.registerScrollArea(coreWidget_->getToolboxArea());
242  spinBoxEventFilter_.registerScrollArea(coreWidget_->getToolbox());
243 
244  connect(coreWidget_, SIGNAL(clearAll()) , this, SLOT(clearAll()));
245  connect(coreWidget_, SIGNAL(loadMenu()) , this, SLOT(loadObject()));
246  connect(coreWidget_, SIGNAL(addEmptyObjectMenu()) , this, SLOT(slotAddEmptyObjectMenu()));
247  connect(coreWidget_, SIGNAL(saveMenu()) , this, SLOT(saveAllObjects()));
248  connect(coreWidget_, SIGNAL(saveToMenu()) , this, SLOT(saveAllObjectsTo()));
249  connect(coreWidget_, SIGNAL(loadIniMenu()) , this, SLOT(loadSettings()));
250  connect(coreWidget_, SIGNAL(saveIniMenu()) , this, SLOT(saveSettings()));
251  connect(coreWidget_, SIGNAL(applyOptions()) , this, SLOT(applyOptions()));
252  connect(coreWidget_, SIGNAL(saveOptions()) , this, SLOT(saveOptions()));
253  connect(coreWidget_, SIGNAL(recentOpen(QAction*)) , this, SLOT(slotRecentOpen(QAction*)));
254  connect(coreWidget_, SIGNAL(exit()) , this, SLOT(slotExit()), Qt::QueuedConnection); // queue to avoid destroying the core widget during event handling
255 
256 
257  connect( coreWidget_, SIGNAL( resizeViewers(int,int) ), this, SLOT( resizeViewers(int,int) ) );
258  connect( coreWidget_, SIGNAL( resizeApplication(int,int) ), this, SLOT( resizeApplication(int,int) ) );
259  connect( coreWidget_, SIGNAL( stopVideoCapture() ), this, SLOT( stopVideoCapture() ) );
260  connect( coreWidget_, SIGNAL( startVideoCapture(QString,int,bool) ), this, SLOT( startVideoCapture(QString,int,bool) ) );
261  connect( coreWidget_, SIGNAL( dragOpenFile(QString)), this, SLOT(loadObject(QString)));
262 
263  connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins()));
264 
265  connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&)));
266 
267  connect( coreWidget_->logWidget_->openMeshFilterAction_,SIGNAL(toggled(bool)), this, SLOT(enableOpenMeshErrorLog(bool)) );
268 
269  QRect rect = QApplication::desktop()->screenGeometry();
270 
271  uint width = rect.width();
272  if ( width > 1000 ) {
273  width = 1000;
274  }
275 
276  uint height = rect.height();
277  if ( height > 1000 ) {
278  height = 1000;
279  }
280 
281 #ifdef ARCH_DARWIN
282  width = rect.width() - 300;
283  height = rect.height() - 150;
284 
285 // coreWidget_->setMaximumSize( width, height );
286 #endif
287 
288  coreWidget_->resize(width,height);
289 
290 
291  // Sanity check for OpenGL capabilities!
293 
294 
295  QString titleInfo = OpenFlipper::Options::windowTitle();
296 
297  #ifdef DEBUG
298  titleInfo = titleInfo + " [DEBUG]";
299  #endif
300 
301  if ( OpenFlipper::Options::coreProfile() )
302  titleInfo = titleInfo + " CoreProfile";
303  else
304  titleInfo = titleInfo + " CompatProfile";
305 
306  coreWidget_->setWindowTitle( titleInfo );
307 
308  }
309 
310  // ======================================================================
311  // Create intermediate logger class for Core which will mangle the output
312  // ======================================================================
313  PluginLogger* newlog = new PluginLogger("Core");
314 
315  loggers_.push_back(newlog);
316  connect(this,SIGNAL(log(Logtype, QString )),newlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
317  connect(this,SIGNAL(log(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
318 
319  // Connect it to the Master logger
320  if ( OpenFlipper::Options::gui() )
321  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
322 
323  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
324 
325  // connection to file logger
326  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
327 
328  // ======================================================================
329  // Create a logger class for CoreWidget
330  // ======================================================================
331 
332  if ( OpenFlipper::Options::gui() ){
333  PluginLogger* widgetlog = new PluginLogger("CoreWidget");
334 
335  loggers_.push_back(widgetlog);
336  connect(coreWidget_,SIGNAL(log(Logtype, QString )),widgetlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
337  connect(coreWidget_,SIGNAL(log(QString )),widgetlog,SLOT(slotLog(QString )),Qt::DirectConnection);
338 
339  // Connect it to the Master logger
340  connect(widgetlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
341  connect(widgetlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
342  // connection to file logger
343  connect(widgetlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
344  }
345 
346  // ======================================================================
347  // Catch OpenMesh Error logs with an own Logger
348  // ======================================================================
349  newlog = new PluginLogger("Core ( OpenMesh )",LOGERR);
350  omerr().connect(*newlog);
351  omerr().disconnect(std::cerr);
352 
353  loggers_.push_back(newlog);
354 
355  // Connect it to the Master logger
356  if ( OpenFlipper::Options::gui() )
357  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
358 
359  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
360  // connection to file logger
361  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
362 
363  // ======================================================================
364  // Catch OpenMesh omout logs with an own Logger
365  // ======================================================================
366  newlog = new PluginLogger("Core ( OpenMesh )",LOGINFO);
367  omout().connect(*newlog);
368  omout().disconnect(std::cout);
369 
370  loggers_.push_back(newlog);
371 
372  // Connect it to the Master logger
373  if ( OpenFlipper::Options::gui() )
374  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
375 
376  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
377  // connection to file logger
378  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
379 
380  // ======================================================================
381  // Catch OpenMesh omlog logs with an own Logger
382  // ======================================================================
383  newlog = new PluginLogger("Core ( OpenMesh )",LOGOUT);
384  omlog().connect(*newlog);
385 
386  loggers_.push_back(newlog);
387 
388  // Connect it to the Master logger
389  if ( OpenFlipper::Options::gui() )
390  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
391 
392  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
393  // connection to file logger
394  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
395 
396  // ======================================================================
397  // Log Scripting stuff through a separate logger
398  // ======================================================================
399  newlog = new PluginLogger("Scripting",LOGOUT);
400 
401  loggers_.push_back(newlog);
402 
403  // Connect it to the Master logger
404  if ( OpenFlipper::Options::gui() )
405  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
406 
407  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
408  // connection to file logger
409  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
410 
411  // connect signal to logger
412  connect(this,SIGNAL(scriptLog(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
413 
414 
415  // ======================================================================
416  // Set up QtScript Environment
417  // ======================================================================
418 
419  // Set a reference to the scriptengine for simple rpc calls
421 
422  connect(&scriptEngine_, SIGNAL( signalHandlerException(const QScriptValue &) ), this, SLOT( slotScriptError(const QScriptValue &) ));
423 
424  // process Events every 500 msecs during script execution
425  scriptEngine_.setProcessEventsInterval( 500 );
426 
427  // Register own print function :
428  QScriptValue printFunction = scriptEngine_.newFunction(myPrintFunction);
429  printFunction.setProperty("textedit",scriptEngine_.newQObject(this));
430  scriptEngine_.globalObject().setProperty("print", printFunction);
431 
432  // Register print to file function :
433  QScriptValue printToFileFunc = scriptEngine_.newFunction(printToFileFunction);
434  scriptEngine_.globalObject().setProperty("printToFile", printToFileFunc);
435  scriptingFunctions_.push_back( "-.printToFile(QString,QString)" );
436 
437  // Register help function :
438  QScriptValue helpFunc = scriptEngine_.newFunction(helpFunction);
439  helpFunc.setProperty("core",scriptEngine_.newQObject(this));
440  scriptEngine_.globalObject().setProperty("help", helpFunc);
441  scriptingFunctions_.push_back( "-.help(QString)" );
442 
443  // Register IdList Type to scripting Engine
444  qScriptRegisterSequenceMetaType< IdList >(&scriptEngine_);
445 
446  // Register Vector of ints Type to scripting Engine
447  qScriptRegisterSequenceMetaType< QVector< int > >(&scriptEngine_);
448 
449  //==========================================================================
450  // Register the 3d Vector Type to the core ( is Vec3d )
451  //==========================================================================
452  qScriptRegisterMetaType(&scriptEngine_,
453  toScriptValueVector,
454  fromScriptValueVector,
455  scriptEngine_.newQObject(&vec3dPrototype_));
456 
457  // set a constructor to allow creation via Vector(x,y,z)
458  QScriptValue ctorVec3 = scriptEngine_.newFunction(createVector);
459  scriptEngine_.globalObject().setProperty("Vector", ctorVec3);
460 
461  //==========================================================================
462  // Register the 4d Vector Type to the core ( is Vec4d )
463  //==========================================================================
464  qScriptRegisterMetaType(&scriptEngine_,
465  toScriptValueVector4,
466  fromScriptValueVector4,
467  scriptEngine_.newQObject(&vec4dPrototype_));
468 
469  // set a constructor to allow creation via Vector(x,y,z)
470  QScriptValue ctorVec4 = scriptEngine_.newFunction(createVector4);
471  scriptEngine_.globalObject().setProperty("Vector4", ctorVec4);
472 
473  //==========================================================================
474  // Register the DataType Class to the core
475  //==========================================================================
476 
477  // Register DataType in QScriptEngine
478  qScriptRegisterMetaType<DataType>(&scriptEngine_,
479  toScriptValueDataType,
480  fromScriptValueDataType,
481  scriptEngine_.newQObject(&DataTypePrototype_));
482 
483  // set a constructor to allow creation via DataType(uint)
484  QScriptValue dataTypector = scriptEngine_.newFunction(createDataType);
485  scriptEngine_.globalObject().setProperty("DataType", dataTypector);
486 
487  //==========================================================================
488  // Register the Matrix Class to the core
489  //==========================================================================
490 
491  // Register Matrix Type to scripting Engine ( is ACG::Matrix4x4d )
492  qScriptRegisterMetaType(&scriptEngine_,
493  toScriptValueMatrix4x4 ,
494  fromScriptValueMatrix4x4,
495  scriptEngine_.newQObject(&matrix4x4Prototype_));
496 
497  // set a constructor to allow creation via Matrix(x,y,z)
498  QScriptValue matrix4x4ctor = scriptEngine_.newFunction(createMatrix4x4);
499  scriptEngine_.globalObject().setProperty("Matrix4x4", matrix4x4ctor);
500 
501  //==========================================================================
502  // Collect Core scripting information
503  //==========================================================================
504 
505  QScriptValue scriptInstance = scriptEngine_.newQObject(this,
506  QScriptEngine::QtOwnership,
507  QScriptEngine::ExcludeChildObjects |
508  QScriptEngine::ExcludeSuperClassMethods |
509  QScriptEngine::ExcludeSuperClassProperties
510  );
511 
512  scriptEngine_.globalObject().setProperty("core", scriptInstance);
513 
514  QScriptValueIterator it(scriptInstance);
515  while (it.hasNext()) {
516  it.next();
517 
519  if ( checkSignal( this, it.name().toLatin1() ) )
520  continue;
521 
522  scriptingFunctions_.push_back( "core." + it.name() );
523 
524  }
525 
526  loadPlugins();
527 
528  if ( OpenFlipper::Options::gui() ) {
529 
530  //register keyBinding for all scripting slots
532 
533  //get keyAssignments from config files
535 
536  if ( OpenFlipper::Options::currentViewMode( ) != "" )
537  coreWidget_->setViewMode( OpenFlipper::Options::currentViewMode() );
538  else
539  coreWidget_->setViewMode("All");
540 
541  // Set the renderer to the one stored in the settings or to default
542  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
543  connect( coreWidget_->examiner_widgets_[i], SIGNAL(signalMouseEvent(QMouseEvent*)),
544  this , SLOT(slotMouseEvent(QMouseEvent*)));
545  connect( coreWidget_->examiner_widgets_[i], SIGNAL(signalMouseEventIdentify(QMouseEvent*)),
546  this , SLOT(slotMouseEventIdentify(QMouseEvent*)));
547  connect( coreWidget_->examiner_widgets_[i], SIGNAL(signalMouseEventLight(QMouseEvent*)),
548  this , SLOT(slotMouseEventLight(QMouseEvent*)));
549  connect( coreWidget_->examiner_widgets_[i], SIGNAL(signalWheelEvent(QWheelEvent *, const std::string &)),
550  this , SLOT(slotWheelEvent(QWheelEvent *, const std::string &)));
551 
552  connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewUpdated() ),
553  this, SLOT( viewUpdated()) ,Qt::DirectConnection);
554 
555  connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewChanged() ),
556  coreWidget_->examiner_widgets_[i], SLOT( updateGL() ) ,Qt::DirectConnection);
557 
558  // Set post processor
560 
561  // ====================================================
562  // Set renderer
563  // ====================================================
564 
565  QString defaultRendererKey = "Viewer" + QString::number(i)+"/DefaultRenderer";
566  QString defaultRendererName = OpenFlipperSettings().value(defaultRendererKey,"Default Classical Renderer Plugin").toString();
567 
568  // Check if the renderer is there
569  int defaultRendererId = renderManager().getRendererId(defaultRendererName);
570 
571  if ( defaultRendererId == -1 ) {
572  emit log(LOGERR,tr("Stored default renderer \"") + defaultRendererName + tr("\" is not available, trying Classical!"));
573 
574  // Check if the renderer is there
575  defaultRendererId = renderManager().getRendererId("Default Classical Renderer Plugin");
576 
577  // Classical available?
578  if ( defaultRendererId != -1 ) {
579  renderManager().setActive(defaultRendererId,i);
580  } else {
581  emit log(LOGERR,tr("Default classical renderer is also not available. Trying to use any other renderer i can find!"));
582 
583  // debug information for this case, print renderer count and their names
584  const unsigned int rendererCount = renderManager().available();
585  emit log(LOGERR,tr("Currently ") + QString::number(rendererCount) + tr(" renderers are available:") );
586  for (unsigned int i = 0 ; i < rendererCount ; ++i )
587  emit log(LOGERR, tr("Renderer ") + QString::number(i) + ": " + renderManager()[i]->name );
588  }
589 
590  } else {
591  renderManager().setActive(defaultRendererId,i);
592  }
593 
594  }
595 
596  // Warn the user in the log and via messagebox, that he is using the build in renderer only
597  if ( renderManager().available() == 1 ) {
598  finishSplash();
599  emit log(LOGERR,tr("No external plugin renderers available!"));
600  emit log(LOGERR,tr("The build in renderer is only a very limited one and is missing many features!"));
601  emit log(LOGERR,tr("You should build and use the other renderers!"));
602 
603  StaysOnTopMessageBox::warning(0,tr( "No external plugin renderers available!"),tr("The build in renderer is only a very limited one and is missing many features.\nYou should build and use the other free renderers shipped with OpenFlipper."));
604  }
605 
606  }
607 
608  // ===============================================================================================
609  // Load Settings from configuration files
610  // ===============================================================================================
611 
612  QStringList optionFiles = OpenFlipper::Options::optionFiles();
613  for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
614 
615  if (splash_) {
616  splash_->showMessage(tr("Loading Configuration File %1/%2").arg(i+1).arg(optionFiles.size()),
617  Qt::AlignBottom | Qt::AlignLeft , Qt::white);
618  }
619 
620  // Load global ini files. Use only plugin global options from these files as the
621  // rest has been loaded at the beginning.
622  if ( OpenFlipper::Options::gui() )
624 
625  openIniFile( optionFiles[i] ,false,true,false);
626  }
627 
628  if (splash_)
629  splash_->clearMessage();
630 
631  // ===============================================================================================
632  // Load Settings from configuration files
633  // ===============================================================================================
634 
635  if ( OpenFlipper::Options::lang().contains("UTF") || OpenFlipper::Options::lang().contains("utf") ) {
636  emit log(LOGWARN,tr("UTF8-Locale used!"));
637 // emit log(LOGWARN,"Only OFF files are fully supported with UTF8. Others might fail.");
638 // emit log(LOGWARN,"You can change your locale by :");
639 // emit log(LOGWARN,"export LANG=C");
640 // emit log(LOGWARN,"Work is in progress to resolve this issue.");
641  }
642 
643  if ( OpenFlipper::Options::gui() ) {
644 
645  QFile statesFile(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "WindowStates.dat");
646 
647  if (statesFile.exists() ) {
648  QSettings windowStates(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "WindowStates.dat", QSettings::IniFormat);
649 
650  //try to restore the windowState
651  coreWidget_->restoreState (windowStates.value("Core/Window/State").toByteArray ());
652  //try to restore the geometry
653  coreWidget_->restoreGeometry (windowStates.value("Core/Window/Geometry").toByteArray ());
654 
655  coreWidget_->toolSplitter_->restoreState (windowStates.value("Core/ToolSplitter").toByteArray ());
656  coreWidget_->splitter_->restoreState (windowStates.value("Core/LogSplitter").toByteArray ());
657 
658  coreWidget_->show();
659 
660  applyOptions();
661 
662  windowStates.beginGroup ("Core");
663  windowStates.beginGroup ("LogSlider");
664  coreWidget_->slidingLogger_->restoreState (windowStates);
665  windowStates.endGroup ();
666  coreWidget_->toolBox_->restoreState (windowStates);
667  windowStates.endGroup ();
668 
669 
670  // Restore if window was maximized or not
671  if ( windowStates.value("Core/Window/WindowState",false).toBool() )
672  coreWidget_->setWindowState( coreWidget_->windowState() | Qt::WindowMaximized );
673 
674  } else {
675 
676  coreWidget_->show();
677 
678  applyOptions();
679 
680  }
681 
682  if ( splash_ ) {
683  splash_->raise();
684  splash_->showMessage(tr("Ready."), Qt::AlignBottom | Qt::AlignLeft , Qt::white);
685  finishSplash();
686  }
687 
688  // start checking for scenegraph changes
689  scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
690  scenegraphCheckTimer_->start ();
691  }
692 
693  // System is ready now.
694  OpenFlipper::Options::finishedStartup();
695 
696  QTimer::singleShot(100, this, SLOT(slotExecuteAfterStartup()));
697 }
698 
699 
700 //-----------------------------------------------------------------------------
701 
703 {
704 
705  // Delete the objectRoot if it was constructed
706  if ( objectRoot_ != 0 ) {
708  delete objectRoot_;
709  }
710 
711  // Clean up loggers
712  for ( uint i = 0 ; i < loggers_.size(); ++i )
713  delete loggers_[i];
714 
715  delete coreWidget_;
716 }
717 
718 //-----------------------------------------------------------------------------
719 
720 std::vector<PluginInfo>& Core::plugins() {
721  return PluginStorage::plugins();
722 };
723 
724 //-----------------------------------------------------------------------------
725 
726 void
727 Core::slotMouseEventIdentify( QMouseEvent* _event )
728 {
729 // // Dont do anything as a context Menu will popup on right button click
730 // if ( _event->button() == Qt::RightButton )
731 // return;
732 
733  // Only catch left-button clicks
734  if(_event->button() != Qt::LeftButton) return;
735 
736  const QObject* senderPointer = sender();
737  unsigned int examinerId = 0;
738 
739  if ( senderPointer == 0 ) {
740  std::cerr << "Error : slotMouseEventIdentify directly called! This should only be called by an examiner" << std::endl;
741  } else {
742  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
743  if ( senderPointer == coreWidget_->examiner_widgets_[i] ) {
744  examinerId = i;
745  if ( OpenFlipper::Options::doSlotDebugging() )
746  emit log(LOGINFO,tr("slotMouseEventIdentify from examiner ") + QString::number(i) );
747  break;
748  }
749  }
750 
751  }
752 
754 
755  // Do picking
756  size_t node_idx, target_idx;
757  ACG::Vec3d hit_point;
758 
759  if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point)) {
760 
761  BaseObjectData* object = 0;
762 
763  if(PluginFunctions::getPickedObject(node_idx, object)) {
764  // Request type information widget
765  InformationInterface* infoPlugin = 0;
766  infoPlugin = getInfoPlugin(object->dataType());
767  if(infoPlugin != 0)
768  infoPlugin->slotInformationRequested(_event->pos(), object->dataType());
769  }
770  }
771 }
772 
773 //-----------------------------------------------------------------------------
774 
775 void
776 Core::slotMouseEventLight( QMouseEvent* _event )
777 {
778  const QObject* senderPointer = sender();
779  unsigned int examinerId = 0;
780 
781  if ( senderPointer == 0 ) {
782  std::cerr << "Error : slotMouseEventLight directly called! This should only be called by an examiner" << std::endl;
783  } else {
784  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
785  if ( senderPointer == coreWidget_->examiner_widgets_[i] ) {
786  examinerId = i;
787  if ( OpenFlipper::Options::doSlotDebugging() )
788  emit log(LOGINFO,tr("slotMouseEventLight from examiner ") + QString::number(i) );
789  break;
790  }
791  }
792 
793  }
794 
796 
797  emit PluginMouseEventLight( _event );
798 
799 
800 }
801 
802 //-----------------------------------------------------------------------------
803 
804 
805 void
806 Core::slotMouseEvent( QMouseEvent* _event )
807 {
808 // // Dont do anything as a context Menu will popup on right button click
809 // if ( _event->button() == Qt::RightButton )
810 // return;
811 
812  const QObject* senderPointer = sender();
813  unsigned int examinerId = 0;
814 
815  if ( senderPointer == 0 ) {
816  std::cerr << "Error : slotMouseEvent directly called! This should only be called by an examiner" << std::endl;
817  } else {
818  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
819  if ( senderPointer == coreWidget_->examiner_widgets_[i] ) {
820  examinerId = i;
821  if ( OpenFlipper::Options::doSlotDebugging() ) {
822  QString message = tr("slotMouseEvent from examiner ") + QString::number(i) + " with ";
823 
824  if ( _event->type() == QEvent::MouseButtonRelease )
825  message += " MouseButtonRelease";
826  else if ( _event->type() == QEvent::MouseButtonPress )
827  message += " MouseButtonRelease";
828  else if ( _event->type() == QEvent::MouseButtonDblClick )
829  message += " MouseButtonDblClick";
830  else if ( _event->type() == QEvent::MouseMove )
831  message += " MouseMove";
832  else
833  message += tr("unknown event type");
834 
835  emit log(LOGINFO,message );
836  }
837 
838  break;
839 
840  }
841  }
842 
843  }
844 
846 
847  emit PluginMouseEvent(_event );
848 }
849 
850 //-----------------------------------------------------------------------------
851 
852 void
853 Core::slotWheelEvent( QWheelEvent * _event, const std::string & _mode)
854 {
855  const QObject* senderPointer = sender();
856  unsigned int examinerId = 0;
857 
858  if ( senderPointer == 0 ) {
859  std::cerr << "Error : slotWheelEvent directly called! This should only be called by an examiner" << std::endl;
860  } else {
861  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
862  if ( senderPointer == coreWidget_->examiner_widgets_[i] ) {
863  examinerId = i;
864  break;
865  }
866  }
867 
868  }
869 
871 
872  emit PluginWheelEvent(_event , _mode );
873 }
874 
875 //-----------------------------------------------------------------------------
876 
877 void
878 Core::slotAddPickMode( const std::string& _mode ) {
879  if ( OpenFlipper::Options::gui() )
880  coreWidget_->addPickMode(_mode);
881 
882 }
883 
884 //-----------------------------------------------------------------------------
885 
886 void
887 Core::slotAddHiddenPickMode( const std::string& _mode ) {
888 
889  if ( OpenFlipper::Options::gui() )
890  coreWidget_->addPickMode(_mode,false,1000,false);
891 
892 }
893 
894 //-----------------------------------------------------------------------------
895 
899 {
900 
901  if (OpenFlipper::Options::doSlotDebugging()) {
902  if (sender() != 0) {
903  if (sender()->metaObject() != 0) {
904  emit log(LOGINFO, tr("updateView() called by ") + QString(sender()->metaObject()->className()));
905  }
906  }
907  }
908 
909  if (!OpenFlipper::Options::gui())
910  return;
911 
912  if (OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate", false).toBool()) {
913 
914  int elapsed = redrawTime_->elapsed();
915 
916  if (elapsed < 1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate", 35).toInt()) {
917  // redraw time not reached ... waiting for timer event for next redraw
918  if (redrawTimer_->isActive()) {
919  if (OpenFlipper::Options::doSlotDebugging())
920  emit log(LOGINFO,
921  tr("Too early for redraw! Delaying request from ") + QString(sender()->metaObject()->className()));
922  return;
923  }
924 
925  // Start the timer
926  redrawTimer_->start((1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate", 35).toInt()) - elapsed);
927  return;
928  } else if (redrawTimer_->isActive())
929  redrawTimer_->stop();
930 
931  }
932 
933  redrawTime_->restart();
934 
935  if (!OpenFlipper::Options::sceneGraphUpdatesBlocked() && !OpenFlipper::Options::redrawDisabled()) {
936 
937  for (unsigned int i = 0; i < OpenFlipper::Options::examinerWidgets(); ++i)
938  coreWidget_->examiner_widgets_[i]->updateGL();
939 
940  // Inform plugins of the scene update
941  emit pluginSceneDrawn();
942  }
943 
944 
945 }
946 
947 //-----------------------------------------------------------------------------
948 
950  QApplication::processEvents();
951 }
952 
953 //-----------------------------------------------------------------------------
954 
955 void Core::blockScenegraphUpdates(bool _block) {
956  if (_block)
957  OpenFlipper::Options::blockSceneGraphUpdates();
958  else
959  OpenFlipper::Options::unblockSceneGraphUpdates();
960 }
961 
962 //-----------------------------------------------------------------------------
963 
967  if ( true )
968  {
969  // This is a single pass traversal as we only need to check if there is still one node dirty in the graph
972 
973  // If the scenegraph is dirty, we have to redraw
974  if ( action.isDirty () )
975  emit updateView ();
976  }
977 }
978 
979 //-----------------------------------------------------------------------------
980 
981 void Core::restrictFrameRate( bool _enable ) {
982  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",_enable);
983 }
984 
985 //-----------------------------------------------------------------------------
986 
987 void Core::setMaxFrameRate( int _rate ) {
988  OpenFlipperSettings().setValue("Core/Gui/glViewer/maxFrameRate",_rate);
989  OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",true);
990 
991  // update Timer to new framerate
992  scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
993 }
994 
995 //-----------------------------------------------------------------------------
996 
997 void
999 {
1000 
1002 
1003  emit allCleared();
1004 
1005  slotScriptInfo( "core" , "clearAll()" );
1006 }
1007 
1008 //-----------------------------------------------------------------------------
1009 
1010 void
1012 {
1013  QTimer* timer = new QTimer();
1014  connect(timer, SIGNAL(timeout()), this, SLOT(slotExit()));
1015  timer->start(100);
1016 
1017 
1018  QApplication::quit();
1019 }
1020 
1021 //-----------------------------------------------------------------------------
1022 
1023 void Core::fullscreen( bool _state ) {
1024  if ( OpenFlipper::Options::gui() )
1025  coreWidget_->setFullscreen(_state);
1026 }
1027 
1028 //-----------------------------------------------------------------------------
1029 
1030 void Core::showViewModeControls( bool _show ) {
1031  if ( OpenFlipper::Options::gui() ) {
1033  }
1034 }
1035 
1036 //-----------------------------------------------------------------------------
1037 
1038 void Core::loggerState(int _state) {
1040  if ( OpenFlipper::Options::gui() &&
1041  (state == OpenFlipper::Options::Hidden ||
1042  state == OpenFlipper::Options::InScene ||
1043  state == OpenFlipper::Options::Normal))
1044  coreWidget_->showLogger(state);
1045 }
1046 
1047 //-----------------------------------------------------------------------------
1048 
1049 void Core::enableOpenMeshErrorLog(bool _state) {
1050  std::cerr << "Script" << std::endl;
1051 
1052  // Set the state on openmesh stream
1053  if ( _state ) {
1054  omerr().enable();
1055  } else {
1056  omerr().disable();
1057  }
1058 
1059  if ( OpenFlipper::Options::gui() ) {
1060  // store in application settings
1061  OpenFlipperSettings().setValue("Core/Gui/LogWindow/OpenMeshErrors",_state);
1062 
1063  coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(true);
1064  coreWidget_->logWidget_->openMeshFilterAction_->setChecked(_state);
1065  coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(false);
1066  }
1067 
1068 }
1069 
1070 //-----------------------------------------------------------------------------
1071 
1072 void Core::showToolbox( bool _state ) {
1073  if ( OpenFlipper::Options::gui() )
1074  coreWidget_->showToolbox(_state);
1075 }
1076 
1077 //-----------------------------------------------------------------------------
1078 
1079 void Core::showStatusBar( bool _state ) {
1080  if ( OpenFlipper::Options::gui() )
1081  coreWidget_->showStatusBar(_state);
1082 }
1083 
1084 //-----------------------------------------------------------------------------
1085 
1086 void Core::multiViewMode( int _mode ) {
1087  if ( !OpenFlipper::Options::gui() || !OpenFlipperSettings().value("Core/Gui/glViewer/useMultipleViewers",true).toBool() )
1088  return;
1089 
1090  coreWidget_->setViewerLayout(_mode);
1091 
1092 }
1093 
1094 
1095 
1096 
1097 //-----------------------------------------------------------------------------
1098 
1099 void
1100 Core::slotRecentOpen(QAction* _action)
1101 {
1102  // Get the recent files lists and datatypes
1103  QStringList recentFiles = OpenFlipperSettings().value("Core/File/RecentFiles", QStringList()).toStringList();
1104  QStringList recentTypes = OpenFlipperSettings().value("Core/File/RecentTypes", QStringList()).toStringList();
1105 
1106  // The type of the file to open is attached to the action as a string.
1107  // the name is the actions text
1108  QString actionTypeName = _action->data().toString();
1109 
1110  // Iterate over all recent files
1111  for (int i = 0 ; i < recentFiles.size() ; ++i )
1112 
1113  // If the name matches and also the type, we open it.
1114  if ( (recentFiles[i] == _action->text()) && ( actionTypeName == recentTypes[i] ) ){
1115 
1116  OpenFlipper::Options::loadingRecentFile(true);
1117  loadObject(typeId(recentTypes[i]), recentFiles[i]);
1118  coreWidget_->addRecent(recentFiles[i],typeId(recentTypes[i]) );
1119  OpenFlipper::Options::loadingRecentFile(false);
1120 
1121  return;
1122  }
1123 
1124  emit log(LOGERR, tr("Unable to open recent. Unable to find %1 with datatype %2 in recent files list.").arg(_action->text()).arg(actionTypeName) );
1125 
1126 }
1127 
1128 //-----------------------------------------------------------------------------
1129 
1130 void
1132  QString inifile = OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.ini";
1133 
1134  INIFile ini;
1135 
1136  if ( ! ini.connect( inifile,true) ) {
1137  emit log(LOGERR,tr("Can not create user ini file"));
1138  } else {
1140  ini.disconnect();
1141  }
1142 
1143 
1144  //store the windowState
1145  if ( OpenFlipper::Options::gui() ) {
1146 
1147  QSettings windowStates(OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "WindowStates.dat", QSettings::IniFormat);
1148 
1149  windowStates.setValue("Core/Window/State", coreWidget_->saveState ());
1150  windowStates.setValue("Core/Window/Geometry", coreWidget_->saveGeometry ());
1151  windowStates.setValue("Core/Window/WindowState", coreWidget_->isMaximized() );
1152 
1153  windowStates.setValue ("Core/ToolSplitter", coreWidget_->toolSplitter_->saveState ());
1154  windowStates.setValue ("Core/LogSplitter", coreWidget_->splitter_->saveState ());
1155 
1156  windowStates.beginGroup ("Core");
1157  windowStates.beginGroup ("LogSlider");
1158  coreWidget_->slidingLogger_->saveState (windowStates);
1159  windowStates.endGroup ();
1160  coreWidget_->toolBox_->saveState (windowStates);
1161  windowStates.endGroup ();
1162  }
1163 
1164 }
1165 
1166 //-----------------------------------------------------------------------------
1167 
1169  // Write all information on application exit
1170  writeOnExit();
1171 
1172  // Call clearAll() before closing application
1173  // in order to call all object's destructors...
1174  clearAll();
1175 
1176  // Notify plugins of imminent exit.
1177  for ( uint i = 0 ; i < plugins().size() ; ++i ){
1178  BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugins()[i].plugin);
1179 
1180  // Dont call exit if we cannot get the Plugin
1181  if ( basePlugin )
1182  basePlugin->exit();
1183  }
1184 
1185  // Delete Plugins to actually call their destructor
1186  for(PluginInfo p : plugins())
1187  delete p.plugin;
1188 
1189  // close the log file to ensure everything is writeen correctly
1190  if (logFile_)
1191  logFile_->close();
1192 
1193  // Close the settings file
1194  OpenFlipper::Options::closeSettings();
1195 
1196  // Test if ini-file should be cleaned
1197  // If so, delete it...
1198  if(OpenFlipper::Options::deleteIniFile()) {
1199  bool success = true;
1200 
1201  // Iterate over all ini files and clear them
1202  QStringList optionFiles = OpenFlipper::Options::optionFiles();
1203  for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
1204  success &= QFile::remove(optionFiles[i]);
1205  }
1206 
1207  if(!success) {
1208  QMessageBox::warning(0, tr("Warning"),
1209  tr("One or more files could not be removed.\nDelete files manually."),
1210  QMessageBox::Ok,
1211  QMessageBox::Ok);
1212  }
1213  }
1214 
1215  // Cleanup the widgets here
1216  delete coreWidget_;
1217 
1218  qApp->quit();
1219 }
1220 
1221 //-----------------------------------------------------------------------------
1222 
1224 
1225  // Call clearAll() before closing application
1226  // in order to call all object's destructors...
1227  clearAll();
1228 
1229  // Cleanup the widgets here
1230  delete coreWidget_;
1231 
1232 
1233  //stop qt event loop
1234  //this function does return to the caller
1235  qApp->exit(EXIT_FAILURE);
1236 
1237  // Kill application with an error
1238  // No need to clean up here anyway
1239  exit(EXIT_FAILURE);
1240 
1241 }
1242 
1243 //-----------------------------------------------------------------------------
1244 
1246 void Core::slotLogToFile(Logtype _type, QString _message){
1247 
1248  if (!OpenFlipperSettings().value("Core/Log/logFileEnabled",true).toBool() )
1249  return;
1250 
1251  if (logStream_ == 0){
1252  //check if a logfile has been specified and if the path is valid
1253 
1254  QString fileName = OpenFlipperSettings().value("Core/Log/logFile","").toString();
1255  QFileInfo fi( fileName );
1256 
1257  if ( fileName == "" || !fi.dir().exists() ) {
1258  OpenFlipperSettings().setValue("Core/Log/logFile", OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "OpenFlipper.log");
1259  }
1260 
1261  logFile_ = new QFile( OpenFlipperSettings().value("Core/Log/logFile").toString() );
1262  if ( logFile_->open(QFile::WriteOnly) ) {
1263  logStream_ = new QTextStream (logFile_);
1264  } else {
1265  emit log(LOGERR, tr("Unable to open logfile!"));
1266  return;
1267  }
1268  }
1269 
1270  switch (_type) {
1271  case LOGINFO:
1272  (*logStream_) << "INFO:"; break;
1273  case LOGOUT:
1274  (*logStream_) << "OUT :"; break;
1275  case LOGWARN:
1276  (*logStream_) << "WARN:"; break;
1277  case LOGERR:
1278  (*logStream_) << "ERR :"; break;
1279  case LOGSTATUS:
1280  (*logStream_) << "STAT:"; break;
1281  }
1282 
1283  (*logStream_) << _message << "\n" << flush;
1284 
1285 }
1286 
1288 void Core::slotSetSlotDescription(QString _slotName, QString _slotDescription,
1289  QStringList _parameters, QStringList _descriptions)
1290 {
1291  //handle core slots
1292  if (sender() == this){
1293  SlotInfo info;
1294  info.slotName = _slotName;
1295  info.slotDescription = _slotDescription;
1296  info.parameters = _parameters;
1297  info.descriptions = _descriptions;
1298 
1299  coreSlots_.push_back( info );
1300  return;
1301  }
1302 
1303  //handle plugin slots
1304 
1305  //find plugin
1306  PluginInfo* pluginInfo = 0;
1307 
1308  for (uint i=0; i < plugins().size(); i++)
1309  if (plugins()[i].plugin == sender())
1310  pluginInfo = &plugins()[i];
1311 
1312  if (pluginInfo == 0){
1313  emit log(LOGERR, tr("Unable to set slot-description. Plugin not found!"));
1314  return;
1315  }
1316 
1317  SlotInfo info;
1318  info.slotName = _slotName;
1319  info.slotDescription = _slotDescription;
1320  info.parameters = _parameters;
1321  info.descriptions = _descriptions;
1322 
1323  pluginInfo->slotInfos.append( info );
1324 }
1325 
1327 void Core::slotSetSlotDescriptionGlobalFunction(QString _functionName, QString _slotDescription,
1328  QStringList _parameters, QStringList _descriptions)
1329 {
1330  SlotInfo info;
1331  info.slotName = _functionName;
1332  info.slotDescription = _slotDescription;
1333  info.parameters = _parameters;
1334  info.descriptions = _descriptions;
1335 
1336  globalFunctions_.push_back( info );
1337 }
1338 
1340 void Core::slotGetDescription(QString _function, QString& _fnDescription,
1341  QStringList& _parameters, QStringList& _descriptions )
1342 {
1343  QString pluginName = _function.section(".", 0, 0);
1344  QString slotName = _function.section(".", 1, 1);
1345 
1346  // Global function
1347  if ( !_function.contains(".") ) {
1348 
1349  // Only one section, so we have to swap
1350  slotName = pluginName;
1351 
1352  for (int i=0; i < globalFunctions_.count(); i++) {
1353 
1354  if (globalFunctions_[i].slotName == slotName){
1355  _fnDescription = globalFunctions_[i].slotDescription;
1356  _parameters = globalFunctions_[i].parameters;
1357  _descriptions = globalFunctions_[i].descriptions;
1358  return;
1359  }
1360  }
1361  return;
1362  }
1363 
1364  //handle core slots
1365  if (pluginName == "core"){
1366 
1367  _fnDescription = "";
1368  _parameters.clear();
1369  _descriptions.clear();
1370 
1371  for (int i=0; i < coreSlots_.count(); i++)
1372  if (coreSlots_[i].slotName == slotName){
1373  _fnDescription = coreSlots_[i].slotDescription;
1374  _parameters = coreSlots_[i].parameters;
1375  _descriptions = coreSlots_[i].descriptions;
1376  return;
1377  }
1378  return;
1379  }
1380 
1381  //handle plugin slots
1382 
1383  //find plugin
1384  PluginInfo* pluginInfo = 0;
1385 
1386  for (uint i=0; i < plugins().size(); i++)
1387  if (plugins()[i].rpcName == pluginName)
1388  pluginInfo = &plugins()[i];
1389 
1390  if (pluginInfo == 0){
1391  emit log(LOGERR, tr("Unable to get slot-description. Plugin not found!"));
1392  return;
1393  }
1394 
1395  _fnDescription = "";
1396  _parameters.clear();
1397  _descriptions.clear();
1398 
1399  //find slot
1400  for (int i=0; i < pluginInfo->slotInfos.count(); i++)
1401  if (pluginInfo->slotInfos[i].slotName == slotName){
1402  _fnDescription = pluginInfo->slotInfos[i].slotDescription;
1403  _parameters = pluginInfo->slotInfos[i].parameters;
1404  _descriptions = pluginInfo->slotInfos[i].descriptions;
1405  return;
1406  }
1407 }
1408 
1409 void Core::snapshotBaseFileName(QString _fname, unsigned int _viewerId ){
1410 
1411  if ( OpenFlipper::Options::gui() ) {
1412  if ( _viewerId >= OpenFlipper::Options::examinerWidgets() ) {
1413  emit log(LOGERR,tr("Unable to snapshotBaseFileName for viewer ") + QString::number(_viewerId) );
1414  return;
1415  }
1416 
1418  }
1419 
1420 }
1421 
1422 void Core::snapshotFileType(QString _type, unsigned int _viewerId ){
1423 
1424  if ( OpenFlipper::Options::gui() ) {
1425  if ( _viewerId >= OpenFlipper::Options::examinerWidgets() ) {
1426  emit log(LOGERR,tr("Unable to snapshotFileType for viewer ") + QString::number(_viewerId) );
1427  return;
1428  }
1429 
1431  }
1432 
1433 }
1434 
1435 
1436 void Core::snapshotCounterStart(const int _counter, unsigned int _viewerId ){
1437 
1438  if ( OpenFlipper::Options::gui() ) {
1439  if ( _viewerId >= OpenFlipper::Options::examinerWidgets() ) {
1440  emit log(LOGERR,tr("Unable to snapshotFileType for viewer ") + QString::number(_viewerId) );
1441  return;
1442  }
1443 
1444  PluginFunctions::viewerProperties(_viewerId).snapshotCounter( _counter );
1445  }
1446 
1447 }
1448 
1449 void Core::snapshot( unsigned int _viewerId, int _width, int _height, bool _alpha, bool _hideCoordsys, int _numSamples ){
1450 
1451 
1452  if ( OpenFlipper::Options::gui() ) {
1453  if ( _viewerId >= OpenFlipper::Options::examinerWidgets() ) {
1454  emit log(LOGERR,tr("Unable to create snapshot for viewer ") + QString::number(_viewerId) );
1455  return;
1456  }
1457  coreWidget_->examiner_widgets_[_viewerId]->snapshot(_width, _height, _alpha, _hideCoordsys, _numSamples);
1458  }
1459 
1460 }
1461 
1463 
1464  if ( OpenFlipper::Options::gui() )
1466 }
1467 
1468 void Core::applicationSnapshotName(QString _name){
1469 
1470  if ( OpenFlipper::Options::gui() )
1472 }
1473 
1475 
1476  if ( OpenFlipper::Options::gui() )
1478 }
1479 
1480 void Core::viewerSnapshot(QString file_name, bool store_comments,
1481  bool comments_visible_only, bool comments_targeted_only,
1482  bool store_material_info, int snapshot_width, int snapshot_height,
1483  bool snapshot_transparent, bool hide_coord_sys,
1484  int snapshot_multisampling, bool store_view) {
1485 
1486  if ( OpenFlipper::Options::gui() )
1487  coreWidget_->viewerSnapshot(file_name, store_comments,
1488  comments_visible_only, comments_targeted_only,
1489  store_material_info, snapshot_width, snapshot_height,
1490  snapshot_transparent, hide_coord_sys, snapshot_multisampling,
1491  store_view);
1492 }
1493 
1494 
1495 void Core::resizeViewers(int _width, int _height ){
1496  if ( OpenFlipper::Options::gui() ){
1497 
1498  lastWidth_ = coreWidget_->glView_->width();
1499  lastHeight_ = coreWidget_->glView_->height();
1500 
1501  // offset +6, +6: Verified: resizing with current sizes leads to no effect
1502  coreWidget_->glView_->resize(_width+6, _height+6);
1503  }
1504 }
1505 
1506 void Core::resizeApplication(int _width, int _height ){
1507  if ( OpenFlipper::Options::gui() ){
1508 
1509  lastWidth_ = coreWidget_->glView_->width();
1510  lastHeight_ = coreWidget_->glView_->height();
1511 
1512  coreWidget_->resize(_width, _height);
1513  }
1514 }
1515 
1516 void Core::writeVersionNumbers(QString _filename){
1517 
1518  INIFile ini;
1519 
1520  if ( ! ini.connect(_filename,true) ) {
1521  emit log(LOGERR,tr("Failed to connect to _ini file") + _filename);
1522  return;
1523  }
1524 
1525  //add coreVersion
1526  if ( OpenFlipper::Options::isWindows() )
1527  ini.add_entry( "Core" , "VersionWindows" , OpenFlipper::Options::coreVersion() );
1528  else
1529  ini.add_entry( "Core" , "VersionLinux" , OpenFlipper::Options::coreVersion() );
1530 
1531  //add pluginVersions
1532  for (uint i=0; i < plugins().size(); i++){
1533 
1534  if ( OpenFlipper::Options::isWindows() )
1535  ini.add_entry( plugins()[i].name , "VersionWindows" , plugins()[i].version );
1536  else
1537  ini.add_entry( plugins()[i].name , "VersionLinux" , plugins()[i].version );
1538  }
1539 
1540  ini.disconnect();
1541 }
1542 
1543 QList<int> Core::objectList (QString _selection, QStringList _types)
1544 {
1545  QList<int> rv;
1546  DataType ids = 0;
1548 
1549  foreach (QString s, _types)
1550  if (!s.isEmpty ())
1551  ids = typeId (s);
1552 
1553  if (_selection == "source")
1554  selection = PluginFunctions::SOURCE_OBJECTS;
1555  else if (_selection == "target")
1556  selection = PluginFunctions::TARGET_OBJECTS;
1557 
1558  for ( PluginFunctions::ObjectIterator o_it(selection, ids) ;
1559  o_it != PluginFunctions::objectsEnd(); ++o_it)
1560  rv.append (o_it->id ());
1561  return rv;
1562 }
1563 
1566 
1567  connect(this, SIGNAL(setSlotDescription(QString,QString,QStringList,QStringList)),
1568  this, SLOT(slotSetSlotDescription(QString,QString,QStringList,QStringList)) );
1569 
1570  emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";")));
1571  emit slotSetSlotDescriptionGlobalFunction("help(QString)", tr("Print help about something"), QStringList("Help Entry"), QStringList("help about what?"));
1572 
1573 
1574  emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete")));
1575  emit setSlotDescription("updateView()", tr("Redraw the contents of the viewer."), QStringList(), QStringList());
1576  emit setSlotDescription("clearAll()", tr("Clear all data objects."), QStringList(), QStringList());
1577  emit setSlotDescription("exitApplication()", tr("Quit OpenFlipper"), QStringList(), QStringList());
1578  emit setSlotDescription("fullscreen(bool)", tr("Enable or disable fullscreen mode"),
1579  QStringList(tr("enabled")) ,
1580  QStringList(tr("Enable or disable fullscreen mode")));
1581  emit setSlotDescription("showViewModeControls(bool)", tr("Show or hide the view mode control box"),
1582  QStringList(tr("Show?")) ,
1583  QStringList());
1584  emit setSlotDescription("loggerState(int)", tr("Change the logger window state"), QStringList(tr("Change the logger window state")), QStringList());
1585  emit setSlotDescription("enableOpenMeshErrorLog(bool)", tr("Enable or disable OpenMesh error logging"), QStringList(tr("OpenMesh error logging enabled")), QStringList());
1586  emit setSlotDescription("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList());
1587  emit setSlotDescription("showStatusBar(bool)", tr("Show or hide status bar"), QStringList(tr("Show or hide the status bar")), QStringList());
1588  emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"),
1589  QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n1: Double Viewer\n2: Grid \n3: Horizontal split ")));
1590 
1591  emit setSlotDescription("restrictFrameRate(bool)", tr("Restrict FrameRate to MaxFrameRate"),
1592  QStringList(tr("enabled")), QStringList(tr("restriction switch")));
1593  emit setSlotDescription("setMaxFrameRate(int)", tr("set the maximal framerate (automatically enables framerate restriction)"),
1594  QStringList(tr("frameRate")), QStringList(tr("Maximum frameRate")));
1595  emit setSlotDescription("snapshotBaseFileName(QString)", tr("Set a filename for storing snapshots.")
1596  , QStringList(), QStringList());
1597  emit setSlotDescription("snapshotFileType(QString)", tr("Set a filetype for storing snapshots.")
1598  , QStringList(), QStringList());
1599  emit setSlotDescription("snapshotCounterStart(int)", tr("Set the starting number for the snapshot counter.")
1600  , QStringList("StartValue"), QStringList("Starting number for the counter"));
1601  emit setSlotDescription("snapshot()", tr("Make a snapshot of the viewer. If no filename"
1602  " was set using snapshotBaseFileName() the snapshot is stored"
1603  " in snap.png in the current directory. The captured image will have "
1604  " the same dimensions as the current viewport. "
1605  "For every snapshot a counter is added to the filename."), QStringList(), QStringList());
1606  emit setSlotDescription("snapshot(uint)", tr("Make a snapshot of the viewer with id viewerId. If no filename"
1607  " was set using snapshotBaseFileName() the snapshot is stored"
1608  " in snap.png in the current directory. For every snapshot"
1609  " a counter is added to the filename."), QStringList("viewerId"), QStringList("Id of viewer to be captured (default is 0)"));
1610  emit setSlotDescription("snapshot(uint,int,int)", tr("Make a snapshot of the viewer with id viewerId."
1611  " Pass 0 as viewerId parameter to capture the current viewer. "
1612  " The captured image will have the specified dimensions. "
1613  " If 0 is passed as either width or height parameter, the value will "
1614  " automatically be set to hold the right aspect ratio, respectively. "
1615  " If no filename was set using snapshotBaseFileName() the snapshot is stored"
1616  " in snap.png in the current directory. For every snapshot"
1617  " a counter is added to the filename."), QStringList(QString("viewerId;width;height").split(";")),
1618  QStringList(QString("Id of viewer (default is 0);Width of image;Height of image").split(";")));
1619  emit setSlotDescription("snapshot(uint,int,int,bool)", tr("Make a snapshot of the viewer with id viewerId."
1620  " Pass 0 as viewerId parameter to capture the current viewer. "
1621  " The captured image will have the specified dimensions. "
1622  " If 0 is passed as either width or height parameter, the value will "
1623  " automatically be set to hold the right aspect ratio, respectively. "
1624  " If 0 is passed for both width and height values, the viewport's current "
1625  " dimension is used. Set alpha to true if you want the background to be transparent. "
1626  " If no filename was set using snapshotBaseFileName() the snapshot is stored"
1627  " in snap.png in the current directory. For every snapshot"
1628  " a counter is added to the filename."), QStringList(QString("viewerId;width;height;alpha").split(";")),
1629  QStringList(QString("Id of viewer (default is 0);Width of image;Height of image;Transparent background").split(";")));
1630  emit setSlotDescription("snapshot(uint,int,int,bool,bool)", tr("Make a snapshot of the viewer with id viewerId."
1631  " Pass 0 as viewerId parameter to capture the current viewer. "
1632  " The captured image will have the specified dimensions. "
1633  " If 0 is passed as either width or height parameter, the value will "
1634  " automatically be set to hold the right aspect ratio, respectively. "
1635  " If 0 is passed for both width and height values, the viewport's current "
1636  " dimension is used. Set alpha to true if you want the background to be transparent. "
1637  " The fifth parameter is used to hide the coordinate system in the upper right corner of the screen. "
1638  " If no filename was set using snapshotBaseFileName() the snapshot is stored"
1639  " in snap.png in the current directory. For every snapshot"
1640  " a counter is added to the filename."), QStringList(QString("viewerId;width;height;alpha;hideCoordsys").split(";")),
1641  QStringList(QString("Id of viewer (default is 0);Width of image;Height of image;Transparent background;Hide coordsys node").split(";")));
1642  emit setSlotDescription("snapshot(uint,int,int,bool,bool,int)", tr("Make a snapshot of the viewer with id viewerId."
1643  " Pass 0 as viewerId parameter to capture the current viewer. "
1644  " The captured image will have the specified dimensions. "
1645  " If 0 is passed as either width or height parameter, the value will "
1646  " automatically be set to hold the right aspect ratio, respectively. "
1647  " If 0 is passed for both width and height values, the viewport's current "
1648  " dimension is used. Set alpha to true if you want the background to be transparent. "
1649  " The fifth parameter is used to hide the coordinate system in the upper right corner of the screen. "
1650  " If no filename was set using snapshotBaseFileName() the snapshot is stored"
1651  " in snap.png in the current directory. For every snapshot"
1652  " a counter is added to the filename."), QStringList(QString("viewerId;width;height;alpha;hideCoordsys;numSamples").split(";")),
1653  QStringList(QString("Id of viewer (default is 0);Width of image;Height of image;Transparent background;Hide coordsys node;Number of samples per pixel").split(";")));
1654  emit setSlotDescription("resizeViewer(int,int)", tr("Resize the viewer"),
1655  QString(tr("width,height")).split(","),
1656  QString(tr("new width for the viewer,new height for the viewer")).split(","));
1657  emit setSlotDescription("writeVersionNumbers(QString)", tr("write the current versions of all plugins to INI file"),
1658  QStringList(tr("filename")),
1659  QStringList(tr("fullpath to a file where the versions should be written to.")));
1660  //save slots
1661  emit setSlotDescription("saveObject(int,QString)", tr("Save object to file. If the file exists it will be overwritten."),
1662  QString(tr("object-id,filename")).split(","),
1663  QString(tr("id of the object, complete path and filename")).split(","));
1664  emit setSlotDescription("saveObjectTo(int,QString)", tr("Save object to file. The location can be chosen in a dialog. "
1665  "(only works if GUI is available)"),
1666  QString(tr("object-id,filename")).split(","),
1667  QString(tr("id of the object, initial filename for the dialog")).split(","));
1668  emit setSlotDescription("saveAllObjects()", tr("Saves all target objects. "
1669  "If no filename is available a dialog is shown. (only works if GUI is available)"),QStringList(), QStringList());
1670  emit setSlotDescription("saveAllObjectsTo()", tr("Saves all target objects. The locations can be chosen in dialogs. "
1671  "(only works if GUI is available)"),QStringList(), QStringList());
1672  emit setSlotDescription("saveSettings()", tr("Show the dialog to save the current setting. (only works if GUI is available)"),QStringList(), QStringList());
1673  emit setSlotDescription("saveSettings(QString, bool, bool, bool, bool, bool, bool)", tr("Save the current setting to the supplied file."),
1674  QStringList(tr("filePath,is_saveObjectInfo,is_targetOnly,is_saveAll,is_askOverwrite,is_saveProgramSettings,is_savePluginSettings").split(",")),
1675  QStringList(tr("Path of the file to save the settings to.;Save objects in current setting.;Restrict to targeted objects.;<no idea what this parameter does>;Prompt before overwriting files that already exist (gui mode only).;Save " TOSTRING( PRODUCT_NAME ) " program settings.;Save plugin settings.").split(";")));
1676  //load slots
1677  emit setSlotDescription("loadObject()", tr("Show the dialog to load an object. (only works if GUI is available)"),QStringList(), QStringList());
1678  emit setSlotDescription("loadObject(QString)", tr("Load an object specified in file filename. This automatically determines which file plugin to use."),
1679  QStringList(tr("filename")), QStringList(tr("Filename")));
1680  emit setSlotDescription("getObjectId(QString)", tr("Return identifier of object with specified name. Returns -1 if object was not found."),QStringList(), QStringList());
1681  emit setSlotDescription("loadSettings()", tr("Show the dialog to load settings. (only works if GUI is available)"),QStringList(), QStringList());
1682  emit setSlotDescription("loadSettings(QString)", tr("load settings from file."),QStringList(), QStringList());
1683 
1684  emit setSlotDescription("createWidget(QString,QString)", tr("Create a widget from an ui file"),
1685  QString(tr("Object name,ui file")).split(","),
1686  QString(tr("Name of the new widget in script,ui file to load")).split(","));
1687 
1688  emit setSlotDescription("addToolbox(QString,QWidget*)", tr("Add a widget as a toolbox"),
1689  QString(tr("Toolbox Entry name,Widget")).split(","),
1690  QString(tr("Name of the new widget in the toolbox,Pointer to the new widget")).split(","));
1691 
1692  emit setSlotDescription("addToolbox(QString,QWidget*,QIcon*)", tr("Add a widget as a toolbox"),
1693  QString(tr("Toolbox Entry name,Widget,Icon")).split(","),
1694  QString(tr("Name of the new widget in the toolbox,Pointer to the new widget,Pointer to icon")).split(","));
1695 
1696  emit setSlotDescription("serializeMaterialProperties(int)", tr("Serialize and return the material properties of the supplied object."),
1697  QString(tr("ObjectId")).split(","),
1698  QString(tr("ID of the object")).split(","));
1699 
1700  emit setSlotDescription("deserializeMaterialProperties(int, QString)", tr("Deserialize the supplied material properties into the supplied object."),
1701  QString(tr("ObjectId, SerializedProps")).split(","),
1702  QString(tr("ID of the object,The serialized material properties.")).split(","));
1703 
1704  emit setSlotDescription("addViewModeToolboxes(QString,QString)", tr("Set toolboxes for a viewmode (This automatically adds the view mode if it does not exist)"),
1705  QString(tr("Name,Toolbox List")).split(","),
1706  QString(tr("Name of the Viewmode,seperated list of toolboxes visible in this viewmode")).split(","));
1707 
1708  emit setSlotDescription("addViewModeToolbars(QString,QString)", tr("Set toolbars for a viewmode (This automatically adds the view mode if it does not exist)"),
1709  QString(tr("Name,Toolbar List")).split(","),
1710  QString(tr("Name of the Viewmode,seperated list of toolbars visible in this viewmode")).split(","));
1711 
1712  emit setSlotDescription("addViewModeContextMenus(QString,QString)", tr("Set context Menus for a viewmode (This automatically adds the view mode if it does not exist)"),
1713  QString(tr("Name,Context Menu List")).split(","),
1714  QString(tr("Name of the Viewmode,seperated list of Context Menus visible in this viewmode")).split(","));
1715 
1716  emit setSlotDescription("addViewModeIcon(QString,QString)", tr("Set Icon for a viewmode (This automatically adds the view mode if it does not exist)"),
1717  QString(tr("Name,Icon filename")).split(","),
1718  QString(tr("Name of the Viewmode,filename of the icon (will be taken from OpenFlippers icon directory)")).split(","));
1719 
1720  emit setSlotDescription("objectList(QString,QStringList)", tr("Returns object list"),
1721  QString(tr("Selection type,Object types")).split(","),
1722  QString(tr("Type of object selection (all,source,target),Object type (All,PolyMesh,TriangleMesh,...)")).split(";"));
1723 
1724  emit setSlotDescription("setToolBoxSide(QString)", tr("Determine whether the toolboxes should be displayed on the right or on the left side."),
1725  QStringList(tr("side")), QStringList(tr("The desired side of the toolboxes (either 'left' or 'right')")));
1726 
1727  emit setSlotDescription("getToolbox(QString,QString)", tr("Returns a pointer to the requested toolbox widget if it was found, nullptr, otherwise."),
1728  tr("Plugin Name\rToolbox Name").split("\r"),
1729  tr("The plugin which the requested toolbox belongs to.\rThe name of the requested toolbox.").split("\r"));
1730 
1731  emit setSlotDescription("blockSceneGraphUpdates()", tr("Disable Scenegraph Updates (e.g. before loading or adding a large number of files)"),QStringList(), QStringList());
1732  emit setSlotDescription("unblockSceneGraphUpdates()", tr("Enable Scenegraph Updates (e.g. before loading or adding a large number of files)"),QStringList(), QStringList());
1733  emit setSlotDescription("setView", tr("Set the encoded view for the primary viewport."), QStringList(tr("view")), QStringList(tr("The encoded view. (You can obtain one through \"Copy View\" in the context menu of the coordinates.)")));
1734 
1735 }
1736 
1737 void Core::deleteObject( int _id ){
1738 
1739  if ( _id == -1 )
1740  return;
1741 
1742  // get the node
1743  BaseObject* object = objectRoot_->childExists(_id);
1744 
1745  if ( !object || object == objectRoot_ ) {
1746  std::cerr << "Error while deleting object, does not exist!!" << std::endl;
1747  return;
1748  }
1749 
1750  emit objectDeleted(_id);
1751 
1752  // remove the whole subtree below this item
1753  object->deleteSubtree();
1754 
1755  // remove the item itself from the parent
1756  object->parent()->removeChild(object);
1757 
1758  // delete it
1759  delete object;
1760 
1761  // ensure updating the picking buffer
1762  updateView();
1763 
1764 }
1765 
1766 void Core::deserializeMaterialProperties(int _objId, QString _props) {
1767  if ( _objId == -1 ) return;
1768 
1769  BaseObject* object = objectRoot_->childExists(_objId);
1770 
1771  if (!object || object == objectRoot_) {
1772  std::cerr << "No such object." << std::endl;
1773  return;
1774  }
1775 
1776  BaseObjectData* o = dynamic_cast<BaseObjectData *>(object);
1777  if (!o || !o->materialNode()) {
1778  std::cerr << "No suitable object found." << std::endl;
1779  return;
1780  }
1781 
1782  o->materialNode()->material().deserializeFromJson(_props);
1783 }
1784 
1786  if ( _objId == -1 ) return QString();
1787 
1788  BaseObject* object = objectRoot_->childExists(_objId);
1789 
1790  if (!object || object == objectRoot_) {
1791  std::cerr << "No such object." << std::endl;
1792  return QString();
1793  }
1794 
1795  BaseObjectData* o = dynamic_cast<BaseObjectData *>(object);
1796  if (!o || !o->materialNode()) {
1797  std::cerr << "No suitable object found." << std::endl;
1798  return QString();
1799  }
1800 
1801  return o->materialNode()->material().serializeToJson();
1802 }
1803 
1804 
1805 void Core::setObjectComment(int _id, QString key, QString comment) {
1806  if ( _id == -1 ) return;
1807 
1808  BaseObject* object = objectRoot_->childExists(_id);
1809 
1810  if (!object || object == objectRoot_) {
1811  std::cerr << "No such object." << std::endl;
1812  return;
1813  }
1814 
1815  object->getCommentByKey(key) = comment;
1816 }
1817 
1818 void Core::clearObjectComment(int _id, QString key) {
1819  if ( _id == -1 ) return;
1820 
1821  BaseObject* object = objectRoot_->childExists(_id);
1822 
1823  if (!object || object == objectRoot_) {
1824  std::cerr << "No such object." << std::endl;
1825  return;
1826  }
1827 
1828  object->clearComment(key);
1829 }
1830 
1831 void Core::clearAllComments(int _id) {
1832  if ( _id == -1 ) return;
1833 
1834  BaseObject* object = objectRoot_->childExists(_id);
1835 
1836  if (!object || object == objectRoot_) {
1837  std::cerr << "No such object." << std::endl;
1838  return;
1839  }
1840 
1841  object->clearAllComments();
1842 }
1843 
1844 
1846 
1847  // Remember ids
1848  std::vector< int > ids;
1849 
1850  BaseObject* current = objectRoot_->next();
1851 
1852  while( current != objectRoot_ ){
1853  ids.push_back( current->id() );
1854  current = current->next();
1855  }
1856 
1857  for ( uint i = 0 ; i < ids.size(); ++i ) {
1858  emit objectDeleted(ids[i]);
1859  }
1860 
1861  // remove the whole subtree below the root
1863 
1864  slotObjectUpdated(-1);
1865 
1866  emit allCleared();
1867 }
1868 
1869 //-----------------------------------------------------------------------------
1870 
1872 
1873  bool ok = true;
1874  bool warn = false;
1875 
1876  QString messages;
1877 
1878  QString qtCompiledVersion = QString( QT_VERSION_STR );
1879  QString qtCurrentVersion = qVersion();
1880 
1881  if ( qtCompiledVersion != qtCurrentVersion ) {
1882  messages += tr("QT Library Version mismatch!\n");
1883 
1884  messages += tr("Currently used QT Version:\t") + qVersion() + "\n";
1885  messages += tr("Link time QT Version:\t\t") + QString( QT_VERSION_STR ) + "\n";
1886  messages += tr("This inconsistency may lead to an unstable behavior of OpenFlipper!");
1887 
1888  warn = true;
1889  }
1890 
1891  if ( !ok ) {
1892  QString message = tr("Error! Library tests failed!\n");
1893  message += tr("The following problems have been found:\n\n");
1894 
1895  message += messages;
1896 
1897  std::cerr << message.toStdString() << std::endl;
1898 
1899  if ( OpenFlipper::Options::gui() ) {
1900  finishSplash();
1901  StaysOnTopMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message );
1902  }
1903 
1904  // Unsafe operation, so quit the application
1905  exitFailure();
1906 
1907  } else if ( warn ) {
1908 
1909  QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
1910  message += tr("The following checks failed:\n\n");
1911  message += messages;
1912 
1913  std::cerr << message.toStdString() << std::endl;
1914 
1915  if ( OpenFlipper::Options::gui() ) {
1916  finishSplash();
1917  StaysOnTopMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message );
1918  }
1919 
1920  }
1921  #ifndef NDEBUG
1922  else {
1923  std::cerr << "Library Check succeeded" << std::endl;
1924  return true;
1925  }
1926  #endif
1927 
1928  return true;
1929 }
1930 
1931 //-----------------------------------------------------------------------------
1932 
1933 
1935 
1936  // No gui->no OpenGL
1937  if ( OpenFlipper::Options::nogui() )
1938  return true;
1939 
1940  // Status ok?
1941  bool ok = true;
1942  bool warn = false;
1943 
1944  QString missing;
1945 
1946  QOpenGLContext* context = QOpenGLContext::currentContext();
1947  if ( context ) {
1948 
1949  // Get version and check
1950  QSurfaceFormat format = context->format();
1951 
1952  if ( (format.majorVersion() < 2) ) {
1953 
1954  ok = false;
1955  missing += tr("OpenGL Version less then 2.0!\n");
1956 
1957  }
1958 
1959  } else {
1960  ok = false;
1961  missing += tr("No OpenGL support found!\n");
1962  }
1963 
1964 
1965  if ( !ok ) {
1966  QString message = tr("Error! \nThe OpenGL capabilities of your current machine/driver are not sufficient!\n\n");
1967  message += tr("The following checks failed:\n\n");
1968  message += missing;
1969  message += tr("\n\nPlease update your driver or graphics card.\n");
1970  #ifdef APPLE
1971  message += tr("If you have more than one GPU (e.g. MacBook) don't use the internal one!\n");
1972  #endif
1973 
1974  std::cerr << message.toStdString() << std::endl;
1975 
1976 
1977  finishSplash();
1978  QMessageBox::StandardButton button = StaysOnTopMessageBox::critical ( 0, tr( "Insufficient OpenGL Capabilities!"),message,QMessageBox::Abort|QMessageBox::Ignore , QMessageBox::Abort);
1979 
1980  // Unsafe operation, so quit the application
1981  if ( button == QMessageBox::Abort )
1982  exitFailure();
1983  else {
1984  StaysOnTopMessageBox::warning(0,tr( "Insufficient OpenGL Capabilities!"),tr("Ignoring OpenGL capabilities might lead to unstable Operation! Do it at your own risk!"));
1985  }
1986 
1987 
1988 
1989  } else if ( warn ) {
1990  finishSplash();
1991  QString message = tr("Warning! Automatic system environment checks discovered some possible problems!\n\n");
1992  message += tr("The following checks failed:\n\n");
1993  message += missing;
1994 
1995  std::cerr << message.toStdString() << std::endl;
1996 
1997  StaysOnTopMessageBox::warning ( 0, tr( "Detected possible problems!"),message );
1998 
1999  }
2000  #ifndef NDEBUG
2001  else {
2002  std::cerr << "OpenGL Version Check succeeded" << std::endl;
2003  }
2004  #endif
2005 
2006  return ok;
2007 }
2008 
2009 void Core::showReducedMenuBar(bool reduced) {
2010  coreWidget_->showReducedMenuBar(reduced);
2011 }
2012 
2014  if (splash_) splash_->finish(coreWidget_);
2015 }
2016 
2017 
2018 //=============================================================================
void clearObjectComment(int objId, QString key)
Called when a plugin requests an update in the viewer.
Definition: Core.cc:1818
void setViewMode(QString _mode, bool _expandAll=false)
Set the view Mode to the given Mode.
Definition: viewMode.cc:316
QStringList scriptingFunctions_
List of all registered scripting functions.
Definition: Core.hh:1348
LoggerWidget * logWidget_
Textedit at the bottom for log messages.
Definition: CoreWidget.hh:686
size_t available()
number of available renderers
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
void pluginSceneDrawn()
This signal is emitted after the scene has been drawn.
ACG::SceneGraph::CoordinateSystemNode CoordsysNode
Simple Name for CoordsysNode.
void fullscreen(bool _state)
set fullscreen mode
Definition: Core.cc:1023
Execute action on node first and then on its children.
Definition: BaseNode.hh:441
void slotAddEmptyObjectMenu()
Open the add Empty dialog.
void saveSettings()
Save current status to a settings file. Solicit file name through dialog.
Definition: saveSettings.cc:53
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
QString serializeMaterialProperties(int _objId)
Serialize material properties.
Definition: Core.cc:1785
void slotSetSlotDescriptionGlobalFunction(QString _functionName, QString _slotDescription, QStringList _parameters, QStringList _descriptions)
set a description for a global scripting function
Definition: Core.cc:1327
ACG::SceneGraph::CoordsysNode * coordsysNode_
Node for the coordinate system.
Definition: Core.hh:1098
void slotGetDescription(QString _function, QString &_fnDescription, QStringList &_parameters, QStringList &_descriptions)
get available descriptions for a given public slot
Definition: Core.cc:1340
BaseObject * childExists(int _objectId)
Check if the element exists in the subtree of this element.
Definition: BaseObject.cc:516
bool custom
Is this a user defined custom view mode or a plugin generated one.
Definition: CoreWidget.hh:134
void slotObjectUpdated(int _identifier, const UpdateType &_type=UPDATE_ALL)
Called by the plugins if they changed something in the object list (deleted, added, or other property changes)
Logtype
Log types for Message Window.
void applicationSnapshotName(QString _name)
Set the snapshot name.
void loggerState(int _state)
Change the logging window state.
Definition: Core.cc:1038
QSplitter * splitter_
Spliter between toplevel objects and the textedit at the bottom.
Definition: CoreWidget.hh:680
QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for sending output to a file.
Definition: scripting.cc:354
QString icon
Definition: CoreWidget.hh:131
SeparatorNode * dataSeparatorNode_
Toplevel Nodes for data objects.
Definition: Core.hh:1089
LoggerState
State of the logging widget.
void showReducedMenuBar(bool reduced)
Core scripting engine.
Definition: Core.cc:2009
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void checkScenegraphDirty()
Called to check if the scenegraph needs to be redrawn.
Definition: Core.cc:966
Draw node in second pass.
Definition: BaseNode.hh:445
pick any of the prior targets (should be implemented for all nodes)
Definition: PickTarget.hh:84
QTextStream * logStream_
stream for logging to file
Definition: Core.hh:1207
void showViewModeControls(bool _show)
Hide or show the View Mode controls.
Definition: CoreWidget.cc:700
void addPickMode(const std::string &_name, bool _mouse_tracking=false, int _pos=-1, bool _visible=true, QCursor _cursor=Qt::ArrowCursor)
add pick mode
Definition: picking.cc:392
QString & getCommentByKey(const QString &key)
Get comment for the specified key.
Definition: BaseObject.cc:824
Interface class for providing information on objects.
void saveState(QSettings &_settings)
saves the current state
bool checkSignal(QObject *_plugin, const char *_signalSignature)
Check if a plugin has a signal.
void setDescriptions()
set the descriptions for scriptable slots of the core
Definition: Core.cc:1565
void slotShowPlugins()
Show Plugins Dialog.
QList< SlotInfo > slotInfos
This list contains Descriptions about public slots if available.
Definition: PluginInfo.hh:152
void slotMouseEvent(QMouseEvent *_event)
Gets called by examiner widget when mouse is moved in picking mode.
Definition: Core.cc:806
void stopVideoCapture()
Stop video capturing.
Definition: Video.cc:104
void deserializeMaterialProperties(int _objId, QString _props)
Serialize material properties.
Definition: Core.cc:1766
int lastWidth_
Slot called everytime the view is updated.
Definition: Core.hh:938
virtual void exit()
void slotSetSlotDescription(QString _slotName, QString _slotDescription, QStringList _parameters, QStringList _descriptions)
set a description for one of the plugin&#39;s public slots
Definition: Core.cc:1288
const QStringList SOURCE_OBJECTS("source")
Iterable object range.
MaterialNode * materialNode()
get a pointer to the materialnode
int id() const
Definition: BaseObject.cc:190
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
SeparatorNode * root_node_scenegraph_
Scenegraphs root node.
Definition: Core.hh:1079
void openIniFile(QString _filename, bool _coreSettings, bool _perPluginSettings, bool _loadObjects)
Load information from an ini file.
Definition: ParseIni.cc:400
QSplashScreen * splash_
SplashScreen, only used in gui mode.
Definition: Core.hh:1599
void addRecent(QString _filename, DataType _type)
Add a recent file and update menu.
Definition: CoreWidget.cc:860
prototypeDataType DataTypePrototype_
Prototype for the DataType.
Definition: Core.hh:1357
void slotRegisterSlotKeyBindings()
register scripting slots to allow keyBindings
Definition: keyHandling.cc:283
QString name
Name of the View Mode.
Definition: CoreWidget.hh:127
void setViewerProperties(std::vector< Viewer::ViewerProperties * > _viewerProperties)
Set the internal viewerProperties pointer ( DO NOT USE!! )
void slotExit()
Exit Application.
Definition: Core.cc:1168
void updateRecent()
Update the recent files menu.
Definition: CoreWidget.cc:874
void deletedObject(int _objectId)
This slot is called by the object manager when an object is deleted.
void viewUpdated()
Slot called everytime the view is updated.
Definition: Video.cc:118
void setSceneGraphRootNodeGlobal(SeparatorNode *_root_node)
void resizeApplication(int _width, int _height)
resize the whole Application
Definition: Core.cc:1506
void setDataSeparatorNodes(SeparatorNode *_dataSeparatorNode)
Set the internal data root node pointers ( DO NOT USE!! )
void showReducedMenuBar(bool reduced)
typedefs
Definition: MenuBar.cc:147
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
void slotAddPickMode(const std::string &_mode)
Add a new picking mode to the examiner_widget_.
Definition: Core.cc:878
void slotScriptError(const QScriptValue &error)
Core scripting engine.
Definition: scripting.cc:332
bool dataType(DataType _type) const
Definition: BaseObject.cc:221
void setObjectComment(int objId, QString key, QString comment)
Called when a plugin requests an update in the viewer.
Definition: Core.cc:1805
const QStringList TARGET_OBJECTS("target")
Iterable object range.
QStringList IteratorRestriction
Iterable object range.
SideArea * toolBox_
Toolbox.
Definition: CoreWidget.hh:734
void snapshotBaseFileName(QString _fname, unsigned int _viewerId=0)
Definition: Core.cc:1409
SeparatorNode * dataRootNode_
Root Node for data objects.
Definition: Core.hh:1092
void log(Logtype _type, QString _message)
Logg with OUT,WARN or ERR as type.
void snapshotFileType(const QString &_type)
void slotDeleteAllObjects()
Called when a plugin wants to delete all objects.
Definition: Core.cc:1845
void saveAllObjects()
Slot for saving objects from Menu.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
Definition: INIFile.cc:70
void setViewerLayout(int _idx)
Change viewer layout that was selected in the combo box.
Definition: CoreWidget.cc:977
void setSceneGraphRootNode(SeparatorNode *_root_node)
CoreWidget * coreWidget_
The main applications widget ( only created in gui mode )
Definition: Core.hh:1596
void viewerSnapshot()
Take a snapshot from all viewers.
Definition: Core.cc:1474
void finishSplash()
exit the current application
Definition: Core.cc:2013
QWidget * getToolboxArea()
Show logger in splitter or not.
Definition: CoreWidget.hh:511
const QStringList ALL_OBJECTS
Iterable object range.
void setActiveExaminer(const unsigned int _id)
Set the active id of the examiner which got the last mouse events.
void snapshot(unsigned int _viewerId=0, int _width=0, int _height=0, bool _alpha=false, bool _hideCoordsys=false, int _numSamples=1)
Definition: Core.cc:1449
QScriptEngine scriptEngine_
Core scripting engine.
Definition: Core.hh:1342
void slotAddHiddenPickMode(const std::string &_mode)
Add a new and invisible picking mode to the examiner_widget_.
Definition: Core.cc:887
void clearComment(const QString &key)
Get comment for the specified key.
Definition: BaseObject.cc:843
SideArea * getToolbox()
Show logger in splitter or not.
Definition: CoreWidget.hh:512
QList< SlotInfo > globalFunctions_
Core scripting engine.
Definition: Core.hh:1403
void showLogger(OpenFlipper::Options::LoggerState _state)
Change visibility of the logger.
SeparatorNode * core_nodes_
Separator Node holding all core scenegraph nodes.
Definition: Core.hh:1085
BaseObject * objectRoot_
Pointer to the data rootNode;.
Definition: Core.hh:1593
void showStatusBar(bool _state)
Show or hide status bar.
Definition: StatusBar.cc:155
void showToolbox(bool _state)
Show or hide toolbox.
Definition: CoreWidget.cc:741
void clearAll()
Clear all data objects.
Definition: Core.cc:998
void slotRecentOpen(QAction *_action)
Open Recent file.
Definition: Core.cc:1100
void slotMouseEventLight(QMouseEvent *_event)
Handle Mouse events when in Light mode.
Definition: Core.cc:776
QTimer * redrawTimer_
If enabled, this timer will block screen refresh if done more then 30 times per second.
Definition: Core.hh:1608
void deleteSubtree()
delete the whole subtree below this item ( The item itself is not touched )
Definition: BaseObject.cc:582
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
QFile * logFile_
logfile
Definition: Core.hh:1210
int lastHeight_
Slot called everytime the view is updated.
Definition: Core.hh:939
void writeVersionNumbers(QString _filename)
write the current versions of all plugins to ini file
Definition: Core.cc:1516
void setupOptions()
Get all ini files and set basic paths and options.
std::vector< PluginInfo > & plugins()
Index of Plugins toolbox widget.
Definition: Core.cc:720
QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine)
Special print function for core logger.
Definition: scripting.cc:336
void clearAllComments()
Get comment for the specified key.
Definition: BaseObject.cc:847
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
void applicationSnapshotName(QString _name)
Set the baseName for the application snapshot.
Definition: Core.cc:1468
prototypeMatrix4x4 matrix4x4Prototype_
Prototype for the Matrix type.
Definition: Core.hh:1360
void blockScenegraphUpdates(bool _block)
Called when a plugin wants to lock or unlock scenegraph updates.
Definition: Core.cc:955
void PluginMouseEventLight(QMouseEvent *)
Emitted when an light event occurs.
void newObject(int _objectId)
This slot is called by the object manager when a new object is created.
void restoreState(QSettings &_settings)
restores the state
Core()
constructor
Definition: Core.cc:104
void multiViewMode(int _mode)
Switch the multiView Mode.
Definition: Core.cc:1086
bool checkLibraryVersions()
Checks for library inconsistencies.
Definition: Core.cc:1871
QStringList visibleToolboxes
List of Visible Toolboxes in this view mode.
Definition: CoreWidget.hh:137
Interface class from which all plugins have to be created.
ACG::SceneGraph::MaterialNode * coordsysMaterialNode_
Node for coordsys Material.
Definition: Core.hh:1095
ViewMode struct This struct contains a ViewMode and its status information such as used widgets...
Definition: CoreWidget.hh:124
void loadObject()
Open Load Widget.
void setFullscreen(bool _state)
Enable or disable fullscreen mode.
Definition: CoreWidget.cc:682
void snapshotCounter(const int _counter)
void slotScriptInfo(QString _pluginName, QString _functionName)
Core scripting engine.
Definition: scripting.cc:67
QTime * redrawTime_
Holds the time since last redraw.
Definition: Core.hh:1475
void updateView()
Called when a plugin requests an update in the viewer.
Definition: Core.cc:898
void saveState(QSettings &_settings)
returns the current state
Definition: SideArea.cc:172
void applicationSnapshot()
Create a snapshot of the whole app.
void setActive(unsigned int _active, int _id)
set the active renderer
std::vector< PluginLogger * > loggers_
Logger interfaces between plugins and core logger.
Definition: Core.hh:1586
~Core()
destructor
Definition: Core.cc:702
void snapshotCounterStart(const int _counter, unsigned int _viewerId=0)
Set the start index for the snapshot counter.
Definition: Core.cc:1436
QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine)
Function to print help about scripting functions.
Definition: scripting.cc:380
void applicationSnapshot()
Take a snapshot from the whole app.
Definition: Core.cc:1462
QtSlideWindow * slidingLogger_
Class that holds the animated log widget.
Definition: CoreWidget.hh:722
void restrictFrameRate(bool _enable)
Enable or disable framerate restriction.
Definition: Core.cc:981
void applyOptions()
after ini-files have been loaded and core is up or if options have been changed -> apply Options ...
void restoreKeyBindings()
Restore key assignments from configs files.
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
Definition: INIFile.cc:257
void writeApplicationOptions(INIFile &_ini)
Write Application options to ini file.
Definition: ParseIni.cc:285
void saveOptions()
Save the current options to the standard ini file.
Predefined datatypes.
Definition: DataTypes.hh:83
void saveAllObjectsTo()
Slot for saving objects to a new location.
void enableOpenMeshErrorLog(bool _state)
Enable or disable OpenMesh error logging.
Definition: Core.cc:1049
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
#define TOSTRING(x)
QSettings object containing all program settings of OpenFlipper.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void slotLogToFile(Logtype _type, QString _message)
log to file
Definition: Core.cc:1246
prototypeVec3d vec3dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1351
void setDataRoot(BaseObject *_root)
BaseObject * next()
Definition: BaseObject.cc:404
void showToolbox(bool _state)
Show or hide toolbox.
Definition: Core.cc:1072
void traverse(BaseNode *_node, Action &_action)
Definition: SceneGraph.hh:137
ACG::SceneGraph::Material & material()
Get material object reference.
void setMaxFrameRate(int _rate)
set the maximal framerate ( automatically enables framerate restriction )
Definition: Core.cc:987
void slotMouseEventIdentify(QMouseEvent *_event)
Handle Mouse events when in Identifier mode.
Definition: Core.cc:727
prototypeVec4d vec4dPrototype_
Prototype for the Vector type.
Definition: Core.hh:1354
void loadPlugins()
Load all plugins from default plugin directory and from INI-File.
void loadSettings()
Load status from file.
void deleteObject(int _id)
Called to delete an object.
Definition: Core.cc:1737
QScrollArea * getToolboxScrollArea()
Show logger in splitter or not.
Definition: CoreWidget.hh:510
int getRendererId(QString _name)
get renderer id with the given name
std::vector< glViewer *> examiner_widgets_
Examiner Widget.
Definition: CoreWidget.hh:677
SeparatorNode * root_node_scenegraph_global_
Seperator node for global nodes.
Definition: Core.hh:1082
void resizeViewers(int _width, int _height)
resize the examinerViewer
Definition: Core.cc:1495
void setScriptEngine(QScriptEngine *_engine)
DONT USE! (Function to set the internal reference to the script Engine)
Definition: RPCWrappers.cc:104
void slotWheelEvent(QWheelEvent *_event, const std::string &_mode)
Gets called by examiner widget when Wheel is moved in picking mode.
Definition: Core.cc:853
void PluginWheelEvent(QWheelEvent *, const std::string &)
When this Signal is emitted when a Wheel Event occures.
void exitFailure()
Aborts the application with an error code.
Definition: Core.cc:1223
void init()
Second initialization stage.
Definition: Core.cc:188
QVector< ViewMode * > viewModes_
List of available draw modes.
Definition: Core.hh:1605
void PluginMouseEvent(QMouseEvent *)
When this Signal is emitted when a Mouse Event occures.
ACG::SceneGraph::SeparatorNode SeparatorNode
Seperator Node.
void exitApplication()
exit the current application
Definition: Core.cc:1011
void clearAllComments(int objId)
Called when a plugin requests an update in the viewer.
Definition: Core.cc:1831
void slotExecuteAfterStartup()
Executed after loading core completly to load files from commandline.
void scriptLog(QString _message)
Logging signal for ScriptEngine.
void snapshotFileType(QString _type, unsigned int _viewerId=0)
Set the file type for snapshots.
Definition: Core.cc:1422
void startVideoCapture(QString _baseName, int _fps, bool _captureViewers)
Start video capturing.
Definition: Video.cc:63
QtGLGraphicsView * glView_
graphics view that holds the gl scene
Definition: CoreWidget.hh:713
void restoreState(QSettings &_settings)
restores the state
Definition: SideArea.cc:184
void showViewModeControls(bool _show)
Show or Hide the viewmode control widget.
Definition: Core.cc:1030
void updateUI()
process events during script execution to keep the ui alive
Definition: Core.cc:949
void allCleared()
Signal send to plugins when whole scene is cleared.
void disconnect()
Remove connection of this object to a file.
Definition: INIFile.cc:122
QTimer * scenegraphCheckTimer_
Timer that starts scenegraph check.
Definition: Core.hh:1472
void slotLog(Logtype _type, QString _message)
Console logger.
Definition: Logging.cc:91
virtual void slotInformationRequested(const QPoint _clickedPoint, DataType _type)=0
Show information dialog on clicked object.
void setSlotDescription(QString _slotName, QString _slotDescription, QStringList _parameters, QStringList _descriptions)
Core scripting engine.
void slotCall(QString _pluginName, QString _functionName, bool &_success)
Definition: RPC.cc:94
void writeOnExit()
Called if app is closed and writes all information to ini file.
Definition: Core.cc:1131
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
Definition: Types.cc:139
void snapshotBaseFileName(const QString &_fname)
void viewerSnapshot()
Create a snapshot of the whole app.
static void loadSavedPostProcessors(const unsigned _examiner)
append all saved post processors
QSplitter * toolSplitter_
Spliter between toplevel objects and toolbox.
Definition: CoreWidget.hh:731
void showStatusBar(bool _state)
Show or hide Status Bar.
Definition: Core.cc:1079
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
void objectDeleted(int)
Called after an object has been deleted.
QList< int > objectList(QString _selection, QStringList _types)
return the list of available object that has the given selection and type
Definition: Core.cc:1543
bool checkOpenGLCapabilities()
OpenGL capability check.
Definition: Core.cc:1934
QList< SlotInfo > coreSlots_
Core scripting engine.
Definition: Core.hh:1402