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