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
f72ab410
Commit
f72ab410
authored
Jan 09, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix clips incorrectly resized on move with mix
parent
154f6aca
Pipeline
#46927
passed with stage
in 12 minutes and 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
f72ab410
...
...
@@ -688,9 +688,10 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
if
(
old_trackId
==
trackId
)
{
// We are moving a clip on same track
if
(
finalMove
&&
position
>=
mixData
.
first
.
firstClipInOut
.
second
)
{
position
+=
m_allClips
[
clipId
]
->
getMixDuration
()
-
m_allClips
[
clipId
]
->
getMixCutPosition
();
removeMixWithUndo
(
clipId
,
local_undo
,
local_redo
);
}
}
else
if
(
finalMove
)
{
}
else
{
// Clip moved to another track, delete mix
int
subPlaylist
=
m_allClips
[
clipId
]
->
getSubPlaylistIndex
();
update_playlist
=
[
this
,
clipId
,
old_trackId
,
trackId
,
finalMove
]()
{
...
...
@@ -718,6 +719,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
if
(
finalMove
&&
(
position
+
clipDuration
<=
mixData
.
second
.
secondClipInOut
.
first
))
{
// Moved outside mix zone
removeMixWithUndo
(
mixData
.
second
.
secondClipId
,
local_undo
,
local_redo
);
}
}
else
{
// Clip moved to another track, delete mix
...
...
@@ -738,11 +740,8 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
int
mixEnd
=
m_allClips
[
mixData
.
first
.
firstClipId
]
->
getPosition
()
+
m_allClips
[
mixData
.
first
.
firstClipId
]
->
getPlaytime
();
if
(
mixEnd
<
position
)
{
// Mix will be deleted, recreate on undo
bool
isAudio
=
getTrackById_const
(
old_trackId
)
->
isAudioTrack
();
update_playlist_undo
=
[
this
,
mixData
,
old_trackId
,
isAudio
]()
{
bool
result
=
getTrackById_const
(
old_trackId
)
->
createMix
(
mixData
.
first
,
isAudio
);
return
result
;
};
position
+=
m_allClips
[
mixData
.
first
.
secondClipId
]
->
getMixDuration
()
-
m_allClips
[
mixData
.
first
.
secondClipId
]
->
getMixCutPosition
();
removeMixWithUndo
(
mixData
.
first
.
secondClipId
,
local_undo
,
local_redo
);
}
}
}
...
...
@@ -752,11 +751,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
int
mixEnd
=
m_allClips
[
mixData
.
second
.
secondClipId
]
->
getPosition
();
if
(
mixEnd
>
position
+
m_allClips
[
clipId
]
->
getPlaytime
())
{
// Mix will be deleted, recreate on undo
bool
isAudio
=
getTrackById_const
(
old_trackId
)
->
isAudioTrack
();
update_playlist_undo
=
[
this
,
mixData
,
old_trackId
,
isAudio
]()
{
bool
result
=
getTrackById_const
(
old_trackId
)
->
createMix
(
mixData
.
second
,
isAudio
);
return
result
;
};
removeMixWithUndo
(
mixData
.
second
.
secondClipId
,
local_undo
,
local_redo
);
}
}
}
...
...
@@ -785,6 +780,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
Q_ASSERT
(
undone
);
return
false
;
}
qDebug
()
<<
":::MOVED CLIP: "
<<
clipId
<<
" TO "
<<
position
;
sync_mix
();
update_model
();
simple_move_mix
();
...
...
@@ -2364,7 +2360,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
Q_ASSERT
(
undone
);
return
false
;
}
int
newStart
=
getTrackById_const
(
current_track_id
)
->
getBlankStart
(
current_in
-
1
);
int
newStart
=
getTrackById_const
(
current_track_id
)
->
getBlankStart
(
current_in
-
1
,
subPlaylist
);
delta_pos
=
qMax
(
delta_pos
,
newStart
-
current_in
);
}
}
else
{
...
...
@@ -2374,7 +2370,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
subPlaylist
=
m_allClips
[
item
.
first
]
->
getSubPlaylistIndex
();
}
if
(
!
getTrackById_const
(
current_track_id
)
->
isAvailable
(
moveStart
,
moveEnd
-
moveStart
,
subPlaylist
))
{
int
newStart
=
getTrackById_const
(
current_track_id
)
->
getBlankEnd
(
current_in
+
playtime
);
int
newStart
=
getTrackById_const
(
current_track_id
)
->
getBlankEnd
(
current_in
+
playtime
,
subPlaylist
);
if
(
newStart
==
current_in
+
playtime
)
{
// No move possible, abort
bool
undone
=
local_undo
();
...
...
src/timeline2/model/trackmodel.cpp
View file @
f72ab410
...
...
@@ -1548,10 +1548,10 @@ bool TrackModel::requestRemoveMix(std::pair<int, int> clipIds, Fun &undo, Fun &r
Fun
local_undo
=
[]()
{
return
true
;
};
Fun
local_redo
=
[]()
{
return
true
;
};
if
(
auto
ptr
=
m_parent
.
lock
())
{
// Resize main clip
result
=
ptr
->
getClipPtr
(
clipIds
.
second
)
->
requestResize
(
endPos
-
secondInPos
,
false
,
local_undo
,
local_redo
,
true
,
true
);
// Resize first part clip
result
=
result
&&
ptr
->
getClipPtr
(
clipIds
.
first
)
->
requestResize
(
secondInPos
-
firstInPos
,
true
,
local_undo
,
local_redo
,
true
,
true
);
result
=
ptr
->
getClipPtr
(
clipIds
.
first
)
->
requestResize
(
secondInPos
-
firstInPos
,
true
,
local_undo
,
local_redo
,
true
,
true
);
// Resize main clip
result
=
result
&&
ptr
->
getClipPtr
(
clipIds
.
second
)
->
requestResize
(
endPos
-
secondInPos
,
false
,
local_undo
,
local_redo
,
true
,
true
);
}
if
(
result
)
{
PUSH_LAMBDA
(
local_redo
,
redo
);
...
...
src/timeline2/view/qml/timeline.qml
View file @
f72ab410
...
...
@@ -1467,7 +1467,7 @@ Rectangle {
controller
.
requestCompositionMove
(
dragProxy
.
draggedItem
,
tId
,
dragFrame
,
true
,
true
,
true
)
}
else
{
if
(
controller
.
normalEdit
())
{
controller
.
requestClipMove
(
dragProxy
.
draggedItem
,
dragProxy
.
sourceTrack
,
dragProxy
.
sourceFrame
,
moveMirrorTracks
,
tru
e
,
false
,
false
)
controller
.
requestClipMove
(
dragProxy
.
draggedItem
,
dragProxy
.
sourceTrack
,
dragProxy
.
sourceFrame
,
moveMirrorTracks
,
fals
e
,
false
,
false
)
controller
.
requestClipMove
(
dragProxy
.
draggedItem
,
tId
,
dragFrame
,
moveMirrorTracks
,
true
,
true
,
true
)
}
else
{
// Fake move, only process final move
...
...
Ma Ch
💬
@mc
·
Jan 09, 2021
please see
https://invent.kde.org/mc/saveKDE/-/issues/1
Edited
Jan 09, 2021
by
Ma Ch
please see https://invent.kde.org/mc/saveKDE/-/issues/1
Eugen Mohr
@emohr
mentioned in issue
#796
·
Jan 09, 2021
mentioned in issue
#796
mentioned in issue #796
Toggle commit list
Write
Preview
Supports
Markdown
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