Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
252
Issues
252
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
4cd6df70
Commit
4cd6df70
authored
Sep 22, 2019
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix track effects not working when a clip is added at end of track or if last clip is resized.
Fixes
#356
parent
21382f01
Pipeline
#8119
passed with stage
in 22 minutes and 3 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
5 deletions
+63
-5
src/core.cpp
src/core.cpp
+2
-2
src/effects/effectstack/model/effectstackmodel.cpp
src/effects/effectstack/model/effectstackmodel.cpp
+21
-1
src/timeline2/model/clipmodel.cpp
src/timeline2/model/clipmodel.cpp
+12
-0
src/timeline2/model/trackmodel.cpp
src/timeline2/model/trackmodel.cpp
+23
-1
src/timeline2/model/trackmodel.hpp
src/timeline2/model/trackmodel.hpp
+5
-1
No files found.
src/core.cpp
View file @
4cd6df70
...
...
@@ -620,7 +620,7 @@ void Core::invalidateRange(QSize range)
void
Core
::
invalidateItem
(
ObjectId
itemId
)
{
if
(
!
m_mainWindow
||
m_mainWindow
->
getCurrentTimeline
()
->
loading
)
return
;
if
(
!
m_mainWindow
||
!
m_mainWindow
->
getCurrentTimeline
()
||
m_mainWindow
->
getCurrentTimeline
()
->
loading
)
return
;
switch
(
itemId
.
first
)
{
case
ObjectType
::
TimelineClip
:
case
ObjectType
::
TimelineComposition
:
...
...
@@ -652,7 +652,7 @@ void Core::updateItemKeyframes(ObjectId id)
void
Core
::
updateItemModel
(
ObjectId
id
,
const
QString
&
service
)
{
if
(
m_mainWindow
&&
!
m_mainWindow
->
getCurrentTimeline
()
->
loading
&&
service
.
startsWith
(
QLatin1String
(
"fade"
))
&&
id
.
first
==
ObjectType
::
TimelineClip
)
{
if
(
m_mainWindow
&&
id
.
first
==
ObjectType
::
TimelineClip
&&
!
m_mainWindow
->
getCurrentTimeline
()
->
loading
&&
service
.
startsWith
(
QLatin1String
(
"fade"
))
)
{
bool
startFade
=
service
==
QLatin1String
(
"fadein"
)
||
service
==
QLatin1String
(
"fade_from_black"
);
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
updateClip
(
id
.
second
,
{
startFade
?
TimelineModel
::
FadeInRole
:
TimelineModel
::
FadeOutRole
});
}
...
...
src/effects/effectstack/model/effectstackmodel.cpp
View file @
4cd6df70
...
...
@@ -591,7 +591,27 @@ bool EffectStackModel::adjustStackLength(bool adjustFromEnd, int oldIn, int oldD
PUSH_LAMBDA
(
refresh
,
redo
);
PUSH_LAMBDA
(
refresh
,
undo
);
}
else
{
qDebug
()
<<
"// NULL Keyframes---------"
;
if
(
m_ownerId
.
first
==
ObjectType
::
TimelineTrack
)
{
int
oldEffectOut
=
effect
->
filter
().
get_out
();
Fun
operation
=
[
effect
,
out
,
logUndo
]()
{
effect
->
setParameter
(
QStringLiteral
(
"out"
),
out
,
logUndo
);
return
true
;
};
bool
res
=
operation
();
if
(
!
res
)
{
return
false
;
}
if
(
logUndo
)
{
Fun
reverse
=
[
effect
,
oldEffectOut
]()
{
effect
->
setParameter
(
QStringLiteral
(
"out"
),
oldEffectOut
,
true
);
return
true
;
};
PUSH_LAMBDA
(
operation
,
redo
);
PUSH_LAMBDA
(
reverse
,
undo
);
}
}
else
{
qDebug
()
<<
"// NULL Keyframes---------"
;
}
}
}
}
...
...
src/timeline2/model/clipmodel.cpp
View file @
4cd6df70
...
...
@@ -171,6 +171,7 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
int
outPoint
=
out
;
int
inPoint
=
in
;
int
offset
=
0
;
int
trackDuration
=
0
;
if
(
m_endlessResize
)
{
offset
=
inPoint
;
outPoint
=
out
-
in
;
...
...
@@ -181,6 +182,9 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
if
(
ptr
->
getTrackById
(
m_currentTrackId
)
->
isLocked
())
{
return
false
;
}
if
(
right
&&
ptr
->
getTrackById_const
(
m_currentTrackId
)
->
isLastClip
(
getPosition
()))
{
trackDuration
=
ptr
->
getTrackById_const
(
m_currentTrackId
)
->
trackDuration
();
}
track_operation
=
ptr
->
getTrackById
(
m_currentTrackId
)
->
requestClipResize_lambda
(
m_id
,
inPoint
,
outPoint
,
right
);
}
else
{
qDebug
()
<<
"Error : Moving clip failed because parent timeline is not available anymore"
;
...
...
@@ -219,6 +223,14 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
// Now, we are in the state in which the timeline should be when we try to revert current action. So we can build the reverse action from here
if
(
m_currentTrackId
!=
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
if
(
trackDuration
>
0
)
{
// Operation changed parent track duration, update effect stack
int
newDuration
=
ptr
->
getTrackById_const
(
m_currentTrackId
)
->
trackDuration
();
if
(
logUndo
||
trackDuration
!=
newDuration
)
{
// A clip move changed the track duration, update track effects
ptr
->
getTrackById
(
m_currentTrackId
)
->
m_effectStack
->
adjustStackLength
(
true
,
0
,
trackDuration
,
0
,
newDuration
,
0
,
undo
,
redo
,
logUndo
);
}
}
track_reverse
=
ptr
->
getTrackById
(
m_currentTrackId
)
->
requestClipResize_lambda
(
m_id
,
old_in
,
old_out
,
right
);
}
}
...
...
src/timeline2/model/trackmodel.cpp
View file @
4cd6df70
...
...
@@ -177,6 +177,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
m_playlists
[
0
].
unlock
();
if
(
finalMove
&&
!
groupMove
)
{
ptr
->
updateDuration
();
}
return
index
!=
-
1
&&
end_function
(
0
);
}
...
...
@@ -236,9 +237,14 @@ bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView,
if
(
ptr
->
getClipPtr
(
clipId
)
->
clipState
()
!=
PlaylistState
::
Disabled
)
{
res
=
res
&&
ptr
->
getClipPtr
(
clipId
)
->
setClipState
(
isAudioTrack
()
?
PlaylistState
::
AudioOnly
:
PlaylistState
::
VideoOnly
,
local_undo
,
local_redo
);
}
int
duration
=
trackDuration
();
auto
operation
=
requestClipInsertion_lambda
(
clipId
,
position
,
updateView
,
finalMove
,
groupMove
);
res
=
res
&&
operation
();
if
(
res
)
{
if
(
finalMove
&&
duration
!=
trackDuration
())
{
// A clip move changed the track duration, update track effects
m_effectStack
->
adjustStackLength
(
true
,
0
,
duration
,
0
,
trackDuration
(),
0
,
undo
,
redo
,
true
);
}
auto
reverse
=
requestClipDeletion_lambda
(
clipId
,
updateView
,
finalMove
,
groupMove
);
UPDATE_UNDO_REDO
(
operation
,
reverse
,
local_undo
,
local_redo
);
UPDATE_UNDO_REDO
(
local_redo
,
local_undo
,
undo
,
redo
);
...
...
@@ -346,8 +352,13 @@ bool TrackModel::requestClipDeletion(int clipId, bool updateView, bool finalMove
if
(
finalDeletion
)
{
m_allClips
[
clipId
]
->
selected
=
false
;
}
int
duration
=
trackDuration
();
auto
operation
=
requestClipDeletion_lambda
(
clipId
,
updateView
,
finalMove
,
groupMove
);
if
(
operation
())
{
if
(
finalMove
&&
duration
!=
trackDuration
())
{
// A clip move changed the track duration, update track effects
m_effectStack
->
adjustStackLength
(
true
,
0
,
duration
,
0
,
trackDuration
(),
0
,
undo
,
redo
,
true
);
}
auto
reverse
=
requestClipInsertion_lambda
(
clipId
,
old_position
,
updateView
,
finalMove
,
groupMove
);
UPDATE_UNDO_REDO
(
operation
,
reverse
,
undo
,
redo
);
return
true
;
...
...
@@ -921,6 +932,17 @@ std::pair<int, int> TrackModel::getClipIndexAt(int position)
return
{
-
1
,
-
1
};
}
bool
TrackModel
::
isLastClip
(
int
position
)
{
READ_LOCK
();
for
(
int
j
=
0
;
j
<
2
;
j
++
)
{
if
(
!
m_playlists
[
j
].
is_blank_at
(
position
))
{
return
m_playlists
[
j
].
get_clip_index_at
(
position
)
==
m_playlists
[
j
].
count
()
-
1
;
}
}
return
false
;
}
bool
TrackModel
::
isBlankAt
(
int
position
)
{
READ_LOCK
();
...
...
@@ -1205,7 +1227,7 @@ void TrackModel::setEffectStackEnabled(bool enable)
m_effectStack
->
setEffectStackEnabled
(
enable
);
}
int
TrackModel
::
trackDuration
()
int
TrackModel
::
trackDuration
()
const
{
return
m_track
->
get_length
();
}
...
...
src/timeline2/model/trackmodel.hpp
View file @
4cd6df70
...
...
@@ -182,6 +182,10 @@ protected:
int
getBlankSizeNearComposition
(
int
compoId
,
bool
after
);
int
getBlankStart
(
int
position
);
int
getBlankSizeAtPos
(
int
frame
);
/* @brief Returns true if clip at position is the last on playlist
* @param position the position in playlist
*/
bool
isLastClip
(
int
position
);
/*@brief Returns the best composition duration depending on clips on the track */
int
suggestCompositionLength
(
int
position
);
...
...
@@ -248,7 +252,7 @@ protected:
* This is used when some properties of the clip have changed, and we need this to refresh it */
void
replugClip
(
int
clipId
);
int
trackDuration
();
int
trackDuration
()
const
;
/* @brief Returns the list of the ids of the clips that intersect the given range */
std
::
unordered_set
<
int
>
getClipsInRange
(
int
position
,
int
end
=
-
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