update();
}*/
-QList <int> ClipItem::updatePanZoom(int width, int height, int cut)
-{
- QList <int> effectPositions;
- for (int i = 0; i < m_effectList.count(); i++) {
- QDomElement effect = m_effectList.at(i);
- QDomNodeList params = effect.elementsByTagName("parameter");
- for (int j = 0; j < params.count(); j++) {
- QDomElement e = params.item(j).toElement();
- if (e.isNull())
- continue;
- if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
- effectPositions << i;
-// updateGeometryKeyframes(effect, j, width, height, cut);
- }
- }
- }
-
- return effectPositions;
-}
-
Mlt::Producer *ClipItem::getProducer(int track, bool trackSpecific)
{
if (isAudioOnly())
void ClipItem::updateGeometryKeyframes(QDomElement effect, int paramIndex, int width, int height, ItemInfo oldInfo)
{
- QDomElement param = effect.elementsByTagName("parameter").item(paramIndex).toElement();
-
- Mlt::Geometry geometry(param.attribute("value").toUtf8().data(), oldInfo.cropDuration.frames(m_fps), width, height);
+ QDomElement param = effect.elementsByTagName("parameter").item(paramIndex).toElement();
+ int offset = oldInfo.cropStart.frames(m_fps);
+ QString data = param.attribute("value");
+ if (offset > 0) {
+ QStringList kfrs = data.split(';');
+ data.clear();
+ foreach (QString keyframe, kfrs) {
+ if (keyframe.contains('=')) {
+ int pos = keyframe.section('=', 0, 0).toInt();
+ pos += offset;
+ data.append(QString::number(pos) + "=" + keyframe.section('=', 1) + ";");
+ }
+ else data.append(keyframe + ";");
+ }
+ }
+ Mlt::Geometry geometry(data.toUtf8().data(), oldInfo.cropDuration.frames(m_fps), width, height);
param.setAttribute("value", geometry.serialise(cropStart().frames(m_fps), (cropStart() + cropDuration()).frames(m_fps) - 1));
}
void insertKeyframe(QDomElement effect, int pos, int val);
void movedKeyframe(QDomElement effect, int oldpos, int newpos, double value);
void updateKeyframes(QDomElement effect);
- /** @brief Updates the keyframes in the pan and zoom effect to fit the clips cropDuration.
- * @param width Render width
- * @param height Render height
- * @param cut (optional) if clip was cut, cut position relative to the original's clip position
- * @return List of the pan and zoom effects indexes
- *
- * Can be used for all effects using mlt_geometry with keyframes, but at the moment Pan & Zoom is the only one. */
- QList <int> updatePanZoom(int width, int height, int cut = 0);
void updateGeometryKeyframes(QDomElement effect, int paramIndex, int width, int height, ItemInfo oldInfo);
bool updateNormalKeyframes(QDomElement parameter);
if (dup->checkKeyFrames())
slotRefreshEffects(dup);
- updatePanZoom(item);
- updatePanZoom(dup, cutTime - item->startPos());
-
item->baseClip()->addReference();
m_document->updateClip(item->baseClip()->getId());
setDocumentModified();
bool success = m_document->renderer()->mltResizeClipEnd(clipinfo, info.endPos - info.startPos);
if (success) {
item->resizeEnd((int) info.endPos.frames(m_document->fps()));
-
- updatePanZoom(item);
-
setDocumentModified();
} else {
emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
return parameters;
}
-void CustomTrackView::updatePanZoom(ClipItem* item, GenTime cutPos)
-{
- QList <int> effects = item->updatePanZoom(m_document->width(), m_document->height(), cutPos.frames(m_document->fps()));
-
- for (int i = 0; i < effects.count(); ++i) {
- if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - item->track(), item->startPos(), getEffectArgs(item->effectAt(effects.at(i)))))
- emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
-
- // if effect is displayed, update the effect edit widget with new clip duration
- /*if (item->isSelected() && effects.at(i) == item->selectedEffectIndex())
- emit clipItemSelected(item, effects.at(i));*/
- }
- // update always, otherwise there might problems when resizing groups
- if (effects.count())
- emit clipItemSelected(item, item->selectedEffectIndex());
-}
-
void CustomTrackView::updateTrackNames(int track, bool added)
{
QList <TrackInfo> tracks = m_document->tracksList();
/** @brief Gets the effect parameters that will be passed to Mlt. */
EffectsParameterList getEffectArgs(const QDomElement effect);
- /** @brief Updates @param item's pan and zoom effect after resize or cut.
- * @param item clip whose pan and zoom effect should be updated
- * @param cutPos (optional) if clip was cut, cut position relative to the original's clip position */
- void updatePanZoom(ClipItem *item, GenTime cutPos = GenTime());
-
/** @brief Update Tracknames to fit again after track was added/deleted.
* @param track Number of track which was added/deleted
* @param added true = track added, false = track deleted