Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
293e9d4f
Commit
293e9d4f
authored
Aug 06, 2021
by
Julius Künzel
Browse files
Add monitor scene for frei0r.alphaspot
parent
9b379288
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/assets/CMakeLists.txt
View file @
293e9d4f
...
...
@@ -9,6 +9,7 @@ set(kdenlive_SRCS
assets/keyframes/model/keyframemonitorhelper.cpp
assets/keyframes/model/rotoscoping/rotohelper.cpp
assets/keyframes/model/corners/cornershelper.cpp
assets/keyframes/model/rect/recthelper.cpp
assets/keyframes/model/keyframemodel.cpp
assets/keyframes/model/keyframemodellist.cpp
assets/keyframes/view/keyframeview.cpp
...
...
src/assets/keyframes/model/keyframemonitorhelper.hpp
View file @
293e9d4f
...
...
@@ -50,7 +50,7 @@ public:
/** @brief Send signals to the monitor to update the qml overlay.
@param returns : true if the monitor's connection was changed to active.
*/
bool
connectMonitor
(
bool
activate
);
virtual
bool
connectMonitor
(
bool
activate
);
/** @brief Send data update to the monitor
*/
virtual
void
refreshParams
(
int
pos
);
...
...
src/assets/keyframes/model/rect/recthelper.cpp
0 → 100644
View file @
293e9d4f
/*
Copyright (C) 2021 Julius Künzel <jk.kdedev@smartlab.uber.space>
This file is part of Kdenlive. See www.kdenlive.org.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "recthelper.hpp"
#include "assets/keyframes/model/keyframemodellist.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "core.h"
#include "gentime.h"
#include "monitor/monitor.h"
#include <QSize>
#include <utility>
RectHelper
::
RectHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
)
:
KeyframeMonitorHelper
(
monitor
,
std
::
move
(
model
),
std
::
move
(
index
),
parent
)
{
}
bool
RectHelper
::
connectMonitor
(
bool
activate
)
{
if
(
activate
==
m_active
)
{
return
true
;
}
m_active
=
activate
;
if
(
activate
)
{
connect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
RectHelper
::
slotUpdateFromMonitorRect
,
Qt
::
UniqueConnection
);
}
else
{
m_monitor
->
setEffectKeyframe
(
false
);
disconnect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
RectHelper
::
slotUpdateFromMonitorRect
);
}
return
m_active
;
}
void
RectHelper
::
slotUpdateFromMonitorRect
(
const
QRect
&
rect
)
{
QSize
frameSize
=
pCore
->
getCurrentFrameSize
();
double
x
=
double
(
rect
.
x
()
+
rect
.
width
()
/
2
)
/
frameSize
.
width
();
double
y
=
double
(
rect
.
y
()
+
rect
.
height
()
/
2
)
/
frameSize
.
height
();
double
w
=
double
(
rect
.
width
())
/
frameSize
.
width
()
*
0.5
;
double
h
=
double
(
rect
.
height
())
/
frameSize
.
height
()
*
0.5
;
emit
updateKeyframeData
(
m_indexes
.
at
(
0
),
x
);
emit
updateKeyframeData
(
m_indexes
.
at
(
1
),
y
);
emit
updateKeyframeData
(
m_indexes
.
at
(
2
),
w
);
emit
updateKeyframeData
(
m_indexes
.
at
(
3
),
h
);
}
void
RectHelper
::
refreshParams
(
int
pos
)
{
QVariantList
points
{
QPointF
(),
QPointF
(),
QPointF
(),
QPointF
()};
int
x
=
0
,
y
=
0
,
w
=
500
,
h
=
500
;
QSize
frameSize
=
pCore
->
getCurrentFrameSize
();
for
(
const
auto
&
ix
:
qAsConst
(
m_indexes
))
{
auto
type
=
m_model
->
data
(
ix
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
!=
ParamType
::
KeyframeParam
)
{
continue
;
}
QString
paramName
=
m_model
->
data
(
ix
,
AssetParameterModel
::
NameRole
).
toString
();
double
value
=
m_model
->
getKeyframeModel
()
->
getInterpolatedValue
(
pos
,
ix
).
toDouble
();
if
(
paramName
.
contains
(
QLatin1String
(
"Position X"
)))
{
x
=
frameSize
.
width
()
*
value
;
}
else
if
(
paramName
.
contains
(
QLatin1String
(
"Position Y"
)))
{
y
=
frameSize
.
height
()
*
value
;
}
else
if
(
paramName
.
contains
(
QLatin1String
(
"Size X"
)))
{
w
=
frameSize
.
width
()
*
value
*
2
;
}
else
if
(
paramName
.
contains
(
QLatin1String
(
"Size Y"
)))
{
h
=
frameSize
.
height
()
*
value
*
2
;
}
}
if
(
m_monitor
)
{
qDebug
()
<<
QRect
(
x
,
y
,
w
,
h
);
m_monitor
->
setUpEffectGeometry
(
QRect
(
x
-
w
/
2
,
y
-
h
/
2
,
w
,
h
));
}
}
src/assets/keyframes/model/rect/recthelper.hpp
0 → 100644
View file @
293e9d4f
/*
Copyright (C) 2018 Jean-Baptiste Mardelle <jb@kdenlive.org>
This file is part of Kdenlive. See www.kdenlive.org.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RECTHELPER_H
#define RECTHELPER_H
#include "assets/keyframes/model/keyframemonitorhelper.hpp"
#include <QObject>
#include <QPersistentModelIndex>
#include <QVariant>
#include <memory>
class
Monitor
;
class
AssetParameterModel
;
class
RectHelper
:
public
KeyframeMonitorHelper
{
Q_OBJECT
public:
/** @brief Construct a keyframe list bound to the given effect
@param init_value is the value taken by the param at time 0.
@param model is the asset this parameter belong to
@param index is the index of this parameter in its model
*/
explicit
RectHelper
(
Monitor
*
monitor
,
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QPersistentModelIndex
index
,
QObject
*
parent
=
nullptr
);
/** @brief Send data update to the monitor
*/
/** @brief Send signals to the monitor to update the qml overlay.
@param returns : true if the monitor's connection was changed to active.
*/
bool
connectMonitor
(
bool
activate
);
/** @brief Send data update to the monitor
*/
void
refreshParams
(
int
pos
);
private
slots
:
void
slotUpdateFromMonitorRect
(
const
QRect
&
rect
);
};
#endif
src/assets/view/widgets/keyframewidget.cpp
View file @
293e9d4f
...
...
@@ -18,6 +18,7 @@
***************************************************************************/
#include "keyframewidget.hpp"
#include "assets/keyframes/model/rect/recthelper.hpp"
#include "assets/keyframes/model/corners/cornershelper.hpp"
#include "assets/keyframes/model/keyframemodellist.hpp"
#include "assets/keyframes/model/rotoscoping/rotohelper.hpp"
...
...
@@ -539,6 +540,21 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
}
}
}
if
(
m_model
->
getAssetId
().
contains
(
QLatin1String
(
"frei0r.alphaspot"
)))
{
if
(
m_neededScene
==
MonitorSceneDefault
&&
!
m_monitorHelper
)
{
m_neededScene
=
MonitorSceneType
::
MonitorSceneGeometry
;
m_monitorHelper
=
new
RectHelper
(
pCore
->
getMonitor
(
m_model
->
monitorId
),
m_model
,
index
,
this
);
connect
(
this
,
&
KeyframeWidget
::
addIndex
,
m_monitorHelper
,
&
RectHelper
::
addIndex
);
}
else
{
if
(
type
==
ParamType
::
KeyframeParam
)
{
QString
paramName
=
m_model
->
data
(
index
,
AssetParameterModel
::
NameRole
).
toString
();
if
(
paramName
.
contains
(
QLatin1String
(
"Position X"
))
||
paramName
.
contains
(
QLatin1String
(
"Position Y"
))
||
paramName
.
contains
(
QLatin1String
(
"Size X"
))
||
paramName
.
contains
(
QLatin1String
(
"Size Y"
)))
{
emit
addIndex
(
index
);
}
}
}
}
double
value
=
m_keyframes
->
getInterpolatedValue
(
getPosition
(),
index
).
toDouble
();
double
min
=
m_model
->
data
(
index
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
m_model
->
data
(
index
,
AssetParameterModel
::
MaxRole
).
toDouble
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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