Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libRendering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STORM
repos
Radium
libRendering
Commits
867236c3
Commit
867236c3
authored
4 years ago
by
Mathias Paulin
Browse files
Options
Downloads
Patches
Plain Diff
Add timeline - still incomplete
parent
e9b3a021
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Mara/Gui/MainWindow.cpp
+97
-2
97 additions, 2 deletions
src/Mara/Gui/MainWindow.cpp
src/Mara/Gui/MainWindow.hpp
+23
-0
23 additions, 0 deletions
src/Mara/Gui/MainWindow.hpp
with
120 additions
and
2 deletions
src/Mara/Gui/MainWindow.cpp
+
97
−
2
View file @
867236c3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<QToolBar>
#include
<QToolBar>
#include
<Gui/SelectionManager/SelectionManager.hpp>
#include
<Gui/SelectionManager/SelectionManager.hpp>
#include
<Gui/Timeline/Timeline.hpp>
#include
<Gui/Viewer/CameraManipulator.hpp>
#include
<Gui/Viewer/CameraManipulator.hpp>
#include
<Gui/Viewer/Gizmo/GizmoManager.hpp>
#include
<Gui/Viewer/Gizmo/GizmoManager.hpp>
#include
<Gui/Viewer/Viewer.hpp>
#include
<Gui/Viewer/Viewer.hpp>
...
@@ -75,6 +76,52 @@ void MainWindow::cleanup() {
...
@@ -75,6 +76,52 @@ void MainWindow::cleanup() {
m_viewer
.
reset
(
nullptr
);
m_viewer
.
reset
(
nullptr
);
}
}
void
MainWindow
::
addTimelineToolBar
()
{
auto
timelineToolbar
=
new
QToolBar
(
"Timeline"
,
this
);
timelineToolbar
->
setAllowedAreas
(
Qt
::
BottomToolBarArea
);
timelineToolbar
->
setVisible
(
false
);
// Add and connect timeline
m_timeline
=
new
Ra
::
Gui
::
Timeline
(
this
);
m_timeline
->
onChangeEnd
(
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
getEndTime
()
);
// Timeline setup
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
playClicked
,
this
,
&
MainWindow
::
timelinePlay
);
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
cursorChanged
,
this
,
&
MainWindow
::
timelineGoTo
);
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
startChanged
,
this
,
&
MainWindow
::
timelineStartChanged
);
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
endChanged
,
this
,
&
MainWindow
::
timelineEndChanged
);
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
setPingPong
,
this
,
&
MainWindow
::
timelineSetPingPong
);
connect
(
m_timeline
,
&
Ra
::
Gui
::
Timeline
::
keyFrameChanged
,
[
=
](
Scalar
)
{
emit
frameUpdate
();
}
);
timelineToolbar
->
addWidget
(
m_timeline
);
this
->
addToolBar
(
Qt
::
BottomToolBarArea
,
timelineToolbar
);
auto
showTimelineToolbar
=
new
QAction
(
this
);
showTimelineToolbar
->
setObjectName
(
QString
::
fromUtf8
(
"showTimelineToolbar"
)
);
showTimelineToolbar
->
setCheckable
(
true
);
showTimelineToolbar
->
setChecked
(
false
);
showTimelineToolbar
->
setText
(
QCoreApplication
::
translate
(
"MainWindow"
,
"Timeline toolbar"
,
nullptr
)
);
showTimelineToolbar
->
setToolTip
(
QCoreApplication
::
translate
(
"MainWindow"
,
"Show/hide the timeline toolbar"
,
nullptr
)
);
connect
(
showTimelineToolbar
,
&
QAction
::
triggered
,
timelineToolbar
,
&
QToolBar
::
setVisible
);
connect
(
timelineToolbar
,
&
QToolBar
::
visibilityChanged
,
[
showTimelineToolbar
](
bool
b
)
{
showTimelineToolbar
->
setChecked
(
b
);
}
);
menuToolbars
->
addAction
(
showTimelineToolbar
);
}
void
MainWindow
::
addSelectionToolBar
()
{
void
MainWindow
::
addSelectionToolBar
()
{
auto
selectionToolBar
=
new
QToolBar
(
"Selection toolbar"
,
this
);
auto
selectionToolBar
=
new
QToolBar
(
"Selection toolbar"
,
this
);
...
@@ -175,6 +222,7 @@ void MainWindow::addSelectionToolBar() {
...
@@ -175,6 +222,7 @@ void MainWindow::addSelectionToolBar() {
void
MainWindow
::
postOpenGLInitializations
()
{
void
MainWindow
::
postOpenGLInitializations
()
{
addSelectionToolBar
();
addSelectionToolBar
();
addTimelineToolBar
();
}
}
void
MainWindow
::
createConnections
()
{
void
MainWindow
::
createConnections
()
{
...
@@ -233,7 +281,17 @@ Viewer* MainWindow::getViewer() {
...
@@ -233,7 +281,17 @@ Viewer* MainWindow::getViewer() {
return
m_viewer
.
get
();
return
m_viewer
.
get
();
}
}
void
MainWindow
::
onFrameComplete
()
{}
void
MainWindow
::
onFrameComplete
()
{
// update timeline only if time changed, to allow manipulation of keyframed objects
auto
engine
=
Ra
::
Engine
::
RadiumEngine
::
getInstance
();
if
(
!
Ra
::
Core
::
Math
::
areApproxEqual
(
m_timeline
->
getTime
(),
engine
->
getTime
()
)
)
{
m_lockTimeSystem
=
true
;
m_timeline
->
onChangeCursor
(
engine
->
getTime
()
);
m_lockTimeSystem
=
false
;
}
}
void
MainWindow
::
activateCamera
(
const
std
::
string
&
sceneName
)
{
void
MainWindow
::
activateCamera
(
const
std
::
string
&
sceneName
)
{
// If a camera is in the given scene, use it, else, use default
// If a camera is in the given scene, use it, else, use default
...
@@ -365,7 +423,7 @@ Ra::Gui::SelectionManager* MainWindow::getSelectionManager() {
...
@@ -365,7 +423,7 @@ Ra::Gui::SelectionManager* MainWindow::getSelectionManager() {
Ra
::
Gui
::
Timeline
*
MainWindow
::
getTimeline
()
{
Ra
::
Gui
::
Timeline
*
MainWindow
::
getTimeline
()
{
// mus return not null ?
// mus return not null ?
return
nullptr
;
return
m_timeline
;
}
}
void
MainWindow
::
ItemAdded
(
const
ItemEntry
&
ent
)
{
void
MainWindow
::
ItemAdded
(
const
ItemEntry
&
ent
)
{
...
@@ -438,4 +496,41 @@ void MainWindow::onSelectionChanged( const QItemSelection& /*selected*/,
...
@@ -438,4 +496,41 @@ void MainWindow::onSelectionChanged( const QItemSelection& /*selected*/,
{
emit
selectedItem
(
ItemEntry
()
);
}
{
emit
selectedItem
(
ItemEntry
()
);
}
}
}
void
MainWindow
::
timelinePlay
(
bool
play
)
{
actionPlay
->
setChecked
(
play
);
if
(
!
m_lockTimeSystem
)
{
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
play
(
play
);
// mainApp->setContinuousUpdate( play );
}
}
void
MainWindow
::
timelineGoTo
(
double
t
)
{
if
(
!
m_lockTimeSystem
)
{
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
setTime
(
Scalar
(
t
)
);
emit
frameUpdate
();
}
}
void
MainWindow
::
timelineStartChanged
(
double
t
)
{
if
(
!
m_lockTimeSystem
)
{
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
setStartTime
(
Scalar
(
t
)
);
emit
frameUpdate
();
}
}
void
MainWindow
::
timelineEndChanged
(
double
t
)
{
if
(
!
m_lockTimeSystem
)
{
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
setEndTime
(
Scalar
(
t
)
);
emit
frameUpdate
();
}
}
void
MainWindow
::
timelineSetPingPong
(
bool
status
)
{
if
(
!
m_lockTimeSystem
)
{
Ra
::
Engine
::
RadiumEngine
::
getInstance
()
->
setForwardBackward
(
status
);
emit
frameUpdate
();
}
}
}
// namespace Mara
}
// namespace Mara
This diff is collapsed.
Click to expand it.
src/Mara/Gui/MainWindow.hpp
+
23
−
0
View file @
867236c3
...
@@ -154,10 +154,30 @@ class MainWindow : public Ra::Gui::MainWindowInterface, private Ui::MainWindow
...
@@ -154,10 +154,30 @@ class MainWindow : public Ra::Gui::MainWindowInterface, private Ui::MainWindow
/// Slot to init renderers once gl is ready
/// Slot to init renderers once gl is ready
void
postOpenGLInitializations
();
void
postOpenGLInitializations
();
/// Slot for the user requesting to play/pause time through the timeline.
void
timelinePlay
(
bool
play
);
/// Slot for the user requesting to change the current time through the timeline.
void
timelineGoTo
(
double
t
);
/// Slot for the user requesting to change the start time through the timeline.
void
timelineStartChanged
(
double
t
);
/// Slot for the user requesting to change the end time through the timeline.
void
timelineEndChanged
(
double
t
);
/// Slot for the user requesting to change the time play mode through the timeline.
void
timelineSetPingPong
(
bool
status
);
private:
private:
/// add the selection toolbar
/// add the selection toolbar
void
addSelectionToolBar
();
void
addSelectionToolBar
();
/// add the selection toolbar
void
addTimelineToolBar
();
bool
m_lockTimeSystem
{
false
};
/// create the UI connections
/// create the UI connections
void
createConnections
();
void
createConnections
();
...
@@ -181,6 +201,9 @@ class MainWindow : public Ra::Gui::MainWindowInterface, private Ui::MainWindow
...
@@ -181,6 +201,9 @@ class MainWindow : public Ra::Gui::MainWindowInterface, private Ui::MainWindow
/// Stores the internal model of engine objects for selection and visibility.
/// Stores the internal model of engine objects for selection and visibility.
Ra
::
Gui
::
ItemModel
*
m_sceneModel
;
Ra
::
Gui
::
ItemModel
*
m_sceneModel
;
/// Timeline gui
Ra
::
Gui
::
Timeline
*
m_timeline
{
nullptr
};
#ifdef SHOWTREEVIEW
#ifdef SHOWTREEVIEW
/// QTreeview of the scene
/// QTreeview of the scene
QTreeView
*
m_sceneTreeView
;
QTreeView
*
m_sceneTreeView
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment