Commit 79bfc70a authored by Jakob Weiss's avatar Jakob Weiss

Merge branch 'qt5' into campvis-nx

parents c56f094b 0227c942
# = CAMPVis - Yet another medical visualization framework ===================== # = CAMPVis - Yet another medical visualization framework =====================
PROJECT(CAMPVis) PROJECT(CAMPVis)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR) CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2 FATAL_ERROR)
cmake_policy(SET CMP0020 NEW)
SET(CAMPVIS_VERSION 1.0.0) SET(CAMPVIS_VERSION 1.0.0)
# = Global Build Options ====================================================== # = Global Build Options ======================================================
OPTION(BUILD_SHARED_LIBS "Build shared libraries (strongly recommended!)" ON) OPTION(BUILD_SHARED_LIBS "Build shared libraries (strongly recommended!)" ON)
OPTION(CAMPVIS_DEBUG "Activate debug code?" ON) OPTION(CAMPVIS_DEBUG "Activate debug code?" ON)
OPTION(CAMPVIS_BUILD_LIB_CGT "Build CGT Library" ON)
OPTION(CAMPVIS_BUILD_APPLICATION "Build CAMPVis Application" ON) OPTION(CAMPVIS_BUILD_APPLICATION "Build CAMPVis Application" ON)
OPTION(CAMPVIS_BUILD_MODULES "Build CAMPVis Modules" ON) OPTION(CAMPVIS_BUILD_MODULES "Build CAMPVis Modules" ON)
OPTION(CAMPVIS_ENABLE_SCRIPTING "Add support for scripting CAMPVis using Lua" OFF) OPTION(CAMPVIS_ENABLE_SCRIPTING "Add support for scripting CAMPVis using Lua" OFF)
...@@ -27,6 +29,10 @@ ENDIF() ...@@ -27,6 +29,10 @@ ENDIF()
SET(CAMPVIS_DEFAULT_ENABLED_MODULES "STABLE_NO_DEPENDENCIES" CACHE STRING "Default CAMPVis modules to activate") SET(CAMPVIS_DEFAULT_ENABLED_MODULES "STABLE_NO_DEPENDENCIES" CACHE STRING "Default CAMPVis modules to activate")
SET_PROPERTY(CACHE CAMPVIS_DEFAULT_ENABLED_MODULES PROPERTY STRINGS "NONE" "STABLE_NO_DEPENDENCIES" "STABLE_WITH_EXTERNAL_DEPENDENCIES" "TESTING" "ALL") SET_PROPERTY(CACHE CAMPVIS_DEFAULT_ENABLED_MODULES PROPERTY STRINGS "NONE" "STABLE_NO_DEPENDENCIES" "STABLE_WITH_EXTERNAL_DEPENDENCIES" "TESTING" "ALL")
IF(NOT BUILD_SHARED_LIBS)
MESSAGE(WARNING "Building shared libraries is turned off. Thus, CAMPVis will most probably not work as intended!\nPlease turn BUILD_SHARED_LIBS on unless you know what you're doing!")
ENDIF(NOT BUILD_SHARED_LIBS)
# propagate CAMPVIS_ENABLE_SCRIPTING to CAMPVIS_BUILD_LIB_LUA to support deprecated code # propagate CAMPVIS_ENABLE_SCRIPTING to CAMPVIS_BUILD_LIB_LUA to support deprecated code
IF (CAMPVIS_ENABLE_SCRIPTING) IF (CAMPVIS_ENABLE_SCRIPTING)
SET(CAMPVIS_BUILD_LIB_LUA ON) SET(CAMPVIS_BUILD_LIB_LUA ON)
...@@ -105,15 +111,9 @@ EXPORT(PACKAGE CAMPVis) ...@@ -105,15 +111,9 @@ EXPORT(PACKAGE CAMPVis)
# = Copy Windows DLLs to binary dir for improved development experience ======= # = Copy Windows DLLs to binary dir for improved development experience =======
IF(WIN32) IF(WIN32)
# gather Qt4 DLLs - TODO: remove redundant naming of required components
FIND_PACKAGE(Qt4DLLs COMPONENTS QtCore QtGui QtOpenGL QtNetwork QtXmlPatterns)
LIST(APPEND CampvisExternalDllsDebug ${QT_DEBUG_DLLS})
LIST(APPEND CampvisExternalDllsRelease ${QT_RELEASE_DLLS})
LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug)
LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease)
IF(CAMPVIS_COPY_EXTERNAL_DLLS) IF(CAMPVIS_COPY_EXTERNAL_DLLS)
LIST(REMOVE_DUPLICATES CampvisExternalDllsDebug)
LIST(REMOVE_DUPLICATES CampvisExternalDllsRelease)
COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false) COPY_EXTERNAL_DLLS(CampvisExternalDllsDebug CampvisExternalDllsRelease false)
ENDIF() ENDIF()
ENDIF() ENDIF()
......
PROJECT(campvis-application) PROJECT(campvis-application)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
INCLUDE(../cmake/commonconf.cmake) INCLUDE(../cmake/commonconf.cmake)
MESSAGE(STATUS "Configuring CAMPVis-Application") MESSAGE(STATUS "Configuring CAMPVis-Application")
...@@ -106,13 +105,7 @@ FOREACH(ModFile ${CampvisModulesApplicationToBeMocced}) ...@@ -106,13 +105,7 @@ FOREACH(ModFile ${CampvisModulesApplicationToBeMocced})
LIST(APPEND CampvisApplicationToBeMocced ${ModFileRelative}) LIST(APPEND CampvisApplicationToBeMocced ${ModFileRelative})
ENDFOREACH() ENDFOREACH()
# QT5_WRAP_UI(CampvisApplicationFormsHeaders ${CampvisApplicationForms})
# Qt related stuff:
#
QT4_WRAP_CPP(CampvisApplicationMoc ${CampvisApplicationToBeMocced})
LIST(APPEND CampvisApplicationSources ${CampvisApplicationMoc})
QT4_WRAP_UI(CampvisApplicationFormsHeaders ${CampvisApplicationForms})
LIST(APPEND CampvisApplicationSources ${CampvisApplicationFormsHeaders}) LIST(APPEND CampvisApplicationSources ${CampvisApplicationFormsHeaders})
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories}) LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
...@@ -127,14 +120,15 @@ ADD_LIBRARY(campvis-application-lib ...@@ -127,14 +120,15 @@ ADD_LIBRARY(campvis-application-lib
${CampvisApplicationSources} ${CampvisApplicationHeaders} ${CampvisApplicationSources} ${CampvisApplicationHeaders}
${CampvisApplicationMoc} ${CampvisApplicationMoc}
) )
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${CampvisApplicationDefinitions} ${QT_DEFINITIONS}) ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${CampvisApplicationDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs}) INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES}) TARGET_LINK_LIBRARIES(campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} Qt5::Widgets Qt5::OpenGL)
# if campvis-core is built as a shared library, CMake will define the following flag to instruct # if campvis-core is built as a shared library, CMake will define the following flag to instruct
# the code to export DLL symbols # the code to export DLL symbols
SET_TARGET_PROPERTIES(campvis-application-lib PROPERTIES DEFINE_SYMBOL "CAMPVIS_APPLICATION_BUILD_DLL") SET_TARGET_PROPERTIES(campvis-application-lib PROPERTIES DEFINE_SYMBOL "CAMPVIS_APPLICATION_BUILD_DLL")
IF(CAMPVIS_GROUP_SOURCE_FILES) IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationSources ${CampvisHome} "") DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationHeaders ${CampvisHome} "") DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationHeaders ${CampvisHome} "")
...@@ -144,9 +138,7 @@ INSTALL(TARGETS campvis-application-lib DESTINATION exports EXPORT campvis-targe ...@@ -144,9 +138,7 @@ INSTALL(TARGETS campvis-application-lib DESTINATION exports EXPORT campvis-targe
ADD_EXECUTABLE(campvis-application "campvis.cpp") ADD_EXECUTABLE(campvis-application "campvis.cpp")
TARGET_LINK_LIBRARIES(campvis-application campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES}) TARGET_LINK_LIBRARIES(campvis-application campvis-application-lib ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} Qt5::Widgets Qt5::OpenGL)
IF(CAMPVIS_DEPLOY_SHADERS) IF(CAMPVIS_DEPLOY_SHADERS)
LIST(APPEND CampvisShaderDirectories "application/data") LIST(APPEND CampvisShaderDirectories "application/data")
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "tools/qtjobprocessor.h" #include "tools/qtjobprocessor.h"
#include <QApplication> #include <QApplication>
#include <QThread>
#ifdef CAMPVIS_HAS_SCRIPTING #ifdef CAMPVIS_HAS_SCRIPTING
#include "scripting/glue/luavmstate.h" #include "scripting/glue/luavmstate.h"
...@@ -93,12 +94,11 @@ namespace campvis { ...@@ -93,12 +94,11 @@ namespace campvis {
#endif #endif
} }
_localContext = new QtThreadedCanvas("", cgt::ivec2(16, 16)); _localContext = new cgt::QtThreadedCanvas("", cgt::ivec2(16, 16));
campvis::init(_localContext, searchPaths); campvis::init(_localContext, searchPaths);
_mainWindow = new MainWindow(this); _mainWindow = new MainWindow(this);
cgt::GLContextScopedLock lock(_localContext); GLJobProc.enqueueJobBlocking([&]() {
{
_mainWindow->init(); _mainWindow->init();
// load textureData from file // load textureData from file
...@@ -133,7 +133,7 @@ namespace campvis { ...@@ -133,7 +133,7 @@ namespace campvis {
if (! _luaVmState->injectGlobalObjectPointer(this, "campvis::CampVisApplication *", "application")) if (! _luaVmState->injectGlobalObjectPointer(this, "campvis::CampVisApplication *", "application"))
LERROR("Could not inject the pipeline into the Lua VM."); LERROR("Could not inject the pipeline into the Lua VM.");
#endif #endif
} });
// parse argument list and create pipelines // parse argument list and create pipelines
QStringList pipelinesToAdd = this->arguments(); QStringList pipelinesToAdd = this->arguments();
...@@ -185,10 +185,7 @@ namespace campvis { ...@@ -185,10 +185,7 @@ namespace campvis {
for (auto it = _workflows.begin(); it != _workflows.end(); ++it) for (auto it = _workflows.begin(); it != _workflows.end(); ++it)
(*it)->deinit(); (*it)->deinit();
{ GLJobProc.enqueueJobBlocking([&]() {
// Deinit everything OpenGL related using the local context.
cgt::GLContextScopedLock lock(_localContext);
delete _errorTexture; delete _errorTexture;
// Deinit pipeline and painter first // Deinit pipeline and painter first
...@@ -197,7 +194,9 @@ namespace campvis { ...@@ -197,7 +194,9 @@ namespace campvis {
} }
_mainWindow->deinit(); _mainWindow->deinit();
} });
delete _mainWindow;
// now delete everything in the right order: // now delete everything in the right order:
for (auto it = _pipelines.begin(); it != _pipelines.end(); ++it) { for (auto it = _pipelines.begin(); it != _pipelines.end(); ++it) {
...@@ -255,7 +254,8 @@ namespace campvis { ...@@ -255,7 +254,8 @@ namespace campvis {
GLCtxtMgr.releaseContext(canvas, false); GLCtxtMgr.releaseContext(canvas, false);
s_PipelinesChanged.emitSignal(); s_PipelinesChanged.emitSignal();
pipeline->start();
startOpenGlThreadAndMoveQtThreadAffinity(pipeline, canvas);
} }
void CampVisApplication::initGlContextAndPipeline(cgt::GLCanvas* canvas, AbstractPipeline* pipeline) { void CampVisApplication::initGlContextAndPipeline(cgt::GLCanvas* canvas, AbstractPipeline* pipeline) {
...@@ -286,7 +286,7 @@ namespace campvis { ...@@ -286,7 +286,7 @@ namespace campvis {
void CampVisApplication::rebuildAllShadersFromFiles() { void CampVisApplication::rebuildAllShadersFromFiles() {
// rebuilding all shaders has to be done from OpenGL context, use the local one. // rebuilding all shaders has to be done from OpenGL context, use the local one.
GLJobProc.enqueueJob(makeJobOnHeap(this, &CampVisApplication::triggerShaderRebuild)); GLJobProc.enqueueJob(cgt::makeJobOnHeap(this, &CampVisApplication::triggerShaderRebuild));
} }
void CampVisApplication::triggerShaderRebuild() { void CampVisApplication::triggerShaderRebuild() {
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
namespace cgt { namespace cgt {
class GLCanvas; class GLCanvas;
class QtCanvas;
class QtThreadedCanvas; class QtThreadedCanvas;
class Texture; class Texture;
} }
...@@ -170,7 +171,7 @@ namespace campvis { ...@@ -170,7 +171,7 @@ namespace campvis {
void triggerShaderRebuild(); void triggerShaderRebuild();
/// A local OpenGL context used for initialization /// A local OpenGL context used for initialization
cgt::GLCanvas* _localContext; cgt::QtCanvas* _localContext;
/// Main window hosting GUI stuff /// Main window hosting GUI stuff
MainWindow* _mainWindow; MainWindow* _mainWindow;
......
...@@ -45,6 +45,9 @@ namespace campvis { ...@@ -45,6 +45,9 @@ namespace campvis {
} }
DataContainerFileLoaderWidget::~DataContainerFileLoaderWidget() { DataContainerFileLoaderWidget::~DataContainerFileLoaderWidget() {
delete _imgReader;
_imgReader = nullptr;
if (_dataContainer != 0) { if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this); _dataContainer->s_dataAdded.disconnect(this);
} }
...@@ -97,14 +100,6 @@ namespace campvis { ...@@ -97,14 +100,6 @@ namespace campvis {
return false; return false;
} }
void DataContainerFileLoaderWidget::init() {
}
void DataContainerFileLoaderWidget::deinit() {
delete _imgReader;
_imgReader = nullptr;
}
void DataContainerFileLoaderWidget::onBtnCancelClicked() { void DataContainerFileLoaderWidget::onBtnCancelClicked() {
delete _imgReader; delete _imgReader;
_imgReader = nullptr; _imgReader = nullptr;
......
...@@ -66,18 +66,7 @@ namespace campvis { ...@@ -66,18 +66,7 @@ namespace campvis {
* \return QSize(300, 350) * \return QSize(300, 350)
*/ */
QSize sizeHint() const; QSize sizeHint() const;
/**
* Initializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
virtual void init();
/**
* Deinitializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
void deinit();
private slots: private slots:
/** /**
......
...@@ -70,7 +70,6 @@ namespace campvis { ...@@ -70,7 +70,6 @@ namespace campvis {
static_cast<Geometry1DTransferFunction*>(p_transferFunction.getTF())->addGeometry(TFGeometry1D::createQuad(cgt::vec2(0.f, 1.f), cgt::col4(0, 0, 0, 255), cgt::col4(255, 255, 255, 255))); static_cast<Geometry1DTransferFunction*>(p_transferFunction.getTF())->addGeometry(TFGeometry1D::createQuad(cgt::vec2(0.f, 1.f), cgt::col4(0, 0, 0, 255), cgt::col4(255, 255, 255, 255)));
GLCtxtMgr.registerContextAndInitGlew(this, "DataContainerInspector"); GLCtxtMgr.registerContextAndInitGlew(this, "DataContainerInspector");
GLCtxtMgr.releaseContext(this, false);
addProperty(p_currentSlice); addProperty(p_currentSlice);
addProperty(p_transferFunction); addProperty(p_transferFunction);
...@@ -103,10 +102,13 @@ namespace campvis { ...@@ -103,10 +102,13 @@ namespace campvis {
p_renderGChannel.setVisible(false); p_renderGChannel.setVisible(false);
p_renderBChannel.setVisible(false); p_renderBChannel.setVisible(false);
p_renderAChannel.setVisible(false); p_renderAChannel.setVisible(false);
connect(this, &DataContainerInspectorCanvas::s_invalidated, this, &DataContainerInspectorCanvas::onInvalidated);
init();
} }
DataContainerInspectorCanvas::~DataContainerInspectorCanvas() { DataContainerInspectorCanvas::~DataContainerInspectorCanvas() {
} }
void DataContainerInspectorCanvas::init() { void DataContainerInspectorCanvas::init() {
...@@ -157,16 +159,17 @@ namespace campvis { ...@@ -157,16 +159,17 @@ namespace campvis {
_geometriesDirty = false; _geometriesDirty = false;
} }
if (_textures.empty()) {
return;
}
glPushAttrib(GL_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS);
glViewport(0, 0, size_.x, size_.y); glViewport(0, 0, size_.x, size_.y);
glClearColor(0.7f, 0.7f, 0.7f, 1.f); glClearColor(0.7f, 0.7f, 0.7f, 1.f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
LGL_ERROR; LGL_ERROR;
if (_textures.empty()) {
glPopAttrib();
return;
}
// update layout dimensions // update layout dimensions
_numTiles.x = ceil(sqrt(static_cast<float>(_textures.size()))); _numTiles.x = ceil(sqrt(static_cast<float>(_textures.size())));
_numTiles.y = ceil(static_cast<float>(_textures.size()) / _numTiles.x); _numTiles.y = ceil(static_cast<float>(_textures.size()) / _numTiles.x);
...@@ -249,16 +252,21 @@ namespace campvis { ...@@ -249,16 +252,21 @@ namespace campvis {
LGL_ERROR; LGL_ERROR;
} }
void DataContainerInspectorCanvas::invalidate() { void DataContainerInspectorCanvas::onInvalidated() {
// only if inited // only if inited
if (_quad != 0 && _paintShader != 0) { if (_quad != 0 && _paintShader != 0 && this->isVisible()) {
this->makeCurrent();
paint();
this->swap();
// avoid recursive paints. // avoid recursive paints.
if (! cgt::GlContextManager::getRef().checkWhetherThisThreadHasAcquiredOpenGlContext()) { // if (! cgt::GlContextManager::getRef().checkWhetherThisThreadHasAcquiredOpenGlContext()) {
SimpleJobProc.enqueueJob([this] () { // SimpleJobProc.enqueueJob(
cgt::GLContextScopedLock lock(this); // [this] () {
paint(); // cgt::GLContextScopedLock lock(this);
}); // paint();
} // });
// }
} }
} }
...@@ -267,11 +275,11 @@ namespace campvis { ...@@ -267,11 +275,11 @@ namespace campvis {
} }
void DataContainerInspectorCanvas::repaint() { void DataContainerInspectorCanvas::repaint() {
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::sizeChanged(const cgt::ivec2& size) { void DataContainerInspectorCanvas::sizeChanged(const cgt::ivec2& size) {
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::mouseMoveEvent(cgt::MouseEvent* e) void DataContainerInspectorCanvas::mouseMoveEvent(cgt::MouseEvent* e)
...@@ -335,7 +343,7 @@ namespace campvis { ...@@ -335,7 +343,7 @@ namespace campvis {
_tcp.process(_localDataContainer); _tcp.process(_localDataContainer);
e->accept(); e->accept();
_geometriesDirty = true; _geometriesDirty = true;
invalidate(); emit s_invalidated();
} }
} }
...@@ -357,7 +365,7 @@ namespace campvis { ...@@ -357,7 +365,7 @@ namespace campvis {
} }
if (_texturesDirty) if (_texturesDirty)
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::setDataHandles(const std::vector< std::pair<QString, QtDataHandle> >& handles) { void DataContainerInspectorCanvas::setDataHandles(const std::vector< std::pair<QString, QtDataHandle> >& handles) {
...@@ -384,7 +392,7 @@ namespace campvis { ...@@ -384,7 +392,7 @@ namespace campvis {
_texturesDirty = true; _texturesDirty = true;
} }
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::updateTextures() { void DataContainerInspectorCanvas::updateTextures() {
...@@ -440,12 +448,12 @@ namespace campvis { ...@@ -440,12 +448,12 @@ namespace campvis {
void DataContainerInspectorCanvas::onPropertyChanged(const AbstractProperty* prop) { void DataContainerInspectorCanvas::onPropertyChanged(const AbstractProperty* prop) {
// ignore properties of the geometry renderer // ignore properties of the geometry renderer
if (prop != &p_geometryRendererProperties) if (prop != &p_geometryRendererProperties)
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::onGeometryRendererPropertyChanged(const AbstractProperty* prop) { void DataContainerInspectorCanvas::onGeometryRendererPropertyChanged(const AbstractProperty* prop) {
_geometriesDirty = true; _geometriesDirty = true;
invalidate(); emit s_invalidated();
} }
void DataContainerInspectorCanvas::renderGeometryIntoTexture(const std::string& name, int textureIndex) { void DataContainerInspectorCanvas::renderGeometryIntoTexture(const std::string& name, int textureIndex) {
......
...@@ -131,6 +131,7 @@ namespace campvis { ...@@ -131,6 +131,7 @@ namespace campvis {
signals: signals:
void s_colorChanged(const cgt::svec3& texel, const cgt::vec4&); void s_colorChanged(const cgt::svec3& texel, const cgt::vec4&);
void s_depthChanged(const cgt::svec3& texel, float depth); void s_depthChanged(const cgt::svec3& texel, float depth);
void s_invalidated(); ///< signals an invalidation event
private slots: private slots:
/** /**
...@@ -140,20 +141,17 @@ namespace campvis { ...@@ -140,20 +141,17 @@ namespace campvis {
*/ */
void onDataContainerChanged(const QString& key, QtDataHandle dh); void onDataContainerChanged(const QString& key, QtDataHandle dh);
/**
* To be called when the canvas is invalidated, issues new paint job.
*/
void onInvalidated();
protected: protected:
/** /**
* Performs the painting. * Performs the painting.
*/ */
virtual void paint(); virtual void paint();
/**
* Gets called when the data collection of this pipeline has changed and thus has notified its observers.
* If \a name equals the name of the renderTarget, the s_renderTargetChanged signal will be emitted.
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
void onDataContainerDataAdded(const std::string& name, DataHandle dh);
/** /**
* Slot getting called when one of the observed properties changed and notifies its observers. * Slot getting called when one of the observed properties changed and notifies its observers.
* \param prop Property that emitted the signal * \param prop Property that emitted the signal
...@@ -172,11 +170,6 @@ namespace campvis { ...@@ -172,11 +170,6 @@ namespace campvis {
*/ */
void resetTrackball(); void resetTrackball();
/**
* To be called when the canvas is invalidated, issues new paint job.
*/
void invalidate();
/** /**
* Renders the given 2D texture. * Renders the given 2D texture.
* Binds the texture to the shader, sets the uniforms and renders the quad. * Binds the texture to the shader, sets the uniforms and renders the quad.
......
...@@ -89,10 +89,6 @@ namespace campvis { ...@@ -89,10 +89,6 @@ namespace campvis {
} }
DataContainerInspectorWidget::~DataContainerInspectorWidget() { DataContainerInspectorWidget::~DataContainerInspectorWidget() {
if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this);
}
delete _pcWidget; delete _pcWidget;
_pcWidget = nullptr; _pcWidget = nullptr;
} }
...@@ -386,28 +382,17 @@ namespace campvis { ...@@ -386,28 +382,17 @@ namespace campvis {
} }
void DataContainerInspectorWidget::init() { void DataContainerInspectorWidget::init() {
if (_canvas != 0)
_canvas->init();
_inited = true; _inited = true;
} }
void DataContainerInspectorWidget::deinit() { void DataContainerInspectorWidget::deinit() {
_inited = false; _canvas->deinit();
if (_canvas != 0)
_canvas->deinit();
_pcWidget->updatePropCollection(0, 0);
if (_dataContainer != 0) { if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this); _dataContainer->s_dataAdded.disconnect(this);
} }
_dataContainer = 0; _inited = false;
_dctWidget->update(0);
if(_propEditorWid != nullptr)
_propEditorWid->deinit();
} }
void DataContainerInspectorWidget::onDCTWidgetSelectionModelSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) { void DataContainerInspectorWidget::onDCTWidgetSelectionModelSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) {
...@@ -532,8 +517,8 @@ namespace campvis { ...@@ -532,8 +517,8 @@ namespace campvis {
void DataContainerInspectorWidget::onBtnLoadFileClicked() { void DataContainerInspectorWidget::onBtnLoadFileClicked() {
// delete previous PropertyEditor, then create a new one // delete previous PropertyEditor, then create a new one
// the final one will be deleted with deinit() // the final one will be deleted with deinit()
if(nullptr != _propEditorWid) if (nullptr != _propEditorWid)
_propEditorWid->deinit(); delete _propEditorWid;
_propEditorWid = new DataContainerFileLoaderWidget(this, nullptr); _propEditorWid = new DataContainerFileLoaderWidget(this, nullptr);
_propEditorWid->setVisible(true); _propEditorWid->setVisible(true);
......
...@@ -435,8 +435,6 @@ namespace campvis { ...@@ -435,8 +435,6 @@ namespace campvis {
} }
void MainWindow::onBtnProcessorFactoryClicked() { void MainWindow::onBtnProcessorFactoryClicked() {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
std::string name = this->_cbProcessorFactory->currentText().toStdString(); std::string name = this->_cbProcessorFactory->currentText().toStdString();
if (_selectedPipeline == nullptr) if (_selectedPipeline == nullptr)
return; return;
...@@ -447,9 +445,11 @@ namespace campvis { ...@@ -447,9 +445,11 @@ namespace campvis {
if (p == nullptr) if (p == nullptr)
return; return;
p->init(); GLJobProc.enqueueJobBlocking([&]() {
_selectedPipeline->addProcessor(p); p->init();
});
_selectedPipeline->addProcessor(p);
emit updatePipelineWidget(_application->_dataContainers, _application->_pipelines); emit updatePipelineWidget(_application->_dataContainers, _application->_pipelines);
} }
...@@ -460,8 +460,9 @@ namespace campvis { ...@@ -460,8 +460,9 @@ namespace campvis {
void MainWindow::onLuaCommandExecuted(const QString& cmd) { void MainWindow::onLuaCommandExecuted(const QString& cmd) {
#ifdef CAMPVIS_HAS_SCRIPTING #ifdef CAMPVIS_HAS_SCRIPTING
if (_application->getLuaVmState() != nullptr) { if (_application->getLuaVmState() != nullptr) {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard; GLJobProc.enqueueJobBlocking([&]() {
_application->getLuaVmState()->execString(cmd.toStdString()); _application->getLuaVmState()->execString(cmd.toStdString());
});
_application->getLuaVmState()->getGlobalTable()->updateValueMap(); _application->getLuaVmState()->getGlobalTable()->updateValueMap();
_scriptingConsoleWidget->_editCommand->setCompleter(new LuaCompleter(_application->getLuaVmState(), _scriptingConsoleWidget->_editCommand));