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
d3320647
Commit
d3320647
authored
May 20, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix slide composition going in wrong direction (mix is still todo)
CCBUG: 453770
parent
cf5e56aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
d3320647
...
...
@@ -6044,7 +6044,33 @@ void TimelineModel::switchComposition(int cid, const QString &compoId)
bool
res
=
requestCompositionDeletion
(
cid
,
undo
,
redo
);
int
newId
=
-
1
;
res
=
res
&&
requestCompositionInsertion
(
compoId
,
currentTrack
,
a_track
,
currentPos
,
duration
,
nullptr
,
newId
,
undo
,
redo
);
// Check if composition should be reversed (top clip at beginning, bottom at end)
int
topClip
=
getTrackById_const
(
currentTrack
)
->
getClipByPosition
(
currentPos
);
int
bottomTid
=
getTrackIndexFromPosition
(
a_track
-
1
);
int
bottomClip
=
-
1
;
if
(
bottomTid
>
-
1
)
{
bottomClip
=
getTrackById_const
(
bottomTid
)
->
getClipByPosition
(
currentPos
);
}
bool
reverse
=
false
;
if
(
topClip
>
-
1
&&
bottomClip
>
-
1
)
{
if
(
getClipPosition
(
topClip
)
+
getClipPlaytime
(
topClip
)
<
getClipPosition
(
bottomClip
)
+
getClipPlaytime
(
bottomClip
))
{
reverse
=
true
;
}
}
std
::
unique_ptr
<
Mlt
::
Properties
>
props
(
nullptr
);
if
(
reverse
)
{
props
=
std
::
make_unique
<
Mlt
::
Properties
>
();
if
(
compoId
==
QLatin1String
(
"dissolve"
))
{
props
->
set
(
"reverse"
,
1
);
}
else
if
(
compoId
==
QLatin1String
(
"composite"
))
{
props
->
set
(
"invert"
,
1
);
}
else
if
(
compoId
==
QLatin1String
(
"wipe"
))
{
props
->
set
(
"geometry"
,
"0=0% 0% 100% 100% 100%;-1=0% 0% 100% 100% 0%"
);
}
else
if
(
compoId
==
QLatin1String
(
"slide"
))
{
props
->
set
(
"rect"
,
"0=0% 0% 100% 100% 100%;-1=100% 0% 100% 100% 100%"
);
}
}
res
=
res
&&
requestCompositionInsertion
(
compoId
,
currentTrack
,
a_track
,
currentPos
,
duration
,
std
::
move
(
props
),
newId
,
undo
,
redo
);
if
(
res
)
{
if
(
forcedTrack
>
-
1
&&
isComposition
(
newId
))
{
m_allCompositions
[
newId
]
->
setForceTrack
(
true
);
...
...
src/timeline2/model/trackmodel.cpp
View file @
d3320647
...
...
@@ -2544,6 +2544,7 @@ void TrackModel::switchMix(int cid, const QString &composition, Fun &undo, Fun &
// First remove existing mix
// lock MLT playlist so that we don't end up with invalid frames in monitor
const
QString
currentAsset
=
m_sameCompositions
[
cid
]
->
getAssetId
();
// TODO: handle revert mixes
Fun
local_redo
=
[
this
,
cid
,
composition
]()
{
m_playlists
[
0
].
lock
();
m_playlists
[
1
].
lock
();
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
d3320647
...
...
@@ -447,6 +447,7 @@ void TimelineController::insertNewMix(int tid, int position, const QString &tran
int
TimelineController
::
insertNewCompositionAtPos
(
int
tid
,
int
position
,
const
QString
&
transitionId
)
{
// TODO: adjust position and duration to existing clips ?
return
insertComposition
(
tid
,
position
,
transitionId
,
true
);
}
...
...
@@ -517,10 +518,12 @@ int TimelineController::insertNewComposition(int tid, int clipId, int offset, co
props
=
std
::
make_unique
<
Mlt
::
Properties
>
();
if
(
transitionId
==
QLatin1String
(
"dissolve"
))
{
props
->
set
(
"reverse"
,
1
);
}
else
if
(
transitionId
==
QLatin1String
(
"composite"
)
||
transitionId
==
QLatin1String
(
"slide"
)
)
{
}
else
if
(
transitionId
==
QLatin1String
(
"composite"
))
{
props
->
set
(
"invert"
,
1
);
}
else
if
(
transitionId
==
QLatin1String
(
"wipe"
))
{
props
->
set
(
"geometry"
,
"0=0% 0% 100% 100% 100%;-1=0% 0% 100% 100% 0%"
);
}
else
if
(
transitionId
==
QLatin1String
(
"slide"
))
{
props
->
set
(
"rect"
,
"0=0% 0% 100% 100% 100%;-1=100% 0% 100% 100% 100%"
);
}
}
if
(
!
m_model
->
requestCompositionInsertion
(
transitionId
,
tid
,
position
,
duration
,
std
::
move
(
props
),
id
,
logUndo
))
{
...
...
@@ -541,7 +544,34 @@ int TimelineController::insertComposition(int tid, int position, const QString &
{
int
id
;
int
duration
=
pCore
->
getDurationFromString
(
KdenliveSettings
::
transition_duration
());
if
(
!
m_model
->
requestCompositionInsertion
(
transitionId
,
tid
,
position
,
duration
,
nullptr
,
id
,
logUndo
))
{
// Check if composition should be reversed (top clip at beginning, bottom at end)
int
a_track
=
m_model
->
getPreviousVideoTrackPos
(
tid
);
int
topClip
=
m_model
->
getTrackById_const
(
tid
)
->
getClipByPosition
(
position
);
int
bottomTid
=
m_model
->
getTrackIndexFromPosition
(
a_track
-
1
);
int
bottomClip
=
-
1
;
if
(
bottomTid
>
-
1
)
{
bottomClip
=
m_model
->
getTrackById_const
(
bottomTid
)
->
getClipByPosition
(
position
);
}
bool
reverse
=
false
;
if
(
topClip
>
-
1
&&
bottomClip
>
-
1
)
{
if
(
m_model
->
getClipPosition
(
topClip
)
+
m_model
->
getClipPlaytime
(
topClip
)
<
m_model
->
getClipPosition
(
bottomClip
)
+
m_model
->
getClipPlaytime
(
bottomClip
))
{
reverse
=
true
;
}
}
std
::
unique_ptr
<
Mlt
::
Properties
>
props
(
nullptr
);
if
(
reverse
)
{
props
=
std
::
make_unique
<
Mlt
::
Properties
>
();
if
(
transitionId
==
QLatin1String
(
"dissolve"
))
{
props
->
set
(
"reverse"
,
1
);
}
else
if
(
transitionId
==
QLatin1String
(
"composite"
))
{
props
->
set
(
"invert"
,
1
);
}
else
if
(
transitionId
==
QLatin1String
(
"wipe"
))
{
props
->
set
(
"geometry"
,
"0=0% 0% 100% 100% 100%;-1=0% 0% 100% 100% 0%"
);
}
else
if
(
transitionId
==
QLatin1String
(
"slide"
))
{
props
->
set
(
"rect"
,
"0=0% 0% 100% 100% 100%;-1=100% 0% 100% 100% 100%"
);
}
}
if
(
!
m_model
->
requestCompositionInsertion
(
transitionId
,
tid
,
position
,
duration
,
std
::
move
(
props
),
id
,
logUndo
))
{
id
=
-
1
;
}
return
id
;
...
...
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