Commit 2faf8c45 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix timeline preview not disabled on render.

Related to #477
parent bca65171
Pipeline #11711 passed with stage
in 25 minutes and 4 seconds
......@@ -133,6 +133,7 @@ bool PreviewManager::buildPreviewTrack()
// Create overlay track
qDebug() << "/// BUILDING PREVIEW TRACK\n----------------------\n----------------__";
m_previewTrack = new Mlt::Playlist(pCore->getCurrentProfile()->profile());
m_previewTrack->set("id", "timeline_preview");
m_tractor->lock();
reconnectTrack();
m_tractor->unlock();
......@@ -206,14 +207,14 @@ void PreviewManager::reconnectTrack()
m_tractor->insert_track(*m_previewTrack, m_previewTrackIndex);
std::shared_ptr<Mlt::Producer> tk(m_tractor->track(m_previewTrackIndex));
tk->set("hide", 2);
tk->set("id", "timeline_preview");
//tk->set("id", "timeline_preview");
increment++;
}
if (m_overlayTrack) {
m_tractor->insert_track(*m_overlayTrack, m_previewTrackIndex + increment);
std::shared_ptr<Mlt::Producer> tk(m_tractor->track(m_previewTrackIndex + increment));
tk->set("hide", 2);
tk->set("id", "timeline_overlay");
//tk->set("id", "timeline_overlay");
}
}
......@@ -237,6 +238,30 @@ void PreviewManager::disconnectTrack()
m_previewTrackIndex = -1;
}
void PreviewManager::disable()
{
if (m_previewTrackIndex > -1) {
if (m_previewTrack) {
m_previewTrack->set("hide", 3);
}
if (m_overlayTrack) {
m_overlayTrack->set("hide", 3);
}
}
}
void PreviewManager::enable()
{
if (m_previewTrackIndex > -1) {
if (m_previewTrack) {
m_previewTrack->set("hide", 1);
}
if (m_overlayTrack) {
m_overlayTrack->set("hide", 1);
}
}
}
bool PreviewManager::loadParams()
{
KdenliveDoc *doc = pCore->currentDoc();
......@@ -732,6 +757,7 @@ void PreviewManager::corruptedChunk(int frame, const QString &fileName)
int PreviewManager::setOverlayTrack(Mlt::Playlist *overlay)
{
m_overlayTrack = overlay;
m_overlayTrack->set("id", "timeline_overlay");
reconnectTrack();
return m_previewTrackIndex;
}
......
......@@ -126,6 +126,10 @@ private:
void reloadChunks(const QVariantList chunks);
/** @brief: A chunk failed to render, abort. */
void corruptedChunk(int workingPreview, const QString &fileName);
/** @brief: Re-enable timeline preview track. */
void enable();
/** @brief: Temporarily disable timeline preview track. */
void disable();
private slots:
/** @brief: To avoid filling the hard drive, remove preview undo history after 5 steps. */
......
......@@ -1372,16 +1372,16 @@ void TimelineController::initializePreview()
bool TimelineController::hasPreviewTrack() const
{
return (m_timelinePreview && m_timelinePreview->hasOverlayTrack());
return (m_timelinePreview && (m_timelinePreview->hasOverlayTrack() || m_timelinePreview->hasPreviewTrack()));
}
void TimelineController::updatePreviewConnection(bool enable)
{
if (m_timelinePreview) {
if (enable) {
m_timelinePreview->reconnectTrack();
m_timelinePreview->enable();
} else {
m_timelinePreview->disconnectTrack();
m_timelinePreview->disable();
}
}
}
......
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