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