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
14c98d92
Commit
14c98d92
authored
Jul 23, 2021
by
Jean-Baptiste Mardelle
Browse files
Various timeremap UI and workflow fixes
parent
7f1a4789
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
src/dialogs/timeremap.cpp
View file @
14c98d92
This diff is collapsed.
Click to expand it.
src/dialogs/timeremap.h
View file @
14c98d92
...
...
@@ -65,6 +65,7 @@ protected:
void
mouseMoveEvent
(
QMouseEvent
*
event
)
override
;
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
void
mouseReleaseEvent
(
QMouseEvent
*
event
)
override
;
void
wheelEvent
(
QWheelEvent
*
event
)
override
;
std
::
shared_ptr
<
Mlt
::
Link
>
m_remapLink
;
/** @brief The position of the clip in timeline, used to seek to correct place */
int
m_startPos
;
...
...
@@ -92,6 +93,7 @@ private:
QColor
m_colSelected
;
QColor
m_colKeyframe
;
int
m_zoomHeight
;
int
m_centerPos
;
int
m_lineHeight
;
double
m_zoomFactor
;
double
m_zoomStart
;
...
...
src/timeline2/model/clipmodel.cpp
View file @
14c98d92
...
...
@@ -489,6 +489,29 @@ void ClipModel::refreshProducerFromBin(int trackId, PlaylistState::ClipState sta
m_speed
=
speed
;
qDebug
()
<<
"changing speed"
<<
in
<<
out
<<
m_speed
;
}
QString
remapMap
;
int
remapPitch
;
QString
remapBlend
;
if
(
m_hasTimeRemap
)
{
if
(
m_producer
->
parent
().
type
()
==
mlt_service_chain_type
)
{
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
remapMap
=
fromLink
->
get
(
"map"
);
remapPitch
=
fromLink
->
get_int
(
"pitch"
);
remapBlend
=
fromLink
->
get
(
"image_mode"
);
break
;
}
}
}
}
else
{
qDebug
()
<<
"=== NON CHAIN ON REFRESH!!!"
;
}
}
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
m_binClipId
);
std
::
shared_ptr
<
Mlt
::
Producer
>
binProducer
=
binClip
->
getTimelineProducer
(
trackId
,
m_id
,
state
,
stream
,
m_speed
,
secondPlaylist
,
timeremap
);
m_producer
=
std
::
move
(
binProducer
);
...
...
@@ -500,6 +523,25 @@ void ClipModel::refreshProducerFromBin(int trackId, PlaylistState::ClipState sta
emit
ptr
->
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
TimeRemapRole
});
}
}
if
(
m_hasTimeRemap
)
{
// Restor timeremap parameters
if
(
m_producer
->
parent
().
type
()
==
mlt_service_chain_type
)
{
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
fromLink
->
set
(
"map"
,
remapMap
.
toUtf8
().
constData
());
fromLink
->
set
(
"pitch"
,
remapPitch
);
fromLink
->
set
(
"image_mode"
,
remapBlend
.
toUtf8
().
constData
());
break
;
}
}
}
}
}
if
(
hasPitch
)
{
// Check if pitch shift is enabled
m_producer
->
parent
().
set
(
"warp_pitch"
,
1
);
...
...
@@ -909,6 +951,26 @@ QDomElement ClipModel::toXml(QDomDocument &document)
if
(
!
qFuzzyCompare
(
m_speed
,
1.
))
{
container
.
setAttribute
(
QStringLiteral
(
"warp_pitch"
),
getIntProperty
(
QStringLiteral
(
"warp_pitch"
)));
}
if
(
m_hasTimeRemap
)
{
if
(
m_producer
->
parent
().
type
()
==
mlt_service_chain_type
)
{
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
container
.
setAttribute
(
QStringLiteral
(
"timemap"
),
fromLink
->
get
(
"map"
));
container
.
setAttribute
(
QStringLiteral
(
"timepitch"
),
fromLink
->
get_int
(
"pitch"
));
container
.
setAttribute
(
QStringLiteral
(
"timeblend"
),
fromLink
->
get
(
"image_mode"
));
break
;
}
}
}
}
else
{
qDebug
()
<<
"=== NON CHAIN ON REFRESH!!!"
;
}
}
container
.
appendChild
(
m_effectStack
->
toXml
(
document
));
return
container
;
}
...
...
src/timeline2/model/timelinefunctions.cpp
View file @
14c98d92
...
...
@@ -1842,6 +1842,27 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
timeline_undo
();
semaphore
.
release
(
1
);
return
false
;
}
if
(
prod
.
hasAttribute
(
QStringLiteral
(
"timemap"
)))
{
// This is a timeremap
timeline
->
m_allClips
[
newId
]
->
useTimeRemapProducer
(
true
,
timeline_undo
,
timeline_redo
);
if
(
timeline
->
m_allClips
[
newId
]
->
m_producer
->
parent
().
type
()
==
mlt_service_chain_type
)
{
Mlt
::
Chain
fromChain
(
timeline
->
m_allClips
[
newId
]
->
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
fromLink
->
set
(
"map"
,
prod
.
attribute
(
QStringLiteral
(
"timemap"
)).
toUtf8
().
constData
());
fromLink
->
set
(
"pitch"
,
prod
.
attribute
(
QStringLiteral
(
"timepitch"
)).
toInt
());
fromLink
->
set
(
"image_mode"
,
prod
.
attribute
(
QStringLiteral
(
"timeblend"
)).
toUtf8
().
constData
());
break
;
}
}
}
}
}
if
(
timeline
->
m_allClips
[
newId
]
->
m_endlessResize
)
{
out
=
out
-
in
;
...
...
src/timeline2/model/timelinemodel.cpp
View file @
14c98d92
...
...
@@ -4750,6 +4750,7 @@ void TimelineModel::requestClipReload(int clipId, int forceDuration)
hasPitch
=
m_allClips
[
clipId
]
->
getIntProperty
(
QStringLiteral
(
"warp_pitch"
));
}
int
audioStream
=
m_allClips
[
clipId
]
->
getIntProperty
(
QStringLiteral
(
"audio_index"
));
bool
timeremap
=
m_allClips
[
clipId
]
->
isChain
();
// Check if clip out is longer than actual producer duration (if user forced duration)
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
getClipBinId
(
clipId
));
bool
refreshView
=
oldOut
>
int
(
binClip
->
frameDuration
())
||
forceDuration
>
-
1
;
...
...
@@ -4757,7 +4758,7 @@ void TimelineModel::requestClipReload(int clipId, int forceDuration)
getTrackById
(
old_trackId
)
->
requestClipDeletion
(
clipId
,
refreshView
,
true
,
local_undo
,
local_redo
,
false
,
false
);
}
if
(
old_trackId
!=
-
1
)
{
m_allClips
[
clipId
]
->
refreshProducerFromBin
(
old_trackId
,
state
,
audioStream
,
0
,
hasPitch
,
currentSubplaylist
==
1
);
m_allClips
[
clipId
]
->
refreshProducerFromBin
(
old_trackId
,
state
,
audioStream
,
0
,
hasPitch
,
currentSubplaylist
==
1
,
timeremap
);
if
(
forceDuration
>
-
1
)
{
m_allClips
[
clipId
]
->
requestResize
(
forceDuration
,
true
,
local_undo
,
local_redo
);
}
...
...
src/timeline2/view/qml/Clip.qml
View file @
14c98d92
...
...
@@ -876,7 +876,6 @@ Rectangle {
color
:
'
#fdbc4b
'
width
:
labelRect
.
height
height
:
labelRect
.
height
x
:
labelRect
.
x
anchors.top
:
labelRect
.
top
anchors.left
:
labelRect
.
right
visible
:
!
clipRoot
.
isAudio
&&
clipRoot
.
clipStatus
===
ClipStatus
.
StatusProxy
||
clipRoot
.
clipStatus
===
ClipStatus
.
StatusProxyOnly
...
...
@@ -902,12 +901,11 @@ Rectangle {
color
:
'
#cc0033
'
width
:
labelRect
.
height
height
:
labelRect
.
height
x
:
labelRect
.
x
anchors.top
:
labelRect
.
top
anchors.left
:
labelRect
.
right
anchors.left
:
proxyRect
.
visible
?
proxyRect
.
right
:
labelRect
.
right
visible
:
clipRoot
.
timeremap
Text
{
//
Proxy P
//
Remap R
id
:
remapLabel
text
:
"
R
"
font.pointSize
:
root
.
fontUnit
+
1
...
...
src/ui/timeremap_ui.ui
View file @
14c98d92
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
291
</width>
<height>
24
2
</height>
<width>
408
</width>
<height>
3
24
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -41,38 +41,26 @@
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"go-previous"
>
<normaloff>
../../../../.designer/backup
</normaloff>
../../../../.designer/backup
</iconset>
</property>
<property
name=
"autoRaise"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QToolButton"
name=
"button_
next
"
>
<widget
class=
"QToolButton"
name=
"button_
add
"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"go-next"
>
<normaloff>
../../../../.designer/backup
</normaloff>
../../../../.designer/backup
</iconset>
</property>
<property
name=
"autoRaise"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QToolButton"
name=
"button_
add
"
>
<widget
class=
"QToolButton"
name=
"button_
next
"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"list-add"
>
<normaloff>
../../../../.designer/backup
</normaloff>
../../../../.designer/backup
</iconset>
</property>
<property
name=
"autoRaise"
>
<bool>
true
</bool>
</property>
...
...
@@ -84,7 +72,8 @@
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"align-horizontal-center"
/>
<iconset
theme=
"align-horizontal-center"
>
<normaloff>
.
</normaloff>
.
</iconset>
</property>
<property
name=
"autoRaise"
>
<bool>
true
</bool>
...
...
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