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
39494a12
Commit
39494a12
authored
Jul 29, 2021
by
Jean-Baptiste Mardelle
Browse files
Disable time remap for color or image clips and clips with speed effect
parent
b3a4ae10
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/definitions.h
View file @
39494a12
...
...
@@ -80,7 +80,7 @@ enum OperationType {
namespace
PlaylistState
{
Q_NAMESPACE
enum
ClipState
{
VideoOnly
=
1
,
AudioOnly
=
2
,
Disabled
=
3
};
enum
ClipState
{
VideoOnly
=
1
,
AudioOnly
=
2
,
Disabled
=
3
,
Unknown
=
4
};
Q_ENUM_NS
(
ClipState
)
}
// namespace PlaylistState
...
...
src/mainwindow.cpp
View file @
39494a12
...
...
@@ -4276,7 +4276,7 @@ void MainWindow::slotRemapItemTime()
{
TimelineWidget
*
current
=
getCurrentTimeline
();
if
(
current
)
{
current
->
controller
()
->
remapItemTime
(
-
1
,
-
1
);
current
->
controller
()
->
remapItemTime
(
-
1
);
}
}
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
39494a12
...
...
@@ -2199,12 +2199,18 @@ void TimelineController::invalidateZone(int in, int out)
m_timelinePreview
->
invalidatePreview
(
in
,
out
==
-
1
?
m_duration
:
out
);
}
void
TimelineController
::
remapItemTime
(
int
clipId
,
double
speed
)
void
TimelineController
::
remapItemTime
(
int
clipId
)
{
if
(
clipId
==
-
1
)
{
clipId
=
getMainSelectedClip
();
}
if
(
clipId
==
-
1
||
!
m_model
->
isClip
(
clipId
))
{
// Don't allow remaping a clip with speed effect
if
(
clipId
==
-
1
||
!
m_model
->
isClip
(
clipId
)
||
qFuzzyCompare
(
1.
,
m_model
->
m_allClips
[
clipId
]
->
getSpeed
()))
{
pCore
->
displayMessage
(
i18n
(
"No item to edit"
),
ErrorMessage
,
500
);
return
;
}
ClipType
::
ProducerType
type
=
m_model
->
m_allClips
[
clipId
]
->
clipType
();
if
(
type
==
ClipType
::
Color
||
type
==
ClipType
::
Image
)
{
pCore
->
displayMessage
(
i18n
(
"No item to edit"
),
ErrorMessage
,
500
);
return
;
}
...
...
@@ -3309,30 +3315,36 @@ void TimelineController::updateClipActions()
pCore
->
remapClip
(
item
);
}
}
bool
isInGroup
=
m_model
->
m_groups
->
isInGroup
(
item
);
PlaylistState
::
ClipState
state
=
PlaylistState
::
ClipState
::
Unknown
;
ClipType
::
ProducerType
type
=
ClipType
::
Unknown
;
if
(
clip
)
{
state
=
clip
->
clipState
();
type
=
clip
->
clipType
();
}
for
(
QAction
*
act
:
qAsConst
(
clipActions
))
{
bool
enableAction
=
true
;
const
QChar
actionData
=
act
->
data
().
toChar
();
if
(
actionData
==
QLatin1Char
(
'G'
))
{
enableAction
=
isInSelection
(
item
)
&&
selectionSize
>
1
;
}
else
if
(
actionData
==
QLatin1Char
(
'U'
))
{
enableAction
=
m_model
->
m_groups
->
isInGroup
(
item
)
;
enableAction
=
isInGroup
;
}
else
if
(
actionData
==
QLatin1Char
(
'A'
))
{
if
(
m_model
->
m_groups
->
isInGroup
(
item
)
&&
m_model
->
m_groups
->
getType
(
m_model
->
m_groups
->
getRootId
(
item
))
==
GroupType
::
AVSplit
)
{
if
(
isInGroup
&&
m_model
->
m_groups
->
getType
(
m_model
->
m_groups
->
getRootId
(
item
))
==
GroupType
::
AVSplit
)
{
enableAction
=
true
;
}
else
{
enableAction
=
clip
&&
clip
->
clipS
tate
()
==
PlaylistState
::
AudioOnly
;
enableAction
=
s
tate
==
PlaylistState
::
AudioOnly
;
}
}
else
if
(
actionData
==
QLatin1Char
(
'V'
))
{
enableAction
=
clip
&&
clip
->
clipS
tate
()
==
PlaylistState
::
VideoOnly
;
enableAction
=
s
tate
==
PlaylistState
::
VideoOnly
;
}
else
if
(
actionData
==
QLatin1Char
(
'D'
))
{
enableAction
=
clip
&&
clip
->
clipS
tate
()
==
PlaylistState
::
Disabled
;
enableAction
=
s
tate
==
PlaylistState
::
Disabled
;
}
else
if
(
actionData
==
QLatin1Char
(
'E'
))
{
enableAction
=
clip
&&
clip
->
clipS
tate
()
!=
PlaylistState
::
Disabled
;
enableAction
=
s
tate
!=
PlaylistState
::
Disabled
&&
state
!=
PlaylistState
::
Unknown
;
}
else
if
(
actionData
==
QLatin1Char
(
'X'
)
||
actionData
==
QLatin1Char
(
'S'
))
{
enableAction
=
clip
&&
clip
->
canBeVideo
()
&&
clip
->
canBeAudio
();
if
(
enableAction
&&
actionData
==
QLatin1Char
(
'S'
))
{
PlaylistState
::
ClipState
state
=
clip
->
clipState
();
if
(
m_model
->
m_groups
->
isInGroup
(
item
))
{
if
(
isInGroup
)
{
// Check if all clips in the group have have same state (audio or video)
int
targetRoot
=
m_model
->
m_groups
->
getRootId
(
item
);
if
(
m_model
->
isGroup
(
targetRoot
))
{
...
...
@@ -3362,7 +3374,8 @@ void TimelineController::updateClipActions()
// Position actions should stay enabled in clip monitor
enableAction
=
true
;
}
else
if
(
actionData
==
QLatin1Char
(
'R'
))
{
enableAction
=
clip
!=
nullptr
;
// Time remap action
enableAction
=
clip
!=
nullptr
&&
type
!=
ClipType
::
Color
&&
type
!=
ClipType
::
Image
;
if
(
enableAction
)
{
act
->
setChecked
(
clip
->
isChain
());
}
...
...
src/timeline2/view/timelinecontroller.h
View file @
39494a12
...
...
@@ -560,7 +560,7 @@ public:
/** @brief Change a clip item's speed in timeline */
Q_INVOKABLE
void
changeItemSpeed
(
int
clipId
,
double
speed
);
/** @brief Activate time remap on the clip */
void
remapItemTime
(
int
clipId
,
double
speed
);
void
remapItemTime
(
int
clipId
);
/** @brief Delete selected zone and fill gap by moving following clips
* @param lift if true, the zone will simply be deleted but clips won't be moved
*/
...
...
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