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