...
 
Commits (182)
......@@ -164,7 +164,7 @@ int viewerId() {
return viewerId_;
}
void setViewers( std::vector< glViewer* > _viewerWidgets ) {
void setViewers( const std::vector< glViewer* >& _viewerWidgets ) {
PluginFunctions::examiner_widgets_ = _viewerWidgets;
PluginFunctions::examiner_widget_ = examiner_widgets_[0];
......@@ -174,7 +174,7 @@ void setViewers( std::vector< glViewer* > _viewerWidgets ) {
viewerId_ = qrand();
}
void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties ) {
void setViewerProperties( const std::vector< Viewer::ViewerProperties* >& _viewerProperties ) {
PluginFunctions::viewerProperties_ = _viewerProperties;
}
......@@ -221,9 +221,11 @@ void setEncodedExaminerView( QString _view ) {
void setEncodedExaminerView(int _viewerId , QString _view ) {
// Consistency check. If viewer id is wrong, we set the currently active viewer.
if ( _viewerId < 0 || _viewerId >= (int)examiner_widgets_.size() ) {
std::cerr << "Requested unknown viewer with id : " << _viewerId << std::endl;
examiner_widgets_[activeExaminer()]->decodeView ( _view );
return;
}
examiner_widgets_[_viewerId]->decodeView ( _view );
......
......@@ -466,6 +466,8 @@ class DLLEXPORT ObjectIterator {
/// additional constructor starting at a given position
ObjectIterator(BaseObjectData* pos, IteratorRestriction _restriction = ALL_OBJECTS , DataType _dataType = DATA_ALL );
ObjectIterator(const ObjectIterator &) = default;
/// return the current position of the iterator
operator value_handle() { return pos_; };
......@@ -476,7 +478,7 @@ class DLLEXPORT ObjectIterator {
bool operator!=( const ObjectIterator& _rhs) const;
/// assign iterators
ObjectIterator& operator=( const ObjectIterator& _rhs);
ObjectIterator& operator=( const ObjectIterator&) = default;
/// dereference
pointer operator->();
......
......@@ -79,7 +79,7 @@ namespace PluginFunctions {
//=======================================
/// Set the internal Viewer pointer ( DO NOT USE!! )
DLLEXPORT
void setViewers( std::vector< glViewer* > _viewerWidgets );
void setViewers( const std::vector< glViewer* >& _viewerWidgets );
/// Get a Viewer
DLLEXPORT
......@@ -87,7 +87,7 @@ glViewer* viewer(int _viewerId );
/// Set the internal viewerProperties pointer ( DO NOT USE!! )
DLLEXPORT
void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties );
void setViewerProperties( const std::vector< Viewer::ViewerProperties* >& _viewerProperties );
/** Set the internal scenegraph root node pointer. This is the topmost
* node of the whole scenegraph ( DO NOT USE!! )
......
......@@ -109,13 +109,6 @@ bool ObjectIterator::operator!=( const ObjectIterator& _rhs) const {
return ( _rhs.pos_ != pos_ );
}
ObjectIterator& ObjectIterator::operator=( const ObjectIterator& _rhs) {
pos_ = _rhs.pos_;
dataType_ = _rhs.dataType_;
restriction_ = _rhs.restriction_;
return *this;
}
ObjectIterator::pointer ObjectIterator::operator->(){
return pos_;
......
......@@ -130,6 +130,8 @@ To use the ToolboxInterface:
<li> derive your plugin from the class ToolboxInterface
<li> add Q_INTERFACES(ToolboxInterface) to your plugin class
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
<li> If you want your icons to be shipped with your plugin directory, create a subfolder called Icons in your Plugin Directory, add your icons to the directory, add "INSTALLDATA Icons" into your plugins CMakeLists.txt</li>
</ul>
Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup
......
#include "CommandLineParser.hh"
#include <iostream>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctionsCore.hh>
// Parse all options
CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *errorMessage) {
#ifndef WIN32
#ifndef __APPLE__
//workaround for bug with stereo mode on Qt5.7.0 and Qt5.7.1 on Linux
int QtVersionMajor, QtVersionMinor, QtVersionPatch;
if(sscanf(qVersion(),"%1d.%1d.%1d",&QtVersionMajor, &QtVersionMinor, &QtVersionPatch) == 3)
{
if(QtVersionMajor == 5 && QtVersionMinor >= 7)
{
if(QtVersionPatch < 2)
{
std::cerr << "The used Qt Version does not support stereo mode. Disabling stereo mode." << std::endl;
OpenFlipper::Options::stereo(false);
}
else
std::cerr << "Stereo Mode has not been tested for the used Qt Version." << std::endl;
}
}
#endif
#endif
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
QCommandLineOption debugOption(QStringList() << "d" << "debug",QCoreApplication::translate("main", "Enable debugging mode"));
parser.addOption(debugOption);
QCommandLineOption stereoOption("disable-stereo",QCoreApplication::translate("main", "Disable stereo mode"));
parser.addOption(stereoOption);
QCommandLineOption batchOption(QStringList() << "b" << "batch",QCoreApplication::translate("main", "Batch mode, you have to provide a script for execution"));
parser.addOption(batchOption);
QCommandLineOption logConsoleOption(QStringList() << "c" << "log-to-console",QCoreApplication::translate("main", "Write logger window contents to console"));
parser.addOption(logConsoleOption);
QCommandLineOption remoteControlOption("remote-control",QCoreApplication::translate("main", "Batch mode accepting remote connections"));
parser.addOption(remoteControlOption);
QCommandLineOption fulscreenOption(QStringList() << "f" << "fullscreen",QCoreApplication::translate("main", "Start in fullscreen mode"));
parser.addOption(fulscreenOption);
QCommandLineOption hideLoggerOption(QStringList() << "l" << "hide-logger",QCoreApplication::translate("main", "Start with hidden log window"));
parser.addOption(hideLoggerOption);
QCommandLineOption hideToolboxOption(QStringList() << "t" << "hide-toolbox",QCoreApplication::translate("main", "Start with hidden toolbox"));
parser.addOption(hideToolboxOption);
QCommandLineOption noSplashOption("no-splash",QCoreApplication::translate("main", "Hide splash screen"));
parser.addOption(noSplashOption);
QCommandLineOption polyMeshOption("p",QCoreApplication::translate("main", "Open files as PolyMeshes"));
parser.addOption(polyMeshOption);
QCommandLineOption remotePortOption("remote-port",QCoreApplication::translate("main", "Remote port"),"portnumber");
parser.addOption(remotePortOption);
QCommandLineOption coreProfileOption("core-profile",QCoreApplication::translate("main", "OpenGL Core Profile Mode"));
parser.addOption(coreProfileOption);
QCommandLineOption glVersionOption("glVersion",QCoreApplication::translate("main","Request OpenGL version <major>.<minor> "),QCoreApplication::translate("main","< 1.0 | 1.1 | ... | 4.6 >"));
parser.addOption(glVersionOption);
QCommandLineOption samplesOption("samples",QCoreApplication::translate("main","Overwrite multisampling sample count"),QCoreApplication::translate("main","< 0 | 1 | 2 | ... | 16 >"));
parser.addOption(samplesOption);
QCommandLineOption glStereoOption("glStereo",QCoreApplication::translate("main","Overwrite OpenGL Stereo setting"),QCoreApplication::translate("main","< true | false >"));
parser.addOption(glStereoOption);
QCommandLineOption profileOption("profile",QCoreApplication::translate("main","Request OpenGL context profile <profile> with profile set as compat or core"),QCoreApplication::translate("main","< compat | core >"));
parser.addOption(profileOption);
QCommandLineOption pluginOptionsOption(QStringList() << "o" << "pluginoptions",QCoreApplication::translate("main", "Pass options to plugins"), "key1=value1;key2=value2;...");
parser.addOption(pluginOptionsOption);
const QCommandLineOption helpOption = parser.addHelpOption();
const QCommandLineOption versionOption = parser.addVersionOption();
// Now parse the command line
if (!parser.parse(QCoreApplication::arguments())) {
*errorMessage = parser.errorText();
return CommandLineError;
}
if (parser.isSet(helpOption))
return CommandLineHelpRequested;
if (parser.isSet(versionOption))
return CommandLineVersionRequested;
if (parser.isSet(debugOption)) {
OpenFlipper::Options::debug(true);
}
if (parser.isSet(stereoOption)) {
OpenFlipper::Options::stereo(false);
}
if (parser.isSet(batchOption)) {
OpenFlipper::Options::nogui(true);
}
if (parser.isSet(logConsoleOption)) {
OpenFlipper::Options::logToConsole(true);
}
if (parser.isSet(remoteControlOption)) {
OpenFlipper::Options::remoteControl(true);
}
if (parser.isSet(fulscreenOption)) {
OpenFlipperSettings().setValue("Core/Gui/fullscreen",true);
}
if (parser.isSet(hideLoggerOption)) {
OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden);
}
if (parser.isSet(hideToolboxOption)) {
OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",true);
}
if (parser.isSet(noSplashOption)) {
OpenFlipperSettings().setValue("Core/Gui/splash",false);
}
if (parser.isSet(polyMeshOption)) {
openPolyMeshes = true;
}
if (parser.isSet(remotePortOption)) {
const QString port = parser.value("remote-port");
std::cerr << "Got port option : " << port.toStdString() << std::endl;
OpenFlipper::Options::remoteControl(port.toInt());
}
if(parser.isSet("samples"))
OpenFlipper::Options::samples(parser.value("samples").toInt(),true);
if(parser.isSet("glVersion"))
{
QStringList values = parser.value("glVersion").split(".");
QPair<int,int> version(
values[0].toInt(),
values[1].toInt());
OpenFlipper::Options::glVersion(version,true);
}
if(parser.isSet("glStereo"))
OpenFlipper::Options::glStereo(parser.value("glStereo")=="true");
if(parser.value(profileOption)=="core")
{
OpenFlipper::Options::coreProfile(true, true);
}
else
{
if(parser.value(profileOption)=="compat")
{
OpenFlipper::Options::coreProfile(false, true);
}
}
if(parser.isSet(coreProfileOption)) {
OpenFlipper::Options::coreProfile(true, true);
}
if(parser.isSet(pluginOptionsOption))
{
QStringList poptions = parser.value(pluginOptionsOption).split(";");
QVector<QPair<QString, QString>> pcloptions;
for(auto s : poptions)
{
auto kvp = s.split("=");
// Only consider terms of the kind "key=value"
if(kvp.size() != 2u)
continue;
auto key = kvp[0];
auto value = kvp[1];
pcloptions.push_back({key, value});
}
PluginFunctions::setPluginCommandLineOptions(pcloptions);
}
return CommandLineOk;
}
#include <QCommandLineParser>
enum CommandLineParseResult
{
CommandLineOk,
CommandLineError,
CommandLineVersionRequested,
CommandLineHelpRequested
};
static bool openPolyMeshes = false;
static bool remoteControl = false;
// Parse all options
CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *errorMessage);
......@@ -226,7 +226,7 @@ Core::init() {
connect(scenegraphCheckTimer_, SIGNAL(timeout()), this, SLOT(checkScenegraphDirty()),Qt::DirectConnection);
// Will measure the time between redraws
redrawTime_ = new QTime();
redrawTime_ = new QElapsedTimer();
redrawTime_->start ();
if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
......@@ -270,7 +270,8 @@ Core::init() {
connect( coreWidget_->logWidget_->openMeshFilterAction_,SIGNAL(toggled(bool)), this, SLOT(enableOpenMeshErrorLog(bool)) );
QRect rect = QApplication::desktop()->screenGeometry();
QScreen *screen = QGuiApplication::primaryScreen();
QRect rect = screen->geometry();
uint width = rect.width();
if ( width > 1000 ) {
......@@ -566,35 +567,49 @@ Core::init() {
// Set renderer
// ====================================================
QString defaultRendererKey = "Viewer" + QString::number(i)+"/DefaultRenderer";
QString defaultRendererName = OpenFlipperSettings().value(defaultRendererKey,"Default Classical Renderer Plugin").toString();
// Check if the renderer is there
int defaultRendererId = renderManager().getRendererId(defaultRendererName);
// Choose one of the two possible renderers. Shader Pipeline for Core Profile or Classical for Compatibility Profile
QString rendererDefault;
if ( defaultRendererId == -1 ) {
emit log(LOGERR,tr("Stored default renderer \"") + defaultRendererName + tr("\" is not available, trying Classical!"));
if ( OpenFlipper::Options::coreProfile() )
rendererDefault = "Shader Pipeline Renderer Plugin";
else
rendererDefault = "Default Classical Renderer Plugin";
// Check if the renderer is there
defaultRendererId = renderManager().getRendererId("Default Classical Renderer Plugin");
// Try to get a default renderer Name from the settings file. If it's not there, we fall back to the default set above
// based on the current OpenGL Profile
QString rendererKey = "Viewer" + QString::number(i)+"/DefaultRenderer";
QString rendererName = OpenFlipperSettings().value(rendererKey,rendererDefault).toString();
// Classical available?
if ( defaultRendererId != -1 ) {
renderManager().setActive(defaultRendererId,i);
// 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.
int rendererId = renderManager().getRendererId(rendererName);
if ( rendererId == -1 ) {
// That failed. So either the one stored in the settings is not available or our default failed.
emit log(LOGERR,tr("Stored default renderer \"") + rendererName + tr("\" is not available, trying") + rendererDefault + "!");
// Anyway, lets try the default fallback:
rendererId = renderManager().getRendererId(rendererDefault);
// Successful?
if ( rendererId != -1 ) {
// Lets set it as the active one
renderManager().setActive(rendererId,i);
} else {
emit log(LOGERR,tr("Default classical renderer is also not available. Trying to use any other renderer i can find!"));
emit log(LOGERR,rendererDefault + tr(" renderer is also not available. Trying to use any other renderer i can find!"));
// debug information for this case, print renderer count and their names
const unsigned int rendererCount = renderManager().available();
emit log(LOGERR,tr("Currently ") + QString::number(rendererCount) + tr(" renderers are available:") );
for (unsigned int i = 0 ; i < rendererCount ; ++i )
emit log(LOGERR, tr("Renderer ") + QString::number(i) + ": " + renderManager()[i]->name );
for (unsigned int rendererId = 0 ; rendererId < rendererCount ; ++rendererId )
emit log(LOGERR, tr("Renderer ") + QString::number(rendererId) + ": " + renderManager()[rendererId]->name );
}
} else {
renderManager().setActive(defaultRendererId,i);
renderManager().setActive(rendererId,i);
}
}
// Warn the user in the log and via messagebox, that he is using the build in renderer only
......@@ -763,6 +778,7 @@ Core::slotMouseEventIdentify( QMouseEvent* _event )
// Only catch left-button clicks
if(_event->button() != Qt::LeftButton) return;
if(_event->type() != QEvent::MouseButtonRelease) return;
const QObject* senderPointer = sender();
unsigned int examinerId = 0;
......@@ -1901,8 +1917,8 @@ void Core::slotDeleteAllObjects( ){
bool Core::checkLibraryVersions() {
bool ok = true;
bool warn = false;
// bool ok = true;
// bool warn = false;
QString messages;
......@@ -1916,39 +1932,40 @@ bool Core::checkLibraryVersions() {
messages += tr("Link time QT Version:\t\t") + QString( QT_VERSION_STR ) + "\n";
messages += tr("This inconsistency may lead to an unstable behavior of OpenFlipper!");
warn = true;
// warn = true;
}
if ( !ok ) {
QString message = tr("Error! Library tests failed!\n");
message += tr("The following problems have been found:\n\n");
message += messages;
std::cerr << message.toStdString() << std::endl;
if ( OpenFlipper::Options::gui() ) {
finishSplash();
StaysOnTopMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message );
}
// Unsafe operation, so quit the application
exitFailure();
} else if ( warn ) {
QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
message += tr("The following checks failed:\n\n");
message += messages;
std::cerr << message.toStdString() << std::endl;
if ( OpenFlipper::Options::gui() ) {
finishSplash();
StaysOnTopMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message );
}
// if ( !ok ) {
// QString message = tr("Error! Library tests failed!\n");
// message += tr("The following problems have been found:\n\n");
//
// message += messages;
//
// std::cerr << message.toStdString() << std::endl;
//
// if ( OpenFlipper::Options::gui() ) {
// finishSplash();
// StaysOnTopMessageBox::critical ( 0, tr( "Library incompatibilities found!"),message );
// }
//
// // Unsafe operation, so quit the application
// exitFailure();
//
// } else if ( warn ) {
}
// QString message = tr("Warning! The OpenGL capabilities of your current machine/driver could be insufficient!\n\n");
// message += tr("The following checks failed:\n\n");
// message += messages;
//
// std::cerr << message.toStdString() << std::endl;
//
// if ( OpenFlipper::Options::gui() ) {
// finishSplash();
// StaysOnTopMessageBox::warning ( 0, tr( "Library incompatibilities found!"),message );
// }
//
// }
#ifndef NDEBUG
else {
std::cerr << "Library Check succeeded" << std::endl;
......@@ -2042,7 +2059,11 @@ void Core::showReducedMenuBar(bool reduced) {
}
void Core::finishSplash() {
if (splash_) splash_->finish(coreWidget_);
if (splash_) {
splash_->finish(coreWidget_);
splash_->deleteLater();
splash_ = 0;
}
}
......
......@@ -928,8 +928,8 @@ private slots:
void stopVideoCapture();
private:
QTimer videoTimer_;
QTime lastVideoTime_;
QTimer videoTimer_;
QElapsedTimer lastVideoTime_;
int captureType_;
......@@ -1472,7 +1472,7 @@ private slots:
QTimer *scenegraphCheckTimer_;
/// Holds the time since last redraw
QTime *redrawTime_;
QElapsedTimer *redrawTime_;
/** @} */
......
......@@ -108,8 +108,8 @@ void Core::readApplicationOptions(INIFile& _ini) {
// Check if the mode already exists
bool found = false;
for (int i=0; i < viewModes_.size(); i++)
if (viewModes_[i]->name == mode)
for (int modeNr = 0; modeNr < viewModes_.size(); modeNr++)
if (viewModes_[modeNr]->name == mode)
found = true;
if (!found){
......
......@@ -316,12 +316,16 @@ void Core::loadPlugins()
* Remove static plugins from dynamically loaded list.
*/
{
QSet<QString> staticPlugins = QSet<QString>::fromList(
QString::fromUtf8(cmake::static_plugins).split("\n"));
QStringList list = QString::fromUtf8(cmake::static_plugins).split("\n");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<QString> staticPlugins = QSet<QString>(list.begin(),list.end());
#else
QSet<QString> staticPlugins = QSet<QString>::fromList(list);
#endif
for (int i = 0; i < pluginlist.size(); ) {
const QString bn = QFileInfo(pluginlist[i]).fileName();
const QString bn = QFileInfo(pluginlist[i]).baseName().remove("lib");
if (staticPlugins.contains(bn)) {
emit log(LOGOUT, trUtf8("Not loading dynamic %1 as it is statically "
emit log(LOGWARN, tr("Not loading dynamic %1 as it is statically "
"linked against OpenFlipper.").arg(bn));
pluginlist.removeAt(i);
} else {
......@@ -341,7 +345,7 @@ void Core::loadPlugins()
emit log(LOGOUT,"================================================================================");
QTime time;
QElapsedTimer time;
time.start();
......
......@@ -66,6 +66,11 @@ void Core::startVideoCapture(QString _baseName, int _fps, bool _captureViewers)
// set track to true;
videoTimer_.setSingleShot(false);
// sanitize input
if (_fps == 0) {
_fps = 25;
}
// 25 fps
videoTimer_.start( 1000 / _fps);
......
This diff is collapsed.
......@@ -9,7 +9,7 @@ OpenFlipper.
\section reqlibs Required libraries
<ul>
<li> 5.9 <= Qt <= 5.11 ( http://www.qt.io/download/ ) Use the OpenGL version. If you install Qt, please make sure that QtScript is also installed.</li>
<li> 5.11 <= Qt <= 5.13 ( http://www.qt.io/download/ ) Use the OpenGL version. If you install Qt, please make sure that QtScript is also installed.</li>
</ul>
\section optlibs Optional libraries ( Without these libraries some functionality might not be available)
......@@ -17,6 +17,13 @@ OpenFlipper.
<li> QWT (>=6.0) ( optional, used for histogram plottings, http://qwt.sourceforge.net/)</li>
</ul>
On Debian, you can install the prerequisites this way (tested on Debian buster):
<code>
apt install cmake make g++ libeigen3-dev python3-dev qt5-default libqt5script5 libqt5scripttools5 libqt5svg5-dev libqt5quick5 libqt5x11extras5-dev libqt5help5 qtscript5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev qttools5-dev qtdeclarative5-dev libqt5opengl5-dev libglew-dev
</code>
\section bs Build System
The build system uses cmake to generate all makefiles.
......@@ -51,8 +58,8 @@ directory.
\subsection cmake_bwin Building OpenFlipper under Windows
<ul>
<li>Get Visual Studio 2015 or higher (We recommend 2017) </li>
<li> Get cmake for windows from http://www.cmake.org/cmake/resources/software.html </li>
<li>Get Visual Studio 2017 or higher (We recommend 2017) </li>
<li>Get cmake for windows from http://www.cmake.org/cmake/resources/software.html </li>
<li>Get and Install Qt ( >= 5.9) , Visual Studio Version matching your installation ) </li>
<li>Download and install git (https://git-scm.com/downloads)</li>
<li>Start git gui</li>
......
/*! \page changelog Changelog
- <b>OpenFlipper 4.1 ( ?/?/? )</b>
- <b>OpenFlipper 5.0 ( ?/?/? )</b>
- <b>Breaking changes</b>
- Support for VS2015 dropped ( Compiler bugs)
- <b>Core</b>
- avoid double events when using the info button (mouse down and up)
- Use SetErrorMode() to get notification on crashes which can otherwise be silent
- Work around bitset VS2017 and earlier compiler bug
- Split the platform specific startup code into separate files
- Use explicit template instantiation to reduce incremental compile time
- Fixed ugly picking bug, where picking fails if more then 16.8 m primitives are in the scene
- <b>ACG</b>
- Fix rendering of colored mesh edges in Core Profile
- Fixed manipulator node returning nan in certain conditions
- Updated histogram class
- <b>Build System</b>
- Removed glob file operation for coreapp and pluginlib (They have to be explicitly added to the cmake file now)
- <b>OpenFlipper 4.1 ( 13/12/2019 )</b>
- <b>ACG</b>
- GlutPrimitiveNode: Added cone support
- <b>Python Subsystem</b>
......@@ -12,6 +32,7 @@
- Type Light: Python Interface added
- Primitives Generator: Python Interface added
- Mesh Compare: Python Interface added
- Noise: New plugin to add noise to meshes or splats
- <b>OpenFlipper 4.0 ( 05/03/2019 )</b>
......
......@@ -24,5 +24,50 @@
\subsection python_scripting_idlisttype IDList data type
The IdList type used in the C++ code is mapped from python. Details can be found here:
\subpage python_scripting_IDList_type
\section python_scripting_examples Examples
Here is a simple example of a python script using the holefiller:
\code
# Load an object from a specific path
id = fileoff.loadObject("OpenFlipper-Free/OpenFlipper/cube1.off")
# Prints the id of the new object
print("ID of new object is : " + str(id) )
# Selects a set of faces
meshobjectselection.selectFaces(id,[0,1,2,3,4,5,6,7,8,9,10])
# deletes the selected faces
meshobjectselection.deleteFaceSelection(id)
# And runs the hole filler to close the holes produced by the previous operation
holefiller.fillAllHoles(id)
\endcode
Another example produces an animation of a rotating object:
\code
# We need numpy for array and vectors
import numpy as np
# Generate a cube via the primitivesgenerator plugin
primitivesgenerator.addCube()
# Set our animation parameters
animation_axis = np.array([-1.0,1.0,0.0]);
rotation_center = np.array([0.0,0.0,0.0])
# Loop over 360 degrees
for angle in range(0,360,1):
# Apply rotation
viewcontrol.rotate(animation_axis,1,rotation_center,0)
# Update the current view
core.updateView()
# Update the ui
core.updateUI()
\endcode
*/
......@@ -178,7 +178,7 @@ STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = YES
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
......
......@@ -178,7 +178,7 @@ STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = YES
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
......
......@@ -178,7 +178,7 @@ STRIP_FROM_INC_PATH =
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = YES
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
......
......@@ -178,7 +178,7 @@ STRIP_FROM_INC_PATH =
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = YES
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
......
......@@ -178,7 +178,7 @@ STRIP_FROM_INC_PATH =
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = YES
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
......
......@@ -74,6 +74,7 @@ License File format:
#include <QString>
#include <QCryptographicHash>
#include <QNetworkInterface>
#include <QTime>
#include <limits>
......
......@@ -51,15 +51,15 @@
#include "salt.hh"
KeyGen::KeyGen(QString n, QString cHash, QString pHash, QString cpHash, QString prHash, QStringList mHashes, QString request)
KeyGen::KeyGen(QString n, QString cHash, QString pHash, QString cpHash, QString prHash, QStringList mHashes, QString request) :
name (n),
coreHash(cHash),
pluginHash(pHash),
cpuHash(cpHash),
productHash(prHash),
macHashes(mHashes),
requestSig(request)
{
name = n;
coreHash = cHash;
pluginHash = pHash;
cpuHash = cpHash;
productHash = prHash;
macHashes = mHashes;
requestSig = request;
}
QString KeyGen::computeSignature(const bool _utf8 ) const {
......
This diff is collapsed.
namespace
{
// Print human-readable GL profile strings
std::string profileToString(QSurfaceFormat::OpenGLContextProfile _profile)
{
if(_profile == QSurfaceFormat::CompatibilityProfile)
return "CompatibilityProfile";
if(_profile == QSurfaceFormat::CoreProfile)
return "CoreProfile";
if(_profile == QSurfaceFormat::NoProfile)
return "NoProfile";
return "[Unknown]";
}
// Check whether a specific context request can be fulfilled
// Can also return the format of the actually created context
bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultingFormat = nullptr)
{
// All created surfaces try to obey the given format
QSurfaceFormat::setDefaultFormat(format);
// We need a temporary qApp to create a surface and test the current context
int tempArgC = 0;
QApplication tempApp(tempArgC, nullptr);
QOffscreenSurface *surface = new QOffscreenSurface();
surface->create();
auto shareContext = QOpenGLContext::globalShareContext();
if(!shareContext)
{
std::cerr << "Error: Apparently no GL context was created!" << std::endl;
return false;
}
// Make the globally shared OpenGLContext current
shareContext->makeCurrent(surface);
// The opengl surface properties that have actually been applied
// (does not necessarily match the requested properties)
auto resultFormat = QOpenGLContext::globalShareContext()->format();
// Return the format of the actually created context (may be identical to the requested one)
if(resultingFormat != nullptr)
*resultingFormat = resultFormat;
auto curVersion = resultFormat.version();
// Human-readable name of requested profile
auto reqProfileString = profileToString(format.profile());
// Human-readable name of current profile
auto curProfileString = profileToString(resultFormat.profile());
// Example: OpenGL Version 4.6 -> 46
auto reqVersionInt = format.version().first * 10 + format.version().second;
auto curVersionInt = curVersion.first * 10 + curVersion.second;
// We set the following guidelines:
// 1. Whenever the actually received GL version is < than the requested one, the context is not the one requested
// 2. If the received profile is not the requested one, the context is not the one requested
if(curVersionInt < 32 && resultFormat.profile() == QSurfaceFormat::CoreProfile)
{
std::cerr << "Warning: Got an OpenGL core context with OpengGL version < 3.2 (" << curVersion.first << "." << curVersion.second << ")! This should not be possible." << std::endl;
return false;
}
// Check whether the conditions above are met.
// If not, print some error to the console
if(curVersionInt < reqVersionInt ||
format.profile()!= resultFormat.profile() )
{
std::cout << "[OpenGL context] Requested: "
<< format.version().first << "." << format.version().second << " (" << reqProfileString << ")"
<< ", Actually created: "
<< curVersion.first << "." << curVersion.second << " (" << curProfileString << ")"
<< std::endl;
return false;
}
std::cout << "[OpenGL context] Successfully created OpenGL context with version " << curVersion.first << "."
<< curVersion.second << " (" << curProfileString << ")." << std::endl;
return true;
}
// Create a QSurfaceFormat from the most important properties like version and profile
QSurfaceFormat createFormat(QSurfaceFormat::OpenGLContextProfile _profile, int _glMajor, int _glMinor, int _multisamplingSamples, bool _stereo, bool _debugContext)
{
QSurfaceFormat format;
format.setVersion(_glMajor, _glMinor);
format.setProfile(_profile);
format.setSamples(_multisamplingSamples);
format.setStereo(_stereo);
if(_profile != QSurfaceFormat::CoreProfile)
format.setOption(QSurfaceFormat::DeprecatedFunctions);
if (_debugContext)
format.setOption(QSurfaceFormat::DebugContext);
return format;
}
// This method tries to find the best possible OpenGL context format in the following order:
// 1. The profile/format requested via the settings
// 2. A 4.4 compatibility context (should contain all relevant GL functions)
// 3. A 3.2 core context (best choice e.g. on MacOS)
// 4. Return whatever context was applied instead of the requested ones
QSurfaceFormat getContextFormat()
{
auto reqProfile = OpenFlipper::Options::coreProfile() ? QSurfaceFormat::CoreProfile : QSurfaceFormat::CompatibilityProfile;
QPair<int,int> reqVersion = OpenFlipper::Options::glVersion();
auto reqSamples = OpenFlipper::Options::samples();
auto reqStereo = OpenFlipper::Options::glStereo();
bool debugContext = OpenFlipper::Options::debug();
/*
// Debug: test all (possible and impossible) OpenGL versions and profiles and exit
for(int majo = 1; majo < 5; ++majo)
for(int mino = 0; mino < 10; ++mino)
{
std::cout << "========== " << majo << "." << mino << " ==========="<<std::endl;
verifySpecificContextFormat(createFormat(QSurfaceFormat::CoreProfile, majo, mino, reqSamples, reqStereo, debugContext));
verifySpecificContextFormat(createFormat(QSurfaceFormat::CompatibilityProfile, majo, mino, reqSamples, reqStereo, debugContext));
verifySpecificContextFormat(createFormat(QSurfaceFormat::NoProfile, majo, mino, reqSamples, reqStereo, debugContext));
std::cout << "================================" << std::endl;
std::cout << std::endl;
}
exit(0);
*/
QSurfaceFormat resultFormat;
std::cout << "[OpenGL context] Trying to create a " << reqVersion.first << "." << reqVersion.second << " " << profileToString(reqProfile) << " context (default from settings)..." << std::endl;
bool success = verifySpecificContextFormat(createFormat(reqProfile, reqVersion.first, reqVersion.second, reqSamples, reqStereo, debugContext), &resultFormat);
// If that did not work...
if(!success)
{
std::cout << "[OpenGL context] Trying to create a 4.4 compat context..." << std::endl;
success = verifySpecificContextFormat(createFormat(QSurfaceFormat::CompatibilityProfile, 4, 4, reqSamples, reqStereo, debugContext), &resultFormat);
if(!success)
{
std::cout << "[OpenGL context] Trying to create a 3.2 core context..." << std::endl;
success = verifySpecificContextFormat(createFormat(QSurfaceFormat::CoreProfile, 3, 2, reqSamples, reqStereo, debugContext), &resultFormat);
if(!success)
{
std::cerr << "[OpenGL context] Warning: Could not create any of the requested GL contexts." << std::endl;
std::cerr << "[OpenGL context] The following context (proposed by the graphics driver) will be created:" << std::endl;
std::cerr << "[OpenGL context] Profile: " << profileToString(resultFormat.profile()) << ", Version: "
<< resultFormat.version().first << "." << resultFormat.version().second << std::endl;
std::cerr << "[OpenGL context] Please consider setting a supported OpenGL version and profile in the Options dialog." << std::endl;
}
}
}
return resultFormat;
}
}
......@@ -88,28 +88,157 @@ endif()
# Collect files to compile
#=======================================================
# source code directories
set (directories
../BasePlugin
../ACGHelper
../common
../threads
../common/bsp
../INIFile
../widgets/glWidget
../publicWidgets/objectSelectionWidget
../widgets/filePicker
../Utils/FileIO
../Utils/Memory
set( headers
../BasePlugin/AboutInfoInterface.hh
../BasePlugin/BackupInterface.hh
../BasePlugin/BaseInterface.hh
../BasePlugin/ContextMenuInterface.hh
../BasePlugin/FileInterface.hh
../BasePlugin/INIInterface.hh
../BasePlugin/InformationInterface.hh
../BasePlugin/KeyInterface.hh
../BasePlugin/LoadSaveInterface.hh
../BasePlugin/LoggingInterface.hh
../BasePlugin/MenuInterface.hh
../BasePlugin/MetadataInterface.hh
../BasePlugin/MouseInterface.hh
../BasePlugin/OptionsInterface.hh
../BasePlugin/PickingInterface.hh
../BasePlugin/PluginConnectionInterface.hh
../BasePlugin/PluginFunctions.hh
../BasePlugin/PluginFunctionsCore.hh
../BasePlugin/PluginFunctionsSceneGraphWidget.hh
../BasePlugin/PluginFunctionsViewControls.hh
../BasePlugin/PostProcessorInterface.hh
../BasePlugin/ProcessInterface.hh
../BasePlugin/PythonFunctions.hh
../BasePlugin/PythonFunctionsCore.hh
../BasePlugin/PythonInterface.hh
../BasePlugin/RPCInterface.hh
../BasePlugin/RPCWrappers.hh
../BasePlugin/RPCWrappersHelper.hh
../BasePlugin/RenderInterface.hh
../BasePlugin/ScriptInterface.hh
../BasePlugin/SecurityInterface.hh
../BasePlugin/SelectionInterface.hh
../BasePlugin/StatusbarInterface.hh
../BasePlugin/TextureInterface.hh
../BasePlugin/ToolbarInterface.hh
../BasePlugin/ToolboxInterface.hh
../BasePlugin/TypeInterface.hh
../BasePlugin/ViewInterface.hh
../BasePlugin/ViewModeInterface.hh
../BasePlugin/WhatsThisGenerator.hh
../ACGHelper/DrawModeConverter.hh
../common/BackupData.hh
../common/BaseBackup.hh
../common/BaseObject.hh
../common/BaseObjectCore.hh
../common/BaseObjectData.hh
../common/BaseObjectDataT_impl.hh
../common/DataTypes.hh
../common/FileTypes.hh
../common/GlobalDefines.hh
../common/GlobalOptions.hh
../common/GroupObject.hh
../common/InformationPlugins.hh
../common/OFGLWidget.hh
../common/ObjectIDPointerManagerT.hh
../common/ObjectIDPointerManagerT_impl.hh
../common/ObjectTypeDLLDefines.hh
../common/OpenFlipperQSettings.hh
../common/PluginStorage.hh
../common/RecentFiles.hh
../common/RendererInfo.hh
../common/Types.hh
../common/TypesInternal.hh
../common/UpdateType.hh
../common/ViewObjectMarker.hh
../common/ViewerProperties.hh
../common/glew_wrappers.hh
../common/perObjectData.hh
../threads/JobInfo.hh
../threads/OpenFlipperThread.hh
../INIFile/INIFile.hh
../INIFile/INIFileT_impl.hh
../widgets/glWidget/CursorPainter.hh
../widgets/glWidget/PostProcessing.hh
../widgets/glWidget/QtBaseViewer.hh
../widgets/glWidget/QtGLGraphicsScene.hh
../widgets/glWidget/QtGLGraphicsView.hh
../widgets/glWidget/QtGLViewerLayout.hh
../widgets/glWidget/QtGraphicsButton.hh
../widgets/glWidget/QtMultiViewLayout.hh
../widgets/glWidget/QtSlideWindow.hh
../widgets/glWidget/simpleGLGraphicsScene.hh
../widgets/glWidget/simpleViewer.hh
../publicWidgets/objectSelectionWidget/SelectionObjectMarker.hh
../publicWidgets/objectSelectionWidget/TreeItemObjectSelection.hh
../publicWidgets/objectSelectionWidget/TreeModelObjectSelection.hh
../publicWidgets/objectSelectionWidget/objectPickDialog.hh
../publicWidgets/objectSelectionWidget/objectSelectionWidget.hh
../widgets/filePicker/FilePicker.hh
../Utils/FileIO/NumberParsing.hh
../Utils/Memory/RAMInfo.hh
)
# collect all header,source and ui files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui-files "*.ui" ${directories})
set( sources
../BasePlugin/PluginFunctions.cc
../BasePlugin/PluginFunctionsBaseIterator.cc
../BasePlugin/PluginFunctionsIterator.cc
../BasePlugin/PostProcessorInterface.cc
../BasePlugin/PythonFunctions.cc
../BasePlugin/RPCWrappers.cc
../BasePlugin/RPCWrappersHelper.cc
../BasePlugin/WhatsThisGenerator.cc
../ACGHelper/DrawModeConverter.cc
../common/BackupData.cc
../common/BaseBackup.cc
../common/BaseObject.cc
../common/BaseObjectCore.cc
../common/BaseObjectData.cc
../common/FileTypes.cc
../common/GlobalOptions.cc
../common/GroupObject.cc
../common/InformationPlugins.cc
../common/OpenFlipperQSettings.cc
../common/PluginStorage.cc
../common/RecentFiles.cc
../common/RendererInfo.cc
../common/Types.cc
../common/UpdateType.cc
../common/ViewerProperties.cc
../common/glew_wrappers.cc
../common/perObjectData.cc
../threads/JobInfo.cc
../threads/OpenFlipperThread.cc
../INIFile/INIFile.cc
../widgets/glWidget/CursorPainter.cc
../widgets/glWidget/PostProcessing.cc
../widgets/glWidget/QtBaseViewer.cc
../widgets/glWidget/QtBaseViewerFlyAnimation.cc
../widgets/glWidget/QtBaseViewerPicking.cc
../widgets/glWidget/QtBaseViewer_qt.cc
../widgets/glWidget/QtGLGraphicsScene.cc
../widgets/glWidget/QtGLGraphicsView.cc
../widgets/glWidget/QtGLViewerLayout.cc
../widgets/glWidget/QtGraphicsButton.cc
../widgets/glWidget/QtMultiViewLayout.cc
../widgets/glWidget/QtSlideWindow.cc
../widgets/glWidget/simpleGLGraphicsScene.cc
../widgets/glWidget/simpleViewer.cc
../publicWidgets/objectSelectionWidget/SelectionObjectMarker.cc
../publicWidgets/objectSelectionWidget/TreeItemObjectSelection.cc
../publicWidgets/objectSelectionWidget/TreeModelObjectSelection.cc
../publicWidgets/objectSelectionWidget/objectPickDialog.cc
../publicWidgets/objectSelectionWidget/objectSelectionWidget.cc
../widgets/filePicker/FilePicker.cc
../Utils/FileIO/NumberParsing.cc
../Utils/Memory/RAMInfo.cc
)
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${sources} ${headers} ${ui-files} )
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${sources} ${headers} )
#=======================================================
# Cleanup
......
VERSION=4.1
MAJOR=4
MINOR=1
VERSION=5.0
MAJOR=5
MINOR=0
PATCH=0
ID=OPENFLIPPER
#include "windows-startup.hh"
#include <windows.h>
#include <errhandlingapi.h>
#include <fstream>
#include <iostream>
#include <OpenFlipper/common/GlobalOptions.hh>
/* ==========================================================
*
* Stackwalker code. Used to get a backtrace if OpenFlipper
* crashes under windows
*
* ==========================================================*/
void StackWalkerToConsole::OnOutput(LPCSTR szText)
{
// Writes crash dump to .OpenFlipper config directory
std::ofstream crashFile;
QString crashName = OpenFlipper::Options::configDirStr() + QDir::separator() + "CrashDump.txt";
crashFile.open(crashName.toLatin1(),std::ios::out | std::ios::app);
crashFile << szText;
crashFile.close();
// Write crash dump to console as well
StackWalker::OnOutput(szText);
}
/* ==========================================================
*
* Console for Windows to get additional output written via
* cerr, cout, ... that is not forwarded to log window
*
* ==========================================================*/
void connect_console()
{
FILE* check = freopen("CONIN$", "r", stdin);
if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
check = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
std::cout.clear();
std::cerr.clear();
std::cin.clear();
std::wcout.clear();
std::wcerr.clear();
std::wcin.clear();
}
void attachConsole()
{
// try to attach the console of the parent process
if (AttachConsole(-1))
{
// if the console was attached change stdinput and output
connect_console();
}
else
{
// create and attach a new console if needed
#ifndef NDEBUG
// always open a console in debug mode
AllocConsole();
connect_console();
return;
#endif
if (OpenFlipper::Options::logToConsole())
{
AllocConsole();
connect_console();
}
}
}
#include "StackWalker/StackWalker.hh"
/* ==========================================================
*
* Stackwalker code. Used to get a backtrace if OpenFlipper
* crashes under windows
*
* ==========================================================*/
class StackWalkerToConsole : public StackWalker
{
protected:
virtual void OnOutput(LPCSTR szText) override;
};
/* ==========================================================
*
* Console for Windows to get additional output written via
* cerr, cout, ... that is not forwarded to log window
*
* ==========================================================*/
void connect_console();
void attachConsole();
......@@ -126,7 +126,7 @@ macro (acg_set_target_props target)
if (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE AND NOT (CMAKE_MAJOR_VERSION LESS 3))
set_target_properties (${target} PROPERTIES MACOSX_RPATH 1)
else()
set_target_properties(${target} PROPERTIES MACOSX_RPPATH 0) #disable "@rpath" option since fixup_bundle has some problems finding dependencies
set_target_properties(${target} PROPERTIES MACOSX_RPATH 0) #disable "@rpath" option since fixup_bundle has some problems finding dependencies
endif()
if (WIN32)
......
......@@ -46,10 +46,12 @@ endif( WIN32 )
if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
......@@ -59,28 +61,21 @@ if (UNIX)
################################################################################
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
# Deprecated setting. Remove in future release, as the default template depth
# should be enough with state of the art compilers
# Increase the template depth as this might be exceeded from time to time
#IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
# list(APPEND ADDITIONAL_CXX_FLAGS "-ftemplate-depth-100" )
#ENDIF()
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# Deprecated setting. Remove in future release, as the default template depth
# should be enough with state of the art compilers
# # Increase the template depth as this might be exceeded from time to time
# IF( NOT CMAKE_SYSTEM MATCHES "SunOS*")
# list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-ftemplate-depth-100" )
# list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-ftemplate-depth-100" )
# list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-ftemplate-depth-100" )
# ENDIF()
################################################################################
# OS Defines
################################################################################
if (APPLE)
add_definitions( -DARCH_DARWIN )
endif()
......@@ -101,7 +96,7 @@ if (UNIX)
################################################################################
# Warnings
################################################################################
# Add the standard compiler warnings
if ( NOT COMPILER_WARNINGS )
......@@ -114,18 +109,13 @@ if (UNIX)
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ELSE ()
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ENDIF()
ENDIF()
endif ( NOT COMPILER_WARNINGS )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )