Rotoscoping: add Auto keyframe button in monitor toolbar to automatically add...

Rotoscoping: add Auto keyframe button in monitor toolbar to automatically add a keyframe when moving a point
parent f4a1cdf6
Pipeline #29229 passed with stage
in 10 minutes and 55 seconds
......@@ -130,3 +130,4 @@ void KeyframeMonitorHelper::slotUpdateFromMonitorData(const QVariantList &center
break;
}
}
......@@ -446,6 +446,9 @@ void KeyframeWidget::slotUpdateKeyframesFromMonitor(const QPersistentModelIndex
m_keyframes->updateKeyframe(pos, res, index);
} else if (m_keyframes->hasKeyframe(getPosition()) || m_keyframes->singleKeyframe()) {
GenTime pos(getPosition(), pCore->getCurrentFps());
if (m_keyframes->singleKeyframe() && KdenliveSettings::autoKeyframe() && m_neededScene == MonitorSceneType::MonitorSceneRoto) {
m_keyframes->addKeyframe(pos, KeyframeType::Linear);
}
m_keyframes->updateKeyframe(pos, res, index);
}
}
......
......@@ -811,6 +811,11 @@
<label>Divide monitor resolution by this factor to speedup preview.</label>
<default>1</default>
</entry>
<entry name="autoKeyframe" type="Bool">
<label>Automatically create a new keyframe on keyframe move.</label>
<default>true</default>
</entry>
<entry name="clipMonitorOverlayGuides" type="Int">
<label>index of current guides overlay for clip monitor.</label>
......
......@@ -371,6 +371,7 @@ signals:
void acceptRipple(bool);
void switchTrimMode(int);
void activateTrack(int);
void autoKeyframeChanged();
};
#endif
......@@ -372,3 +372,14 @@ bool MonitorProxy::audioThumbFormat() const
{
return KdenliveSettings::displayallchannels();
}
void MonitorProxy::switchAutoKeyframe()
{
KdenliveSettings::setAutoKeyframe(!KdenliveSettings::autoKeyframe());
emit autoKeyframeChanged();
}
bool MonitorProxy::autoKeyframe() const
{
return KdenliveSettings::autoKeyframe();
}
......@@ -49,6 +49,7 @@ class MonitorProxy : public QObject
Q_PROPERTY(int overlayType READ overlayType WRITE setOverlayType NOTIFY overlayTypeChanged)
Q_PROPERTY(QColor thumbColor1 READ thumbColor1 NOTIFY colorsChanged)
Q_PROPERTY(QColor thumbColor2 READ thumbColor2 NOTIFY colorsChanged)
Q_PROPERTY(bool autoKeyframe READ autoKeyframe NOTIFY autoKeyframeChanged)
Q_PROPERTY(bool audioThumbFormat READ audioThumbFormat NOTIFY audioThumbFormatChanged)
/** @brief: Returns true if current clip in monitor has Audio and Video
* */
......@@ -97,6 +98,8 @@ public:
Q_INVOKABLE void startZoneMove();
Q_INVOKABLE void endZoneMove();
Q_INVOKABLE double fps() const;
Q_INVOKABLE void switchAutoKeyframe();
Q_INVOKABLE bool autoKeyframe() const;
QPoint profile();
void setClipProperties(int clipId, ClipType::ProducerType type, bool hasAV, const QString clipName);
void setAudioThumb(const QList <int> streamIndexes = QList <int>(), QList <int> channels = QList <int>());
......@@ -129,6 +132,7 @@ signals:
void colorsChanged();
void audioThumbFormatChanged();
void profileChanged();
void autoKeyframeChanged();
private:
GLWidget *q;
......
......@@ -9,6 +9,7 @@ Rectangle {
width: fullscreenButton.width
property bool rightSide: true
property bool barContainsMouse
property bool showAutoKeyframe: false
height: childrenRect.height
color: Qt.rgba(activePalette.window.r, activePalette.window.g, activePalette.window.b, 0.7)
radius: 4
......@@ -88,6 +89,14 @@ Rectangle {
tooltip: i18n("Zoom out")
onClicked: controller.triggerAction('monitor_zoomout')
}
ToolButton {
iconName: "media-record"
tooltip: i18n("Automatic Keyframes")
onClicked: controller.switchAutoKeyframe()
checkable: true
checked: controller.autoKeyframe
visible: showAutoKeyframe
}
ToolButton {
objectName: "moveBar"
iconName: "transform-move-horizontal"
......
......@@ -36,6 +36,7 @@ Item {
onScaleyChanged: canvas.requestPaint()
onSourcedarChanged: refreshdar()
property bool iskeyframe : true
property bool autoKeyframe: controller.autoKeyframe
property bool isDefined: false
property int requestedKeyFrame : -1
property int requestedSubKeyFrame : -1
......@@ -70,6 +71,13 @@ Item {
onIskeyframeChanged: {
console.log('KEYFRAME CHANGED: ', iskeyframe)
if (root.displayResize && !controller.autoKeyframe) {
root.displayResize = false
}
canvas.requestPaint()
}
onAutoKeyframeChanged: {
canvas.requestPaint()
}
......@@ -161,7 +169,7 @@ Item {
}
c2 = convertPoint(root.centerPointsTypes[2*i])
ctx.bezierCurveTo(c1.x, c1.y, c2.x, c2.y, p1.x, p1.y);
if (iskeyframe && !root.displayResize) {
if ((iskeyframe || autoKeyframe) && !root.displayResize) {
// Draw control points and segments
if (subkf) {
ctx.fillStyle = Qt.rgba(1, 1, 0, 0.8)
......@@ -365,6 +373,9 @@ Item {
}
onDoubleClicked: {
if (root.isDefined) {
if (root.iskeyframe == false && controller.autoKeyframe) {
controller.addRemoveKeyframe();
}
if (root.displayResize) {
// Disable resize mode
root.displayResize = false
......@@ -448,7 +459,13 @@ Item {
}
onPositionChanged: {
if (root.iskeyframe == false) return;
if (pressed && root.iskeyframe == false) {
if (controller.autoKeyframe) {
controller.addRemoveKeyframe();
} else {
return;
}
}
if (pressed) {
if (root.resizeContainsMouse > 0) {
// resizing shape
......@@ -543,7 +560,7 @@ Item {
canvas.requestPaint()
root.effectPolygonChanged()
}
} else if (root.centerPoints.length > 0) {
} else if ((root.iskeyframe || controller.autoKeyframe) && root.centerPoints.length > 0) {
// Check if we are over a keyframe
if (!root.displayResize) {
addPointPossible = Qt.point(0, 0)
......@@ -675,6 +692,7 @@ Item {
EffectToolBar {
id: effectToolBar
barContainsMouse: effectToolBar.rightSide ? global.mouseX >= x - 10 : global.mouseX < x + width + 10
showAutoKeyframe: true
onBarContainsMouseChanged: {
effectToolBar.opacity = 1
effectToolBar.visible = effectToolBar.barContainsMouse
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment