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
136ad569
Commit
136ad569
authored
Nov 03, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix on monitor mess and possible crash with several transform effects
parent
15045192
Pipeline
#39387
passed with stage
in 24 minutes and 35 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/assets/keyframes/model/keyframemodellist.cpp
View file @
136ad569
...
...
@@ -49,6 +49,22 @@ ObjectId KeyframeModelList::getOwnerId() const
return
{};
}
const
QString
KeyframeModelList
::
getAssetId
()
{
if
(
auto
ptr
=
m_model
.
lock
())
{
return
ptr
->
getAssetId
();
}
return
{};
}
const
QString
KeyframeModelList
::
getAssetRow
()
{
if
(
auto
ptr
=
m_model
.
lock
())
{
return
ptr
->
getAssetMltId
();
}
return
QString
();
}
void
KeyframeModelList
::
addParameter
(
const
QModelIndex
&
index
)
{
std
::
shared_ptr
<
KeyframeModel
>
parameter
(
new
KeyframeModel
(
m_model
,
index
,
m_undoStack
));
...
...
src/assets/keyframes/model/keyframemodellist.hpp
View file @
136ad569
...
...
@@ -135,6 +135,9 @@ public:
KeyframeModel
*
getKeyModel
(
const
QPersistentModelIndex
&
index
);
/** @brief Returns parent asset owner id*/
ObjectId
getOwnerId
()
const
;
/** @brief Returns parent asset id*/
const
QString
getAssetId
();
const
QString
getAssetRow
();
/** @brief Parent item size change, update keyframes*/
void
resizeKeyframes
(
int
oldIn
,
int
oldOut
,
int
in
,
int
out
,
int
offset
,
bool
adjustFromEnd
,
Fun
&
undo
,
Fun
&
redo
);
...
...
src/assets/keyframes/view/keyframeview.cpp
View file @
136ad569
...
...
@@ -113,6 +113,11 @@ void KeyframeView::slotAddKeyframe(int pos)
m_model
->
addKeyframe
(
GenTime
(
pos
+
offset
,
pCore
->
getCurrentFps
()),
(
KeyframeType
)
KdenliveSettings
::
defaultkeyframeinterp
());
}
const
QString
KeyframeView
::
getAssetId
()
{
return
m_model
->
getAssetId
();
}
void
KeyframeView
::
slotAddRemove
()
{
emit
activateEffect
();
...
...
src/assets/keyframes/view/keyframeview.hpp
View file @
136ad569
...
...
@@ -34,6 +34,7 @@ class KeyframeView : public QWidget
public:
explicit
KeyframeView
(
std
::
shared_ptr
<
KeyframeModelList
>
model
,
int
duration
,
QWidget
*
parent
=
nullptr
);
void
setDuration
(
int
dur
);
const
QString
getAssetId
();
public
slots
:
/* @brief moves the current position*/
...
...
src/assets/model/assetparametermodel.cpp
View file @
136ad569
...
...
@@ -39,6 +39,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
,
monitorId
(
ownerId
.
first
==
ObjectType
::
BinClip
?
Kdenlive
::
ClipMonitor
:
Kdenlive
::
ProjectMonitor
)
,
m_assetId
(
assetId
)
,
m_ownerId
(
ownerId
)
,
m_active
(
false
)
,
m_asset
(
std
::
move
(
asset
))
,
m_keyframes
(
nullptr
)
{
...
...
@@ -711,6 +712,21 @@ QString AssetParameterModel::getAssetId() const
return
m_assetId
;
}
const
QString
AssetParameterModel
::
getAssetMltId
()
{
return
m_asset
->
get
(
"id"
);
}
void
AssetParameterModel
::
setActive
(
bool
active
)
{
m_active
=
active
;
}
bool
AssetParameterModel
::
isActive
()
const
{
return
m_active
;
}
QVector
<
QPair
<
QString
,
QVariant
>>
AssetParameterModel
::
getAllParameters
()
const
{
QVector
<
QPair
<
QString
,
QVariant
>>
res
;
...
...
src/assets/model/assetparametermodel.hpp
View file @
136ad569
...
...
@@ -140,6 +140,9 @@ public:
/* @brief Returns the id of the asset represented by this object */
QString
getAssetId
()
const
;
const
QString
getAssetMltId
();
void
setActive
(
bool
active
);
bool
isActive
()
const
;
/* @brief Set the parameter with given name to the given value
*/
...
...
@@ -220,6 +223,7 @@ protected:
QString
m_assetId
;
ObjectId
m_ownerId
;
bool
m_active
;
std
::
vector
<
QString
>
m_paramOrder
;
// Keep track of parameter order, important for sox
std
::
unordered_map
<
QString
,
ParamRow
>
m_params
;
// Store all parameters by name
std
::
unordered_map
<
QString
,
QVariant
>
m_fixedParams
;
// We store values of fixed parameters aside
...
...
src/assets/view/widgets/keyframewidget.cpp
View file @
136ad569
...
...
@@ -52,7 +52,6 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
,
m_sourceFrameSize
(
frameSize
.
isValid
()
&&
!
frameSize
.
isNull
()
?
frameSize
:
pCore
->
getCurrentFrameSize
())
,
m_baseHeight
(
0
)
,
m_addedHeight
(
0
)
,
m_effectIsSelected
(
false
)
{
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Preferred
);
m_lay
=
new
QVBoxLayout
(
this
);
...
...
@@ -178,10 +177,6 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
m_baseHeight
=
m_keyframeview
->
height
()
+
m_toolbar
->
sizeHint
().
height
()
+
mrg
.
top
()
+
mrg
.
bottom
();
setFixedHeight
(
m_baseHeight
);
addParameter
(
index
);
connect
(
monitor
,
&
Monitor
::
seekToNextKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToNext
,
Qt
::
UniqueConnection
);
connect
(
monitor
,
&
Monitor
::
seekToPreviousKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToPrev
,
Qt
::
UniqueConnection
);
connect
(
monitor
,
&
Monitor
::
addRemoveKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotAddRemove
,
Qt
::
UniqueConnection
);
}
KeyframeWidget
::~
KeyframeWidget
()
...
...
@@ -198,8 +193,8 @@ void KeyframeWidget::monitorSeek(int pos)
int
in
=
pCore
->
getItemPosition
(
m_model
->
getOwnerId
());
int
out
=
in
+
pCore
->
getItemDuration
(
m_model
->
getOwnerId
());
bool
isInRange
=
pos
>=
in
&&
pos
<
out
;
connectMonitor
(
isInRange
&&
m_model
->
isActive
());
m_buttonAddDelete
->
setEnabled
(
isInRange
&&
pos
>
in
);
connectMonitor
(
isInRange
);
int
framePos
=
qBound
(
in
,
pos
,
out
)
-
in
;
if
(
isInRange
&&
framePos
!=
m_time
->
getValue
())
{
slotSetPosition
(
framePos
,
false
);
...
...
@@ -243,7 +238,7 @@ void KeyframeWidget::slotRefreshParams()
((
GeometryWidget
*
)
w
.
second
)
->
setValue
(
rect
,
opacity
);
}
}
if
(
m_monitorHelper
&&
m_
effectIsSelected
)
{
if
(
m_monitorHelper
&&
m_
model
->
isActive
()
)
{
m_monitorHelper
->
refreshParams
(
pos
);
return
;
}
...
...
@@ -359,6 +354,11 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
this
,
[
this
,
index
](
const
QString
v
)
{
emit
activateEffect
();
m_keyframes
->
updateKeyframe
(
GenTime
(
getPosition
(),
pCore
->
getCurrentFps
()),
QVariant
(
v
),
index
);
});
connect
(
geomWidget
,
&
GeometryWidget
::
updateMonitorGeometry
,
[
this
,
index
](
const
QRect
r
)
{
if
(
m_model
->
isActive
())
{
pCore
->
getMonitor
(
m_model
->
monitorId
)
->
setUpEffectGeometry
(
r
);
}
});
paramWidget
=
geomWidget
;
}
else
if
(
type
==
ParamType
::
Roto_spline
)
{
m_monitorHelper
=
new
RotoHelper
(
pCore
->
getMonitor
(
m_model
->
monitorId
),
m_model
,
index
,
this
);
...
...
@@ -407,7 +407,6 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
void
KeyframeWidget
::
slotInitMonitor
(
bool
active
)
{
Monitor
*
monitor
=
pCore
->
getMonitor
(
m_model
->
monitorId
);
m_effectIsSelected
=
active
;
if
(
m_keyframeview
)
{
m_keyframeview
->
initKeyframePos
();
connect
(
monitor
,
&
Monitor
::
updateScene
,
m_keyframeview
,
&
KeyframeView
::
slotModelChanged
,
Qt
::
UniqueConnection
);
...
...
@@ -418,10 +417,20 @@ void KeyframeWidget::slotInitMonitor(bool active)
void
KeyframeWidget
::
connectMonitor
(
bool
active
)
{
if
(
m_monitorHelper
)
{
if
(
m_monitorHelper
->
connectMonitor
(
active
)
&&
m_
effectIsSelected
)
{
if
(
m_monitorHelper
->
connectMonitor
(
active
)
&&
m_
model
->
isActive
()
)
{
slotRefreshParams
();
}
}
Monitor
*
monitor
=
pCore
->
getMonitor
(
m_model
->
monitorId
);
if
(
active
)
{
connect
(
monitor
,
&
Monitor
::
seekToNextKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToNext
,
Qt
::
UniqueConnection
);
connect
(
monitor
,
&
Monitor
::
seekToPreviousKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToPrev
,
Qt
::
UniqueConnection
);
connect
(
monitor
,
&
Monitor
::
addRemoveKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotAddRemove
,
Qt
::
UniqueConnection
);
}
else
{
disconnect
(
monitor
,
&
Monitor
::
seekToNextKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToNext
);
disconnect
(
monitor
,
&
Monitor
::
seekToPreviousKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotGoToPrev
);
disconnect
(
monitor
,
&
Monitor
::
addRemoveKeyframe
,
m_keyframeview
,
&
KeyframeView
::
slotAddRemove
);
}
for
(
const
auto
&
w
:
m_parameters
)
{
auto
type
=
m_model
->
data
(
w
.
first
,
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
AnimatedRect
)
{
...
...
src/assets/view/widgets/keyframewidget.hpp
View file @
136ad569
...
...
@@ -100,7 +100,6 @@ private:
std
::
unordered_map
<
QPersistentModelIndex
,
QWidget
*>
m_parameters
;
int
m_baseHeight
;
int
m_addedHeight
;
bool
m_effectIsSelected
;
signals:
void
addIndex
(
QPersistentModelIndex
ix
);
...
...
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
136ad569
...
...
@@ -343,6 +343,7 @@ void CollapsibleEffectView::slotActivateEffect(bool active)
{
// m_colorIcon->setEnabled(active);
// bool active = ix.row() == m_model->row();
m_model
->
setActive
(
active
);
decoframe
->
setProperty
(
"active"
,
active
);
decoframe
->
setStyleSheet
(
decoframe
->
styleSheet
());
if
(
active
)
{
...
...
src/widgets/geometrywidget.cpp
View file @
136ad569
...
...
@@ -355,7 +355,7 @@ void GeometryWidget::adjustSizeValue()
void
GeometryWidget
::
slotAdjustRectKeyframeValue
()
{
QRect
rect
(
m_spinX
->
value
(),
m_spinY
->
value
(),
m_spinWidth
->
value
(),
m_spinHeight
->
value
());
m_monitor
->
setUpEffect
Geometry
(
rect
);
updateMonitor
Geometry
(
rect
);
emit
valueChanged
(
getValue
());
}
...
...
@@ -376,7 +376,7 @@ void GeometryWidget::slotUpdateGeometryRect(const QRect r)
m_spinY
->
blockSignals
(
false
);
m_spinWidth
->
blockSignals
(
false
);
m_spinHeight
->
blockSignals
(
false
);
m_monitor
->
setUpEffect
Geometry
(
r
);
updateMonitor
Geometry
(
r
);
adjustSizeValue
();
emit
valueChanged
(
getValue
());
}
...
...
@@ -407,7 +407,7 @@ void GeometryWidget::setValue(const QRect r, double opacity)
m_spinWidth
->
blockSignals
(
false
);
m_spinHeight
->
blockSignals
(
false
);
adjustSizeValue
();
m_monitor
->
setUpEffect
Geometry
(
r
);
updateMonitor
Geometry
(
r
);
}
const
QString
GeometryWidget
::
getValue
()
const
...
...
@@ -432,7 +432,7 @@ void GeometryWidget::connectMonitor(bool activate)
if
(
activate
)
{
connect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
GeometryWidget
::
slotUpdateGeometryRect
,
Qt
::
UniqueConnection
);
QRect
rect
(
m_spinX
->
value
(),
m_spinY
->
value
(),
m_spinWidth
->
value
(),
m_spinHeight
->
value
());
m_monitor
->
setUpEffect
Geometry
(
rect
);
updateMonitor
Geometry
(
rect
);
}
else
{
m_monitor
->
setEffectKeyframe
(
false
);
disconnect
(
m_monitor
,
&
Monitor
::
effectChanged
,
this
,
&
GeometryWidget
::
slotUpdateGeometryRect
);
...
...
src/widgets/geometrywidget.h
View file @
136ad569
...
...
@@ -97,6 +97,7 @@ private slots:
signals:
void
valueChanged
(
const
QString
val
);
void
updateMonitorGeometry
(
const
QRect
r
);
};
#endif
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