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
d8f08ed3
Commit
d8f08ed3
authored
Oct 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Ensure mix parenting is updated in case of clip cut
parent
65cba8aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinefunctions.cpp
View file @
d8f08ed3
...
...
@@ -128,6 +128,7 @@ bool TimelineFunctions::processClipCut(const std::shared_ptr<TimelineItemModel>
return
false
;
}
PlaylistState
::
ClipState
state
=
timeline
->
m_allClips
[
clipId
]
->
clipState
();
// Check if clip has an end Mix
bool
res
=
cloneClip
(
timeline
,
clipId
,
newId
,
state
,
undo
,
redo
);
timeline
->
m_blockRefresh
=
true
;
res
=
res
&&
timeline
->
requestItemResize
(
clipId
,
position
-
start
,
true
,
true
,
undo
,
redo
);
...
...
@@ -141,6 +142,18 @@ bool TimelineFunctions::processClipCut(const std::shared_ptr<TimelineItemModel>
// The next requestclipmove does not check for duration change since we don't invalidate timeline, so check duration change now
bool
durationChanged
=
trackDuration
!=
timeline
->
getTrackById_const
(
trackId
)
->
trackDuration
();
res
=
res
&&
timeline
->
requestClipMove
(
newId
,
trackId
,
position
,
true
,
true
,
false
,
true
,
undo
,
redo
);
if
(
timeline
->
getTrackById_const
(
trackId
)
->
hasEndMix
(
clipId
))
{
Fun
local_undo
=
[
timeline
,
trackId
,
clipId
,
newId
]()
{
timeline
->
getTrackById_const
(
trackId
)
->
reAssignEndMix
(
newId
,
clipId
);
return
true
;
};
Fun
local_redo
=
[
timeline
,
trackId
,
clipId
,
newId
]()
{
timeline
->
getTrackById_const
(
trackId
)
->
reAssignEndMix
(
clipId
,
newId
);
return
true
;
};
local_redo
();
UPDATE_UNDO_REDO_NOLOCK
(
local_redo
,
local_undo
,
undo
,
redo
);
}
if
(
durationChanged
)
{
// Track length changed, check project duration
Fun
updateDuration
=
[
timeline
]()
{
...
...
src/timeline2/model/trackmodel.cpp
View file @
d8f08ed3
...
...
@@ -2168,3 +2168,12 @@ const std::shared_ptr<AssetParameterModel> TrackModel::mixModel(int cid)
}
return
nullptr
;
}
bool
TrackModel
::
reAssignEndMix
(
int
currentId
,
int
newId
)
{
Q_ASSERT
(
m_mixList
.
contains
(
currentId
));
int
mixedClip
=
m_mixList
.
value
(
currentId
);
m_mixList
.
remove
(
currentId
);
m_mixList
.
insert
(
newId
,
mixedClip
);
return
true
;
}
src/timeline2/model/trackmodel.hpp
View file @
d8f08ed3
...
...
@@ -132,6 +132,9 @@ public:
bool
createMix
(
std
::
pair
<
int
,
int
>
clipIds
,
std
::
pair
<
int
,
int
>
mixData
);
/** @brief Create a mix composition using mix info */
bool
createMix
(
MixInfo
info
,
bool
isAudio
);
/** @brief Change id of first clip in a mix (in case of clip cut) */
bool
reAssignEndMix
(
int
currentId
,
int
newId
);
/** @brief Ensure we don't have unsynced mixes in the playlist (mixes without owner clip) */
void
syncronizeMixes
(
bool
finalMove
);
/** @brief Switch a clip from one playlist to the other */
bool
switchPlaylist
(
int
clipId
,
int
position
,
int
sourcePlaylist
,
int
destPlaylist
);
...
...
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