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
1432dd62
Commit
1432dd62
authored
Sep 26, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix mix deletion when deleting first clip of a mix
parent
dbd4ae02
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
1432dd62
...
...
@@ -1715,16 +1715,7 @@ bool TimelineModel::requestItemDeletion(int itemId, Fun &undo, Fun &redo, bool l
return
requestGroupDeletion
(
itemId
,
undo
,
redo
);
}
if
(
isClip
(
itemId
))
{
int
tid
=
m_allClips
[
itemId
]
->
getCurrentTrackId
();
bool
syncMix
=
false
;
if
(
tid
>
-
1
)
{
syncMix
=
getTrackById_const
(
tid
)
->
hasMix
(
itemId
);
}
bool
result
=
requestClipDeletion
(
itemId
,
undo
,
redo
);
if
(
syncMix
)
{
getTrackById_const
(
tid
)
->
syncronizeMixes
(
logUndo
);
}
return
result
;
return
requestClipDeletion
(
itemId
,
undo
,
redo
);
}
if
(
isComposition
(
itemId
))
{
return
requestCompositionDeletion
(
itemId
,
undo
,
redo
);
...
...
@@ -1762,7 +1753,14 @@ bool TimelineModel::requestClipDeletion(int clipId, Fun &undo, Fun &redo)
{
int
trackId
=
getClipTrackId
(
clipId
);
if
(
trackId
!=
-
1
)
{
bool
res
=
getTrackById
(
trackId
)
->
requestClipDeletion
(
clipId
,
true
,
true
,
undo
,
redo
,
false
,
true
);
bool
res
=
true
;
if
(
getTrackById_const
(
trackId
)
->
hasEndMix
(
clipId
))
{
MixInfo
mixData
=
getTrackById_const
(
trackId
)
->
getMixInfo
(
clipId
).
second
;
if
(
isClip
(
mixData
.
secondClipId
))
{
res
=
getTrackById
(
trackId
)
->
requestRemoveMix
({
clipId
,
mixData
.
secondClipId
},
undo
,
redo
);
}
}
res
=
res
&&
getTrackById
(
trackId
)
->
requestClipDeletion
(
clipId
,
true
,
true
,
undo
,
redo
,
false
,
true
);
if
(
!
res
)
{
undo
();
return
false
;
...
...
src/timeline2/model/trackmodel.cpp
View file @
1432dd62
...
...
@@ -1825,12 +1825,17 @@ std::pair<MixInfo, MixInfo> TrackModel::getMixInfo(int clipId) const
startMix
.
firstClipId
=
m_mixList
.
key
(
clipId
,
-
1
);
startMix
.
secondClipId
=
clipId
;
if
(
auto
ptr
=
m_parent
.
lock
())
{
std
::
shared_ptr
<
ClipModel
>
clip1
=
ptr
->
getClipPtr
(
startMix
.
firstClipId
);
std
::
shared_ptr
<
ClipModel
>
clip2
=
ptr
->
getClipPtr
(
startMix
.
secondClipId
);
startMix
.
firstClipInOut
.
first
=
clip1
->
getPosition
();
startMix
.
firstClipInOut
.
second
=
startMix
.
firstClipInOut
.
first
+
clip1
->
getPlaytime
();
startMix
.
secondClipInOut
.
first
=
clip2
->
getPosition
();
startMix
.
secondClipInOut
.
second
=
startMix
.
secondClipInOut
.
first
+
clip2
->
getPlaytime
();
if
(
ptr
->
isClip
(
startMix
.
firstClipId
))
{
std
::
shared_ptr
<
ClipModel
>
clip1
=
ptr
->
getClipPtr
(
startMix
.
firstClipId
);
std
::
shared_ptr
<
ClipModel
>
clip2
=
ptr
->
getClipPtr
(
startMix
.
secondClipId
);
startMix
.
firstClipInOut
.
first
=
clip1
->
getPosition
();
startMix
.
firstClipInOut
.
second
=
startMix
.
firstClipInOut
.
first
+
clip1
->
getPlaytime
();
startMix
.
secondClipInOut
.
first
=
clip2
->
getPosition
();
startMix
.
secondClipInOut
.
second
=
startMix
.
secondClipInOut
.
first
+
clip2
->
getPlaytime
();
}
else
{
// Clip was deleted
startMix
.
firstClipId
=
-
1
;
}
}
}
else
{
startMix
.
firstClipId
=
-
1
;
...
...
@@ -1841,12 +1846,17 @@ std::pair<MixInfo, MixInfo> TrackModel::getMixInfo(int clipId) const
endMix
.
firstClipId
=
clipId
;
endMix
.
secondClipId
=
secondClip
;
if
(
auto
ptr
=
m_parent
.
lock
())
{
std
::
shared_ptr
<
ClipModel
>
clip1
=
ptr
->
getClipPtr
(
endMix
.
firstClipId
);
std
::
shared_ptr
<
ClipModel
>
clip2
=
ptr
->
getClipPtr
(
endMix
.
secondClipId
);
endMix
.
firstClipInOut
.
first
=
clip1
->
getPosition
();
endMix
.
firstClipInOut
.
second
=
endMix
.
firstClipInOut
.
first
+
clip1
->
getPlaytime
();
endMix
.
secondClipInOut
.
first
=
clip2
->
getPosition
();
endMix
.
secondClipInOut
.
second
=
endMix
.
secondClipInOut
.
first
+
clip2
->
getPlaytime
();
if
(
ptr
->
isClip
(
secondClip
))
{
std
::
shared_ptr
<
ClipModel
>
clip1
=
ptr
->
getClipPtr
(
endMix
.
firstClipId
);
std
::
shared_ptr
<
ClipModel
>
clip2
=
ptr
->
getClipPtr
(
endMix
.
secondClipId
);
endMix
.
firstClipInOut
.
first
=
clip1
->
getPosition
();
endMix
.
firstClipInOut
.
second
=
endMix
.
firstClipInOut
.
first
+
clip1
->
getPlaytime
();
endMix
.
secondClipInOut
.
first
=
clip2
->
getPosition
();
endMix
.
secondClipInOut
.
second
=
endMix
.
secondClipInOut
.
first
+
clip2
->
getPlaytime
();
}
else
{
// Clip was deleted
endMix
.
firstClipId
=
-
1
;
}
}
}
else
{
endMix
.
firstClipId
=
-
1
;
...
...
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