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
a29dcd7f
Commit
a29dcd7f
authored
Nov 08, 2021
by
Jean-Baptiste Mardelle
Browse files
Resize Mix left side: limit to previous clip length, fix undo corruption
parent
e2804b6f
Pipeline
#95076
passed with stage
in 8 minutes and 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
a29dcd7f
...
...
@@ -3281,27 +3281,36 @@ bool TimelineModel::requestItemResize(int itemId, int size, bool right, bool log
bool
result
=
false
;
if
(
isClip
(
itemId
))
{
bool
hasMix
=
false
;
if
(
!
logUndo
)
{
int
tid
=
m_allClips
[
itemId
]
->
getCurrentTrackId
();
if
(
tid
>
-
1
)
{
if
(
right
)
{
if
(
getTrackById_const
(
tid
)
->
hasEndMix
(
itemId
))
{
hasMix
=
true
;
}
}
else
if
(
getTrackById_const
(
tid
)
->
hasStartMix
(
itemId
))
{
hasMix
=
true
;
std
::
pair
<
MixInfo
,
MixInfo
>
mixData
=
getTrackById_const
(
tid
)
->
getMixInfo
(
itemId
);
// We have a mix at clip start
int
mixDuration
=
mixData
.
first
.
firstClipInOut
.
second
-
(
mixData
.
first
.
secondClipInOut
.
second
-
size
);
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
qMax
(
1
,
mixDuration
),
m_allClips
[
itemId
]
->
getMixCutPosition
());
int
tid
=
m_allClips
[
itemId
]
->
getCurrentTrackId
();
std
::
pair
<
MixInfo
,
MixInfo
>
mixData
=
getTrackById_const
(
tid
)
->
getMixInfo
(
itemId
);
if
(
tid
>
-
1
)
{
if
(
right
&&
mixData
.
second
.
firstClipId
>
-
1
)
{
hasMix
=
true
;
size
=
qMin
(
size
,
mixData
.
second
.
secondClipInOut
.
second
-
mixData
.
second
.
firstClipInOut
.
first
);
}
else
if
(
!
right
&&
mixData
.
first
.
firstClipId
>
-
1
)
{
hasMix
=
true
;
// We have a mix at clip start, limit size to previous clip start
size
=
qMin
(
size
,
mixData
.
first
.
secondClipInOut
.
second
-
mixData
.
first
.
firstClipInOut
.
first
);
int
currentMixDuration
=
mixData
.
first
.
firstClipInOut
.
second
-
mixData
.
first
.
secondClipInOut
.
first
;
int
mixDuration
=
mixData
.
first
.
firstClipInOut
.
second
-
(
mixData
.
first
.
secondClipInOut
.
second
-
size
);
Fun
local_update
=
[
this
,
itemId
,
tid
,
mixData
,
mixDuration
]
{
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
qMax
(
1
,
mixDuration
),
mixData
.
first
.
mixOffset
);
QModelIndex
ix
=
makeClipIndexFromID
(
itemId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
return
true
;
};
Fun
local_update_undo
=
[
this
,
itemId
,
tid
,
mixData
,
currentMixDuration
]
{
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
currentMixDuration
,
mixData
.
first
.
mixOffset
);
QModelIndex
ix
=
makeClipIndexFromID
(
itemId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
return
true
;
};
local_update
();
if
(
logUndo
)
{
UPDATE_UNDO_REDO
(
local_update
,
local_update_undo
,
local_undo
,
local_redo
);
}
}
}
else
{
int
tid
=
m_allClips
[
itemId
]
->
getCurrentTrackId
();
if
(
tid
>
-
1
&&
getTrackById_const
(
tid
)
->
hasMix
(
itemId
))
{
hasMix
=
true
;
}
else
{
hasMix
=
mixData
.
second
.
firstClipId
>
-
1
||
mixData
.
first
.
firstClipId
>
-
1
;
}
}
result
=
m_allClips
[
itemId
]
->
requestResize
(
size
,
right
,
local_undo
,
local_redo
,
logUndo
,
hasMix
);
...
...
Julius Künzel
⚠
@jlskuz
mentioned in commit
89a4bdf2
·
Nov 08, 2021
mentioned in commit
89a4bdf2
mentioned in commit 89a4bdf211c99536f8f456aed9379778377b3224
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