Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
50b028b6
Commit
50b028b6
authored
Mar 12, 2015
by
Hossain Mahmud
Browse files
added processor button. some sig-slot connections are probably still missing
parent
a73d8f06
Changes
3
Hide whitespace changes
Inline
Side-by-side
application/gui/mainwindow.cpp
View file @
50b028b6
...
...
@@ -97,30 +97,40 @@ namespace campvis {
_containerWidget
=
new
QWidget
(
this
);
QGridLayout
*
_cwLayout
=
new
QGridLayout
(
_containerWidget
);
int
rowPosition
=
0
;
_cbPipelineFactory
=
new
QComboBox
(
_containerWidget
);
std
::
vector
<
std
::
string
>
registeredPipelines
=
PipelineFactory
::
getRef
().
getRegisteredPipelines
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
registeredPipelines
.
begin
();
it
!=
registeredPipelines
.
end
();
++
it
)
_cbPipelineFactory
->
addItem
(
QString
::
fromStdString
(
*
it
));
_cwLayout
->
addWidget
(
_cbPipelineFactory
,
0
,
0
);
_cwLayout
->
addWidget
(
_cbPipelineFactory
,
rowPosition
,
0
);
_btnPipelineFactory
=
new
QPushButton
(
"Add Pipeline"
,
_containerWidget
);
_cwLayout
->
addWidget
(
_btnPipelineFactory
,
0
,
1
);
_cwLayout
->
addWidget
(
_btnPipelineFactory
,
rowPosition
++
,
1
);
_pipelineWidget
=
new
PipelineTreeWidget
(
this
);
_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
);
_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
);
_cwLayout
->
addWidget
(
_btnShowDataContainerInspector
,
3
,
0
,
1
,
2
);
_cwLayout
->
addWidget
(
_btnShowDataContainerInspector
,
rowPosition
++
,
0
,
1
,
2
);
#ifdef CAMPVIS_HAS_SCRIPTING
_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
);
_cwLayout
->
addWidget
(
_btnLuaSave
,
5
,
0
,
1
,
2
);
_cwLayout
->
addWidget
(
_btnLuaSave
,
rowPosition
++
,
0
,
1
,
2
);
connect
(
_btnLuaLoad
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnLuaLoadClicked
()));
...
...
@@ -190,6 +200,9 @@ namespace campvis {
connect
(
_btnPipelineFactory
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnPipelineFactoryClicked
()));
connect
(
_btnProcessorFactory
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onBtnProcessorFactoryClicked
()));
_application
->
s_PipelinesChanged
.
connect
(
this
,
&
MainWindow
::
onPipelinesChanged
);
_application
->
s_DataContainersChanged
.
connect
(
this
,
&
MainWindow
::
onDataContainersChanged
);
...
...
@@ -235,7 +248,7 @@ namespace campvis {
void
MainWindow
::
onDataContainersChanged
()
{
std
::
vector
<
AbstractPipeline
*>
pipelines
;
std
::
for_each
(
_application
->
_pipelines
.
begin
(),
_application
->
_pipelines
.
end
(),
[
&
]
(
const
CampVisApplication
::
PipelineRecord
&
pr
)
{
pipelines
.
push_back
(
pr
.
_pipeline
);
});
emit
updatePipelineWidget
(
_application
->
_dataContainers
,
pipelines
);
}
...
...
@@ -410,6 +423,32 @@ namespace campvis {
_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
()
{
_application
->
rebuildAllShadersFromFiles
();
}
...
...
application/gui/mainwindow.h
View file @
50b028b6
...
...
@@ -144,6 +144,9 @@ namespace campvis {
/// Slot to be called when _btnPipelineFactory was clicked;
void
onBtnPipelineFactoryClicked
();
/// Slot to be called when _btnProcessorFactory was clicked;
void
onBtnProcessorFactoryClicked
();
/// Slot to be called when all shaders shall be rebuilt.
void
onRebuildShadersClicked
();
...
...
@@ -209,6 +212,9 @@ namespace campvis {
LogViewerWidget
*
_logViewer
;
///< Widget displaying log messages
ScriptingWidget
*
_scriptingConsoleWidget
;
///< Widget showing the scripting console (if available)
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
*
_btnLuaSave
;
...
...
modules/processorfactory.cpp
View file @
50b028b6
...
...
@@ -64,19 +64,31 @@ namespace campvis {
AbstractProcessor
*
ProcessorFactory
::
createProcessor
(
const
std
::
string
&
id
,
IVec2Property
*
viewPortSizeProp
)
const
{
tbb
::
spin_mutex
::
scoped_lock
lock
(
_mutex
);
if
(
viewPortSizeProp
!=
nullptr
)
{
auto
it
=
_processorMapWithIVec2Param
.
find
(
id
);
if
(
it
==
_processorMapWithIVec2Param
.
end
())
return
nullptr
;
else
auto
it
=
_processorMapWithIVec2Param
.
find
(
id
);
if
(
it
!=
_processorMapWithIVec2Param
.
end
())
{
if
(
viewPortSizeProp
!=
nullptr
)
return
(
it
->
second
)(
viewPortSizeProp
);
}
else
{
auto
it
=
_processorMapDefault
.
find
(
id
);
if
(
it
==
_processorMapDefault
.
end
())
return
nullptr
;
else
return
(
it
->
second
)();
IVec2Property
*
viewport
=
new
IVec2Property
(
"ViewportSize"
,
"Viewport Size"
,
cgt
::
ivec2
(
200
),
cgt
::
ivec2
(
0
,
0
),
cgt
::
ivec2
(
10000
));
return
(
it
->
second
)(
viewport
);
}
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)();
//}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment