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
a50a24f1
Commit
a50a24f1
authored
Jul 28, 2021
by
Jean-Baptiste Mardelle
Browse files
Removing a remap effect now restores input duration
parent
b4c0505c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/clipmodel.cpp
View file @
a50a24f1
...
...
@@ -376,6 +376,33 @@ bool ClipModel::isChain() const
return
m_producer
->
parent
().
type
()
==
mlt_service_chain_type
;
}
int
ClipModel
::
getRemapInputDuration
()
const
{
Mlt
::
Chain
fromChain
(
m_producer
->
parent
());
int
count
=
fromChain
.
link_count
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
QScopedPointer
<
Mlt
::
Link
>
fromLink
(
fromChain
.
link
(
i
));
if
(
fromLink
&&
fromLink
->
is_valid
()
&&
fromLink
->
get
(
"mlt_service"
))
{
if
(
fromLink
->
get
(
"mlt_service"
)
==
QLatin1String
(
"timeremap"
))
{
// Found a timeremap effect, read params
std
::
shared_ptr
<
Mlt
::
Link
>
link
=
std
::
make_shared
<
Mlt
::
Link
>
(
fromChain
.
link
(
i
)
->
get_link
());
QString
mapData
=
link
->
get
(
"map"
);
int
min
=
GenTime
(
link
->
anim_get_double
(
"map"
,
getIn
())).
frames
(
pCore
->
getCurrentFps
());
QStringList
str
=
mapData
.
split
(
QLatin1Char
(
';'
));
int
max
=
-
1
;
for
(
auto
&
s
:
str
)
{
int
val
=
GenTime
(
s
.
section
(
QLatin1Char
(
'='
),
1
).
toDouble
()).
frames
(
pCore
->
getCurrentFps
());
if
(
val
>
max
)
{
max
=
val
;
}
}
return
max
-
min
;
}
}
}
return
0
;
}
std
::
shared_ptr
<
Mlt
::
Producer
>
ClipModel
::
getProducer
()
{
READ_LOCK
();
...
...
src/timeline2/model/clipmodel.hpp
View file @
a50a24f1
...
...
@@ -87,6 +87,8 @@ public:
/** @brief Returns true if the producer is embedded in a chain (for use with timeremap) */
bool
isChain
()
const
;
/** @brief Returns the duration of the input map */
int
getRemapInputDuration
()
const
;
/** @brief Returns a comma separated list of effect names */
const
QString
effectNames
()
const
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
a50a24f1
...
...
@@ -4876,6 +4876,12 @@ bool TimelineModel::requestClipTimeRemap(int clipId, bool enable, Fun &undo, Fun
// in order to make the producer change effective, we need to unplant / replant the clip in int track
bool
success
=
true
;
int
trackId
=
getClipTrackId
(
clipId
);
int
previousDuration
=
0
;
qDebug
()
<<
"=== REQUEST REMAP: "
<<
enable
<<
"
\n\n
WWWWWWWWWWWWWWWWWWWWWWWWWWWW"
;
if
(
!
enable
&&
m_allClips
[
clipId
]
->
isChain
())
{
previousDuration
=
m_allClips
[
clipId
]
->
getRemapInputDuration
();
qDebug
()
<<
"==== CALCULATED INPIUT DURATION: "
<<
previousDuration
<<
"
\n\n
HHHHHHHHHHHHHH"
;
}
if
(
trackId
!=
-
1
)
{
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipDeletion
(
clipId
,
true
,
true
,
local_undo
,
local_redo
,
false
,
false
);
}
...
...
@@ -4884,6 +4890,10 @@ bool TimelineModel::requestClipTimeRemap(int clipId, bool enable, Fun &undo, Fun
}
if
(
trackId
!=
-
1
)
{
success
=
success
&&
getTrackById
(
trackId
)
->
requestClipInsertion
(
clipId
,
oldPos
,
true
,
true
,
local_undo
,
local_redo
);
if
(
success
&&
!
enable
&&
previousDuration
>
0
)
{
// Restore input duration
requestItemResize
(
clipId
,
previousDuration
,
true
,
true
,
local_undo
,
local_redo
);
}
}
if
(
!
success
)
{
local_undo
();
...
...
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