m_document->renderer()->mltInsertClip(info, item->xml(), item->baseClip()->producer(item->track()));
item->setSelected(true);
}
- m_document->setModified(true);
+ m_document->setModified(true);
m_changeSpeedAction->setEnabled(hasVideoClip);
m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
groupSelectedItems(true);
m_commandStack->push(moveCommand);
} else {
// undo last move and emit error message
- MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
- m_commandStack->push(command);
+ bool snap = KdenliveSettings::snaptopoints();
+ KdenliveSettings::setSnaptopoints(false);
+ item->setPos((int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItemInfo.track * m_tracksHeight + 1));
+ KdenliveSettings::setSnaptopoints(snap);
emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(m_dragItemInfo.startPos.frames(m_document->fps()))), ErrorMessage);
}
m_document->setModified(true);
int i;
for (i = 0; i < m_baseTrackProducers.count(); i++)
if (m_baseTrackProducers.at(i) != NULL) break;
+
if (i >= m_baseTrackProducers.count()) return NULL;
m_baseTrackProducers[track] = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource"));
+
+ // special case for placeholder clips
+ if (m_baseTrackProducers[track] == NULL) return NULL;
+
if (m_properties.contains("force_aspect_ratio")) m_baseTrackProducers[track]->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble());
if (m_properties.contains("threads")) m_baseTrackProducers[track]->set("threads", m_properties.value("threads").toInt());
if (m_properties.contains("video_index")) m_baseTrackProducers[track]->set("video_index", m_properties.value("video_index").toInt());
{
ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
if (!item) {
- emit addClip();
- return;
+ emit addClip();
+ return;
}
if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
if (item->isGroup()) {
kDebug() << "////// LOOKING FOR CLIP TO MOVE, INDEX: " << clipIndex;
bool checkLength = false;
if (endTrack == startTrack) {
- //mlt_service_lock(service.get_service());
Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
if (!trackPlaylist.is_blank_at(moveEnd) || clipProducer.is_blank()) {
// error, destination is not empty
+ if (!trackPlaylist.is_blank_at(moveEnd)) trackPlaylist.insert_at(moveStart, clipProducer, 1);
//int ix = trackPlaylist.get_clip_index_at(moveEnd);
kDebug() << "// ERROR MOVING CLIP TO : " << moveEnd;
mlt_service_unlock(m_mltConsumer->get_service());
QString currentid = clipProducer.parent().get("id");
if (serv == "framebuffer" || currentid.endsWith("_video")) {
clip = &clipProducer;
- } else clip = prod->cut(clipProducer.get_in(), clipProducer.get_out());
+ } else {
+ if (prod == NULL) {
+ // Special case: prod is null when using placeholder clips.
+ // in that case, use the producer existing in playlist. Note that
+ // it will bypass the one producer per track logic and might cause
+ // Sound cracks if clip is moved so that it overlaps another copy of itself
+ clip = clipProducer.cut(clipProducer.get_in(), clipProducer.get_out());
+ } else clip = prod->cut(clipProducer.get_in(), clipProducer.get_out());
+ }
// move all effects to the correct producer
Mlt::Service clipService(clipProducer.get_service());