Commit 116530f8 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Workflow: When adding an effect, return its instance.

parent 9e8d8b75
......@@ -26,7 +26,6 @@
#include "vlmc.h"
#include "Clip.h"
#include "ClipHelper.h"
#include "EffectsEngine/EffectsEngine.h"
#include "Library.h"
#include "MainWorkflow.h"
#include "TrackWorkflow.h"
......@@ -82,10 +81,10 @@ MainWorkflow::addClip( ClipHelper *clipHelper, unsigned int trackId,
emit clipAdded( clipHelper, trackId, start, trackType );
}
void
MainWorkflow::addEffect( Effect *effect, quint32 trackId, const QUuid &uuid, Workflow::TrackType type )
EffectsEngine::FilterHelper*
MainWorkflow::addFilter( Effect *effect, quint32 trackId, const QUuid &uuid, Workflow::TrackType type )
{
m_tracks[type]->addEffect( effect, trackId, uuid );
return m_tracks[type]->addEffect( effect, trackId, uuid );
}
void
......@@ -344,7 +343,7 @@ MainWorkflow::loadProject( const QDomElement &root )
{
Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
if ( e != NULL )
addEffect( e, trackId, uuid, type );
addFilter( e, trackId, uuid, type );
else
qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
}
......
......@@ -24,6 +24,7 @@
#ifndef MAINWORKFLOW_H
#define MAINWORKFLOW_H
#include "EffectsEngine.h"
#include "Singleton.hpp"
#include <QXmlStreamWriter>
#include "Types.h"
......@@ -74,8 +75,8 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
Workflow::TrackType type, bool informGui );
void addEffect( Effect* effect, quint32 trackId, const QUuid &uuid,
Workflow::TrackType type );
EffectsEngine::FilterHelper *addFilter( Effect* effect, quint32 trackId,
const QUuid &uuid, Workflow::TrackType type );
/**
* \brief Initialize the workflow for the render.
......
......@@ -59,10 +59,10 @@ TrackHandler::addClip( ClipHelper* ch, unsigned int trackId, qint64 start )
m_length = m_tracks[trackId]->getLength();
}
void
EffectsEngine::FilterHelper*
TrackHandler::addEffect( Effect *effect, quint32 trackId, const QUuid &uuid )
{
m_tracks[trackId]->addEffect( effect, uuid );
return m_tracks[trackId]->addEffect( effect, uuid );
}
void
......
......@@ -48,7 +48,7 @@ class TrackHandler : public QObject
*/
void addClip( ClipHelper* clip, unsigned int trackId, qint64 start );
void addEffect( Effect *effect, quint32 trackId, const QUuid &uuid );
EffectsEngine::FilterHelper *addEffect( Effect *effect, quint32 trackId, const QUuid &uuid );
/**
* Returns the number of tracks in this handler
*/
......
......@@ -90,7 +90,7 @@ TrackWorkflow::addClip( ClipWorkflow* cw, qint64 start )
computeLength();
}
void
EffectsEngine::FilterHelper*
TrackWorkflow::addEffect( Effect *effect, const QUuid &uuid )
{
QMap<qint64, ClipWorkflow*>::const_iterator it = m_clips.begin();
......@@ -99,9 +99,10 @@ TrackWorkflow::addEffect( Effect *effect, const QUuid &uuid )
while ( it != end )
{
if ( it.value()->getClipHelper()->clip()->fullId() == uuid )
it.value()->appendEffect( effect );
return it.value()->appendEffect( effect );
++it;
}
return NULL;
}
//Must be called from a thread safe method (m_clipsLock locked)
......
......@@ -59,7 +59,7 @@ class TrackWorkflow : public QObject
ClipWorkflow* removeClipWorkflow( const QUuid& id );
void addClip( ClipHelper*, qint64 start );
void addClip( ClipWorkflow*, qint64 start );
void addEffect( Effect *effect, const QUuid &uuid );
EffectsEngine::FilterHelper *addEffect( Effect *effect, const QUuid &uuid );
qint64 getClipPosition( const QUuid& uuid ) const;
ClipHelper *getClipHelper( const QUuid& uuid );
......
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