return m_keyframes.count();
}
+int AbstractClipItem::checkForSingleKeyframe()
+{
+ // Check if we have only one keyframe
+ if (!m_keyframes.isEmpty() && m_keyframes.count() == 1) {
+ int min = (int) cropStart().frames(m_fps);
+ int max = (int)(cropStart() + cropDuration()).frames(m_fps) - 1;
+ if (m_keyframes.contains(min)) {
+ // Add keyframe at end of clip to allow inserting a new keframe in between
+ m_keyframes[max] = m_keyframes.value(min);
+ return m_keyframes.value(min);
+ }
+ }
+ return -1;
+}
+
int AbstractClipItem::addKeyFrame(const GenTime &pos, const double value)
{
QRectF br = sceneBoundingRect();
* @param pos new Position
* @param value new Value */
void updateKeyFramePos(const GenTime &pos, const double value);
+ int checkForSingleKeyframe();
int addKeyFrame(const GenTime &pos, const double value);
bool hasKeyFrames() const;
int editedKeyFramePos() const;
} else*/ {
// add keyframe
GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
+ int single = m_dragItem->checkForSingleKeyframe();
int val = m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
ClipItem * item = static_cast <ClipItem *>(m_dragItem);
+ QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
+ if (single > -1) {
+ item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1, single);
+ }
//QString previous = item->keyframes(item->selectedEffectIndex());
- QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
//item->updateKeyframeEffect();
//QString next = item->keyframes(item->selectedEffectIndex());
void CustomTrackView::setDuration(int duration)
{
+ if (m_projectDuration == duration) return;
int diff = qAbs(duration - sceneRect().width());
if (diff * matrix().m11() > -50) {
if (matrix().m11() < 0.4) setSceneRect(0, 0, (duration + 100 / matrix().m11()), sceneRect().height());
Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profile, QWidget *parent) :
AbstractMonitor(id, manager, parent)
, render(NULL)
- , m_name(Kdenlive::noMonitor)
, m_currentClip(NULL)
, m_overlay(NULL)
, m_scale(1)
//virtual void paintEvent(QPaintEvent * event);
private:
- Kdenlive::MONITORID m_name;
DocClipBase *m_currentClip;
SmallRuler *m_ruler;
Overlay *m_overlay;
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
QDomNodeList playlists = doc.elementsByTagName("playlist");
- int duration = 300;
+ int duration = 1;
m_projectTracks = tracks.count();
int trackduration = 0;
QDomElement e;