return result.join(";");
}
-bool ClipItem::checkKeyFrames()
+bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int cutPos)
{
bool clipEffectsModified = false;
QLocale locale;
// go through all effects this clip has
for (int ix = 0; ix < m_effectList.count(); ++ix) {
+ // Check geometry params
+ resizeGeometries(ix, width, height, previousDuration, cutPos == -1 ? 0 : cutPos, cropDuration().frames(m_fps) - 1);
+
+ // Check keyframe params
QStringList keyframeParams = keyframes(ix);
QStringList newKeyFrameParams;
bool effModified = false;
}
}
+void ClipItem::resizeGeometries(const int index, int width, int height, int previousDuration, int start, int duration)
+{
+ QString geom;
+ QDomElement effect = m_effectList.at(index);
+ QDomNodeList params = effect.elementsByTagName("parameter");
+
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ if (!e.isNull() && e.attribute("type") == "geometry") {
+ geom = e.attribute("value");
+ Mlt::Geometry geometry(geom.toUtf8().data(), previousDuration, width, height);
+ e.setAttribute("value", geometry.serialise(start, start + duration));
+ }
+ }
+}
+
QStringList ClipItem::keyframes(const int index)
{
QStringList result;
void initEffect(QDomElement effect, int diff = 0, int offset = 0);
/** @brief Gets all keyframes.
- * @param index Number of the effect
+ * @param index Index of the effect
* @return a list of strings of keyframes (one string per param) */
QStringList keyframes(const int index);
+ /** @brief Adjust all geometry keyframes.
+ * @param index Index of the effect */
+ void resizeGeometries(const int index, int width, int height, int previousDuration, int start, int duration);
+
/** @brief Sets params with keyframes and updates the visible keyframes.
* @param ix Number of the effect
* @param keyframes a list of strings of keyframes (one string per param), which should be used */
/** @brief Adjust keyframes to the new clip. */
const QString adjustKeyframes(QString keyframes, int offset);
/** @brief Makes sure all keyframes are in the clip's cropped duration.
+ * @param cutPos the frame number where the new clip starts
* @return Whether or not changes were made */
- bool checkKeyFrames();
+ bool checkKeyFrames(int width, int height, int previousDuration, int cutPos = -1);
QPixmap startThumb() const;
QPixmap endThumb() const;
void setVideoOnly(bool force);
item->resizeEnd(cutPos);
scene()->addItem(dup);
- if (item->checkKeyFrames())
+ if (item->checkKeyFrames(m_document->width(), m_document->height(), info.cropDuration.frames(m_document->fps())))
slotRefreshEffects(item);
- if (dup->checkKeyFrames())
+ if (dup->checkKeyFrames(m_document->width(), m_document->height(), info.cropDuration.frames(m_document->fps()), cutTime.frames(m_document->fps())))
slotRefreshEffects(dup);
item->baseClip()->addReference();