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