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
f3ac41ab
Commit
f3ac41ab
authored
May 04, 2019
by
Jean-Baptiste Mardelle
Browse files
Fix fades copy/paste
parent
48dd96e0
Pipeline
#3064
passed with stage
in 13 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/effects/effectstack/model/effectstackmodel.cpp
View file @
f3ac41ab
...
...
@@ -248,11 +248,11 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
continue
;
}
auto
effect
=
EffectItemModel
::
construct
(
effectId
,
shared_from_this
());
int
in
=
node
.
attribute
(
QStringLiteral
(
"in"
))
.
toInt
()
;
int
out
=
node
.
attribute
(
QStringLiteral
(
"out"
))
.
toInt
()
;
if
(
out
>
0
)
{
effect
->
filter
().
set
(
"in"
,
in
);
effect
->
filter
().
set
(
"out"
,
out
);
const
QString
in
=
node
.
attribute
(
QStringLiteral
(
"in"
));
const
QString
out
=
node
.
attribute
(
QStringLiteral
(
"out"
));
if
(
!
out
.
isEmpty
()
)
{
effect
->
filter
().
set
(
"in"
,
in
.
toUtf8
().
constData
()
);
effect
->
filter
().
set
(
"out"
,
out
.
toUtf8
().
constData
()
);
}
QStringList
keyframeParams
=
effect
->
getKeyframableParameters
();
QVector
<
QPair
<
QString
,
QVariant
>>
parameters
;
...
...
@@ -260,6 +260,9 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
for
(
int
j
=
0
;
j
<
params
.
count
();
j
++
)
{
QDomElement
pnode
=
params
.
item
(
j
).
toElement
();
const
QString
pName
=
pnode
.
attribute
(
QStringLiteral
(
"name"
));
if
(
pName
==
QLatin1String
(
"in"
)
||
pName
==
QLatin1String
(
"out"
))
{
continue
;
}
if
(
keyframeParams
.
contains
(
pName
))
{
// This is a keyframable parameter, fix offest
QString
pValue
=
KeyframeModel
::
getAnimationStringWithOffset
(
effect
,
pnode
.
text
(),
currentIn
-
parentIn
);
...
...
@@ -277,8 +280,15 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
if
(
effectId
==
QLatin1String
(
"fadein"
)
||
effectId
==
QLatin1String
(
"fade_from_black"
))
{
m_fadeIns
.
insert
(
effect
->
getId
());
int
duration
=
effect
->
filter
().
get_length
()
-
1
;
effect
->
filter
().
set
(
"in"
,
currentIn
);
effect
->
filter
().
set
(
"out"
,
currentIn
+
duration
);
}
else
if
(
effectId
==
QLatin1String
(
"fadeout"
)
||
effectId
==
QLatin1String
(
"fade_to_black"
))
{
m_fadeOuts
.
insert
(
effect
->
getId
());
int
duration
=
effect
->
filter
().
get_length
()
-
1
;
int
filterOut
=
pCore
->
getItemIn
(
m_ownerId
)
+
pCore
->
getItemDuration
(
m_ownerId
)
-
1
;
effect
->
filter
().
set
(
"in"
,
filterOut
-
duration
);
effect
->
filter
().
set
(
"out"
,
filterOut
);
}
local_redo
();
UPDATE_UNDO_REDO
(
local_redo
,
local_undo
,
undo
,
redo
);
...
...
@@ -326,9 +336,17 @@ bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sou
QVector
<
int
>
roles
=
{
TimelineModel
::
EffectNamesRole
};
if
(
effectId
==
QLatin1String
(
"fadein"
)
||
effectId
==
QLatin1String
(
"fade_from_black"
))
{
m_fadeIns
.
insert
(
effect
->
getId
());
int
duration
=
effect
->
filter
().
get_length
()
-
1
;
int
in
=
pCore
->
getItemIn
(
m_ownerId
);
effect
->
filter
().
set
(
"in"
,
in
);
effect
->
filter
().
set
(
"out"
,
in
+
duration
);
roles
<<
TimelineModel
::
FadeInRole
;
}
else
if
(
effectId
==
QLatin1String
(
"fadeout"
)
||
effectId
==
QLatin1String
(
"fade_to_black"
))
{
m_fadeOuts
.
insert
(
effect
->
getId
());
int
duration
=
effect
->
filter
().
get_length
()
-
1
;
int
out
=
pCore
->
getItemIn
(
m_ownerId
)
+
pCore
->
getItemDuration
(
m_ownerId
)
-
1
;
effect
->
filter
().
set
(
"in"
,
out
-
duration
);
effect
->
filter
().
set
(
"out"
,
out
);
roles
<<
TimelineModel
::
FadeOutRole
;
}
bool
res
=
local_redo
();
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
f3ac41ab
...
...
@@ -1880,9 +1880,9 @@ void TimelineController::pasteEffects(int targetId)
for
(
int
i
=
1
;
i
<
clips
.
size
();
i
++
)
{
QDomElement
subeffects
=
clips
.
at
(
i
).
firstChildElement
(
QStringLiteral
(
"effects"
));
QDomNodeList
subs
=
subeffects
.
childNodes
();
for
(
int
j
=
0
;
j
<
subs
.
size
();
j
++
)
{
subs
.
at
(
j
).
toElement
().
setAttribute
(
QStringLiteral
(
"parentIn"
),
clips
.
at
(
i
).
toElement
().
attribute
(
QStringLiteral
(
"in"
)));
effects
.
appendChild
(
subs
.
at
(
j
));
while
(
!
subs
.
isEmpty
()
)
{
subs
.
at
(
0
).
toElement
().
setAttribute
(
QStringLiteral
(
"parentIn"
),
clips
.
at
(
i
).
toElement
().
attribute
(
QStringLiteral
(
"in"
)));
effects
.
appendChild
(
subs
.
at
(
0
));
}
}
bool
result
=
true
;
...
...
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