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
dbd6d54f
Commit
dbd6d54f
authored
Nov 02, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix wipe and slide compositions broken on resize
parent
f41c9463
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/compositionmodel.cpp
View file @
dbd6d54f
...
...
@@ -104,6 +104,34 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
if
(
!
right
)
{
roles
.
push_back
(
TimelineModel
::
StartRole
);
}
Fun
refresh
=
[]()
{
return
true
;
};
if
(
m_assetId
==
QLatin1String
(
"slide"
))
{
// Slide composition uses a keyframe at end of composition, so update last keyframe
refresh
=
[
this
]()
{
QString
animation
=
qstrdup
(
m_asset
->
get
(
"rect"
));
if
(
animation
.
contains
(
QLatin1Char
(
';'
))
&&
!
animation
.
contains
(
QLatin1String
(
";-1="
)))
{
QString
result
=
animation
.
section
(
QLatin1Char
(
';'
),
0
,
0
);
result
.
append
(
QStringLiteral
(
";-1="
));
result
.
append
(
animation
.
section
(
QLatin1Char
(
'='
),
-
1
));
m_asset
->
set
(
"rect"
,
result
.
toUtf8
().
constData
());
}
return
true
;
};
refresh
();
}
else
if
(
m_assetId
==
QLatin1String
(
"wipe"
))
{
// Slide composition uses a keyframe at end of composition, so update last keyframe
refresh
=
[
this
]()
{
QString
animation
=
qstrdup
(
m_asset
->
get
(
"geometry"
));
if
(
animation
.
contains
(
QLatin1Char
(
';'
))
&&
!
animation
.
contains
(
QLatin1String
(
";-1="
)))
{
QString
result
=
animation
.
section
(
QLatin1Char
(
';'
),
0
,
0
);
result
.
append
(
QStringLiteral
(
";-1="
));
result
.
append
(
animation
.
section
(
QLatin1Char
(
'='
),
-
1
));
m_asset
->
set
(
"geometry"
,
result
.
toUtf8
().
constData
());
}
return
true
;
};
refresh
();
}
Fun
operation
=
[
this
,
track_operation
,
roles
]()
{
if
(
track_operation
())
{
// we send a list of roles to be updated
...
...
@@ -119,6 +147,7 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
};
if
(
operation
())
{
// 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
UPDATE_UNDO_REDO
(
refresh
,
refresh
,
undo
,
redo
);
if
(
m_currentTrackId
!=
-
1
)
{
if
(
auto
ptr
=
m_parent
.
lock
())
{
track_reverse
=
ptr
->
getTrackById
(
m_currentTrackId
)
->
requestCompositionResize_lambda
(
m_id
,
old_in
,
old_out
,
logUndo
);
...
...
@@ -150,36 +179,6 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
};
refresh
();
UPDATE_UNDO_REDO
(
refresh
,
refresh
,
undo
,
redo
);
}
else
{
if
(
m_assetId
==
QLatin1String
(
"slide"
))
{
// Slide composition uses a keyframe at end of composition, so update last keyframe
Fun
refresh
=
[
this
]()
{
QString
animation
(
m_asset
->
get
(
"rect"
));
if
(
animation
.
contains
(
QLatin1Char
(
';'
)))
{
QString
result
=
animation
.
section
(
QLatin1Char
(
';'
),
0
,
0
);
result
.
append
(
QStringLiteral
(
";-1="
));
result
.
append
(
animation
.
section
(
QLatin1Char
(
'='
),
-
1
));
m_asset
->
set
(
"rect"
,
result
.
toUtf8
().
constData
());
}
return
true
;
};
refresh
();
UPDATE_UNDO_REDO
(
refresh
,
refresh
,
undo
,
redo
);
}
else
if
(
m_assetId
==
QLatin1String
(
"wipe"
))
{
// Slide composition uses a keyframe at end of composition, so update last keyframe
Fun
refresh
=
[
this
]()
{
QString
animation
(
m_asset
->
get
(
"geometry"
));
if
(
animation
.
contains
(
QLatin1Char
(
';'
)))
{
QString
result
=
animation
.
section
(
QLatin1Char
(
';'
),
0
,
0
);
result
.
append
(
QStringLiteral
(
";-1="
));
result
.
append
(
animation
.
section
(
QLatin1Char
(
'='
),
-
1
));
m_asset
->
set
(
"geometry"
,
result
.
toUtf8
().
constData
());
}
return
true
;
};
refresh
();
UPDATE_UNDO_REDO
(
refresh
,
refresh
,
undo
,
redo
);
}
}
}
UPDATE_UNDO_REDO
(
operation
,
reverse
,
undo
,
redo
);
...
...
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