Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
5736dfe8
Commit
5736dfe8
authored
Jul 12, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timeline: don't allow moving a keyframe at same pos as another one.
Related to
#686
parent
f0e73b31
Pipeline
#26900
canceled with stage
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
2 deletions
+34
-2
src/assets/keyframes/model/keyframemodel.cpp
src/assets/keyframes/model/keyframemodel.cpp
+2
-0
src/effects/effectstack/model/effectstackmodel.cpp
src/effects/effectstack/model/effectstackmodel.cpp
+15
-0
src/effects/effectstack/model/effectstackmodel.hpp
src/effects/effectstack/model/effectstackmodel.hpp
+2
-0
src/timeline2/view/qml/KeyframeView.qml
src/timeline2/view/qml/KeyframeView.qml
+2
-2
src/timeline2/view/timelinecontroller.cpp
src/timeline2/view/timelinecontroller.cpp
+12
-0
src/timeline2/view/timelinecontroller.h
src/timeline2/view/timelinecontroller.h
+1
-0
No files found.
src/assets/keyframes/model/keyframemodel.cpp
View file @
5736dfe8
...
...
@@ -175,6 +175,8 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, QVariant newVal, F
return
updateKeyframe
(
pos
,
result
);
}
if
(
oldPos
!=
pos
&&
hasKeyframe
(
pos
))
{
// Move rejected, another keyframe is here
qDebug
()
<<
"==== MOVE REJECTED!!"
;
return
false
;
}
KeyframeType
oldType
=
m_keyframeList
[
oldPos
].
first
;
...
...
src/effects/effectstack/model/effectstackmodel.cpp
View file @
5736dfe8
...
...
@@ -1276,3 +1276,18 @@ bool EffectStackModel::updateKeyFrame(int oldFrame, int newFrame, QVariant norma
}
return
listModel
->
updateKeyframe
(
GenTime
(
oldFrame
,
pCore
->
getCurrentFps
()),
GenTime
(
newFrame
,
pCore
->
getCurrentFps
()),
std
::
move
(
normalisedVal
));
}
bool
EffectStackModel
::
hasKeyFrame
(
int
frame
)
{
if
(
rootItem
->
childCount
()
==
0
)
return
false
;
int
ix
=
0
;
if
(
auto
ptr
=
m_masterService
.
lock
())
{
ix
=
ptr
->
get_int
(
"kdenlive:activeeffect"
);
}
if
(
ix
<
0
)
{
return
false
;
}
std
::
shared_ptr
<
EffectItemModel
>
sourceEffect
=
std
::
static_pointer_cast
<
EffectItemModel
>
(
rootItem
->
child
(
ix
));
std
::
shared_ptr
<
KeyframeModelList
>
listModel
=
sourceEffect
->
getKeyframeModel
();
return
listModel
->
hasKeyframe
(
frame
);
}
src/effects/effectstack/model/effectstackmodel.hpp
View file @
5736dfe8
...
...
@@ -109,6 +109,8 @@ public:
bool
removeKeyFrame
(
int
frame
);
/** Update a keyframe in all model parameters (with value updated only in first parameter)*/
bool
updateKeyFrame
(
int
oldFrame
,
int
newFrame
,
QVariant
normalisedVal
);
/** Returns true if active effect has a keyframe at pos p*/
bool
hasKeyFrame
(
int
frame
);
/** Remove unwanted fade effects, mostly after a cut operation */
void
cleanFadeEffects
(
bool
outEffects
,
Fun
&
undo
,
Fun
&
redo
);
...
...
src/timeline2/view/qml/KeyframeView.qml
View file @
5736dfe8
...
...
@@ -148,7 +148,7 @@ Rectangle
if
(
newPos
<
1
)
{
newPos
=
1
}
if
(
newPos
!=
dragPos
)
{
if
(
newPos
!=
dragPos
&&
(
newPos
==
0
||
!
timeline
.
hasKeyframeAt
(
masterObject
.
clipId
,
frame
+
newPos
))
)
{
dragPos
=
newPos
parent
.
x
=
newPos
*
timeScale
keyframecanvas
.
requestPaint
()
...
...
@@ -222,7 +222,7 @@ Rectangle
if
(
frame
+
newPos
<=
inPoint
)
{
newPos
=
inPoint
+
1
-
frame
}
if
(
newPos
!=
dragPos
)
{
if
(
newPos
!=
dragPos
&&
(
newPos
==
0
||
!
timeline
.
hasKeyframeAt
(
masterObject
.
clipId
,
frame
+
newPos
))
)
{
dragPos
=
newPos
parent
.
x
=
newPos
*
timeScale
-
root
.
baseUnit
/
2
keyframecanvas
.
requestPaint
()
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
5736dfe8
...
...
@@ -3248,6 +3248,18 @@ void TimelineController::updateEffectKeyframe(int cid, int oldFrame, int newFram
}
}
bool
TimelineController
::
hasKeyframeAt
(
int
cid
,
int
frame
)
{
if
(
m_model
->
isClip
(
cid
))
{
std
::
shared_ptr
<
EffectStackModel
>
destStack
=
m_model
->
getClipEffectStackModel
(
cid
);
return
destStack
->
hasKeyFrame
(
frame
);
}
else
if
(
m_model
->
isComposition
(
cid
))
{
std
::
shared_ptr
<
KeyframeModelList
>
listModel
=
m_model
->
m_allCompositions
[
cid
]
->
getKeyframeModel
();
return
listModel
->
hasKeyframe
(
frame
);
}
return
false
;
}
bool
TimelineController
::
darkBackground
()
const
{
KColorScheme
scheme
(
QApplication
::
palette
().
currentColorGroup
());
...
...
src/timeline2/view/timelinecontroller.h
View file @
5736dfe8
...
...
@@ -399,6 +399,7 @@ public:
Q_INVOKABLE
void
addEffectKeyframe
(
int
cid
,
int
frame
,
double
val
);
Q_INVOKABLE
void
removeEffectKeyframe
(
int
cid
,
int
frame
);
Q_INVOKABLE
void
updateEffectKeyframe
(
int
cid
,
int
oldFrame
,
int
newFrame
,
const
QVariant
&
normalizedValue
=
QVariant
());
Q_INVOKABLE
bool
hasKeyframeAt
(
int
cid
,
int
frame
);
/** @brief Make current timeline track active/inactive*/
Q_INVOKABLE
void
switchTrackActive
(
int
trackId
=
-
1
);
...
...
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