Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 50b028b6 authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

added processor button. some sig-slot connections are probably still missing

parent a73d8f06
...@@ -97,30 +97,40 @@ namespace campvis { ...@@ -97,30 +97,40 @@ namespace campvis {
_containerWidget = new QWidget(this); _containerWidget = new QWidget(this);
QGridLayout* _cwLayout = new QGridLayout(_containerWidget); QGridLayout* _cwLayout = new QGridLayout(_containerWidget);
int rowPosition = 0;
_cbPipelineFactory = new QComboBox(_containerWidget); _cbPipelineFactory = new QComboBox(_containerWidget);
std::vector<std::string> registeredPipelines = PipelineFactory::getRef().getRegisteredPipelines(); std::vector<std::string> registeredPipelines = PipelineFactory::getRef().getRegisteredPipelines();
for (std::vector<std::string>::const_iterator it = registeredPipelines.begin(); it != registeredPipelines.end(); ++it) for (std::vector<std::string>::const_iterator it = registeredPipelines.begin(); it != registeredPipelines.end(); ++it)
_cbPipelineFactory->addItem(QString::fromStdString(*it)); _cbPipelineFactory->addItem(QString::fromStdString(*it));
_cwLayout->addWidget(_cbPipelineFactory, 0, 0); _cwLayout->addWidget(_cbPipelineFactory, rowPosition, 0);
_btnPipelineFactory = new QPushButton("Add Pipeline", _containerWidget); _btnPipelineFactory = new QPushButton("Add Pipeline", _containerWidget);
_cwLayout->addWidget(_btnPipelineFactory, 0, 1); _cwLayout->addWidget(_btnPipelineFactory, rowPosition++, 1);
_pipelineWidget = new PipelineTreeWidget(this); _pipelineWidget = new PipelineTreeWidget(this);
_containerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); _containerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
_cwLayout->addWidget(_pipelineWidget, 1, 0, 1, 2); _cwLayout->addWidget(_pipelineWidget, rowPosition++, 0, 1, 2);
_btnExecute = new QPushButton("Execute Selected Pipeline/Processor", _containerWidget); _btnExecute = new QPushButton("Execute Selected Pipeline/Processor", _containerWidget);
_cwLayout->addWidget(_btnExecute, 2, 0, 1, 2); _cwLayout->addWidget(_btnExecute, rowPosition++, 0, 1, 2);
_cbProcessorFactory = new QComboBox(_containerWidget);
std::vector<std::string> registeredProcessors = ProcessorFactory::getRef().getRegisteredProcessors();
for (std::vector<std::string>::const_iterator it = registeredProcessors.begin(); it != registeredProcessors.end(); ++it)
_cbProcessorFactory->addItem(QString::fromStdString(*it));
_cwLayout->addWidget(_cbProcessorFactory, rowPosition, 0);
_btnProcessorFactory = new QPushButton("Add Processor", _containerWidget);
_cwLayout->addWidget(_btnProcessorFactory, rowPosition++, 1);
_btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline", _containerWidget); _btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline", _containerWidget);
_cwLayout->addWidget(_btnShowDataContainerInspector, 3, 0, 1, 2); _cwLayout->addWidget(_btnShowDataContainerInspector, rowPosition++, 0, 1, 2);
#ifdef CAMPVIS_HAS_SCRIPTING #ifdef CAMPVIS_HAS_SCRIPTING
_btnLuaLoad = new QPushButton("Load Script", _containerWidget); _btnLuaLoad = new QPushButton("Load Script", _containerWidget);
_cwLayout->addWidget(_btnLuaLoad, 4, 0, 1, 2); _cwLayout->addWidget(_btnLuaLoad, rowPosition++, 0, 1, 2);
_btnLuaSave = new QPushButton("Save Script", _containerWidget); _btnLuaSave = new QPushButton("Save Script", _containerWidget);
_cwLayout->addWidget(_btnLuaSave, 5, 0, 1, 2); _cwLayout->addWidget(_btnLuaSave, rowPosition++, 0, 1, 2);
connect( connect(
_btnLuaLoad, SIGNAL(clicked()), _btnLuaLoad, SIGNAL(clicked()),
this, SLOT(onBtnLuaLoadClicked())); this, SLOT(onBtnLuaLoadClicked()));
...@@ -190,6 +200,9 @@ namespace campvis { ...@@ -190,6 +200,9 @@ namespace campvis {
connect( connect(
_btnPipelineFactory, SIGNAL(clicked()), _btnPipelineFactory, SIGNAL(clicked()),
this, SLOT(onBtnPipelineFactoryClicked())); this, SLOT(onBtnPipelineFactoryClicked()));
connect(
_btnProcessorFactory, SIGNAL(clicked()),
this, SLOT(onBtnProcessorFactoryClicked()));
_application->s_PipelinesChanged.connect(this, &MainWindow::onPipelinesChanged); _application->s_PipelinesChanged.connect(this, &MainWindow::onPipelinesChanged);
_application->s_DataContainersChanged.connect(this, &MainWindow::onDataContainersChanged); _application->s_DataContainersChanged.connect(this, &MainWindow::onDataContainersChanged);
...@@ -235,7 +248,7 @@ namespace campvis { ...@@ -235,7 +248,7 @@ namespace campvis {
void MainWindow::onDataContainersChanged() { void MainWindow::onDataContainersChanged() {
std::vector<AbstractPipeline*> pipelines; std::vector<AbstractPipeline*> pipelines;
std::for_each(_application->_pipelines.begin(), _application->_pipelines.end(), [&] (const CampVisApplication::PipelineRecord& pr) { pipelines.push_back(pr._pipeline); }); std::for_each(_application->_pipelines.begin(), _application->_pipelines.end(), [&] (const CampVisApplication::PipelineRecord& pr) { pipelines.push_back(pr._pipeline); });
emit updatePipelineWidget(_application->_dataContainers, pipelines); emit updatePipelineWidget(_application->_dataContainers, pipelines);
} }
...@@ -410,6 +423,32 @@ namespace campvis { ...@@ -410,6 +423,32 @@ namespace campvis {
_application->addPipeline(name, p); _application->addPipeline(name, p);
} }
void MainWindow::onBtnProcessorFactoryClicked() {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
std::string name = this->_cbProcessorFactory->currentText().toStdString();
DataContainer* dc = _selectedDataContainer;
if (_selectedPipeline == nullptr)
return;
AbstractProcessor* selectedProcessor = _selectedProcessor;
if (selectedProcessor == nullptr) {
selectedProcessor = _selectedPipeline->getProcessors().at(0);
if (selectedProcessor == nullptr)
return;
}
AbstractProcessor* p = ProcessorFactory::getRef().createProcessor(name);
p->init();
_selectedPipeline->addProcessor(p);
std::vector<AbstractPipeline*> pipelines;
std::for_each(_application->_pipelines.begin(), _application->_pipelines.end(), [&] (const CampVisApplication::PipelineRecord& pr) { pipelines.push_back(pr._pipeline); });
//_pipelineWidget->update(_application->_dataContainers, pipelines);
emit updatePipelineWidget(_application->_dataContainers, pipelines);
}
void MainWindow::onRebuildShadersClicked() { void MainWindow::onRebuildShadersClicked() {
_application->rebuildAllShadersFromFiles(); _application->rebuildAllShadersFromFiles();
} }
......
...@@ -144,6 +144,9 @@ namespace campvis { ...@@ -144,6 +144,9 @@ namespace campvis {
/// Slot to be called when _btnPipelineFactory was clicked; /// Slot to be called when _btnPipelineFactory was clicked;
void onBtnPipelineFactoryClicked(); void onBtnPipelineFactoryClicked();
/// Slot to be called when _btnProcessorFactory was clicked;
void onBtnProcessorFactoryClicked();
/// Slot to be called when all shaders shall be rebuilt. /// Slot to be called when all shaders shall be rebuilt.
void onRebuildShadersClicked(); void onRebuildShadersClicked();
...@@ -209,6 +212,9 @@ namespace campvis { ...@@ -209,6 +212,9 @@ namespace campvis {
LogViewerWidget* _logViewer; ///< Widget displaying log messages LogViewerWidget* _logViewer; ///< Widget displaying log messages
ScriptingWidget* _scriptingConsoleWidget; ///< Widget showing the scripting console (if available) ScriptingWidget* _scriptingConsoleWidget; ///< Widget showing the scripting console (if available)
WorkflowControllerWidget* _workflowWidget; ///< Widget showing the workflow controller WorkflowControllerWidget* _workflowWidget; ///< Widget showing the workflow controller
QComboBox* _cbProcessorFactory; ///< Combobox for selecting the Processor from the ProcessorFactory
QPushButton* _btnProcessorFactory; ///< Button to add a Processor from the factory to the selected Pipeline
QPushButton* _btnLuaLoad; QPushButton* _btnLuaLoad;
QPushButton* _btnLuaSave; QPushButton* _btnLuaSave;
......
...@@ -64,19 +64,31 @@ namespace campvis { ...@@ -64,19 +64,31 @@ namespace campvis {
AbstractProcessor* ProcessorFactory::createProcessor(const std::string& id, IVec2Property* viewPortSizeProp) const { AbstractProcessor* ProcessorFactory::createProcessor(const std::string& id, IVec2Property* viewPortSizeProp) const {
tbb::spin_mutex::scoped_lock lock(_mutex); tbb::spin_mutex::scoped_lock lock(_mutex);
if (viewPortSizeProp != nullptr) { auto it = _processorMapWithIVec2Param.find(id);
auto it = _processorMapWithIVec2Param.find(id); if (it != _processorMapWithIVec2Param.end()) {
if (it == _processorMapWithIVec2Param.end()) if (viewPortSizeProp != nullptr)
return nullptr;
else
return (it->second)(viewPortSizeProp); return (it->second)(viewPortSizeProp);
} else { IVec2Property* viewport = new IVec2Property("ViewportSize", "Viewport Size", cgt::ivec2(200), cgt::ivec2(0, 0), cgt::ivec2(10000));
auto it = _processorMapDefault.find(id);
if (it == _processorMapDefault.end()) return (it->second)(viewport);
return nullptr;
else
return (it->second)();
} }
auto pos = _processorMapDefault.find(id);
if (pos != _processorMapDefault.end())
return (pos->second)();
return nullptr;
//if (viewPortSizeProp != nullptr) {
// return nullptr;
// else
//} else {
// auto it = _processorMapDefault.find(id);
// if (it == _processorMapDefault.end())
// return nullptr;
// return (it->second)();
//}
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment