Commit 876a7b7e authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Renderer: Save the effects to the project file.

parent 55ae968a
......@@ -159,3 +159,23 @@ EffectsEngine::applyEffects( const EffectList &effects, Workflow::Frame* frame,
}
}
}
void
EffectsEngine::saveEffects( const EffectList &effects, QXmlStreamWriter &project )
{
if ( effects.size() <= 0 )
return ;
EffectsEngine::EffectList::const_iterator it = effects.begin();
EffectsEngine::EffectList::const_iterator ite = effects.end();
project.writeStartElement( "effects" );
while ( it != ite )
{
project.writeStartElement( "effect" );
project.writeAttribute( "name", (*it)->effect->effect()->name() );
project.writeAttribute( "start", QString::number( (*it)->start ) );
project.writeAttribute( "end", QString::number( (*it)->end ) );
project.writeEndElement();
++it;
}
project.writeEndElement();
}
......@@ -53,8 +53,10 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
bool loadEffect( const QString& fileName );
void browseDirectory( const QString& path );
static void applyEffects( const EffectList& effects,
static void applyEffects( const EffectList &effects,
Workflow::Frame *frame, qint64 currentFrame );
static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
private:
EffectsEngine();
~EffectsEngine();
......
......@@ -54,6 +54,7 @@ public:
TracksRuler* tracksRuler() { return m_tracksRuler; }
/// Return a pointer to the Timeline instance (singleton).
static Timeline* getInstance() { return m_instance; }
const WorkflowRenderer *renderer() const { return m_renderer; }
void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root );
......
......@@ -27,6 +27,8 @@
#include "project/GuiProjectManager.h"
#include "ProjectManager.h"
#include "SettingsManager.h"
#include "Timeline.h"
#include "WorkflowRenderer.h"
#include "Workspace.h"
#include <QDir>
......@@ -163,6 +165,7 @@ void ProjectManager::__saveProject( const QString &fileName )
Library::getInstance()->saveProject( project );
MainWorkflow::getInstance()->saveProject( project );
Timeline::getInstance()->renderer()->saveProject( project );
SettingsManager::getInstance()->save( project );
saveTimeline( project );
......
......@@ -393,6 +393,17 @@ WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) );
}
void
WorkflowRenderer::saveProject( QXmlStreamWriter &project ) const
{
project.writeStartElement( "renderer" );
{
QReadLocker lock( m_effectsLock );
EffectsEngine::getInstance()->saveEffects( m_effects, project );
}
project.writeEndElement();
}
/////////////////////////////////////////////////////////////////////
/////SLOTS :
/////////////////////////////////////////////////////////////////////
......
......@@ -133,6 +133,8 @@ class WorkflowRenderer : public GenericRenderer
void appendEffect( Effect* effect, qint64 start = 0, qint64 end = -1 );
void saveProject( QXmlStreamWriter &project ) const;
private:
/**
* \brief This is a subpart of the togglePlayPause( bool ) method
......
......@@ -228,21 +228,7 @@ void
VideoClipWorkflow::saveEffects( QXmlStreamWriter &project ) const
{
QReadLocker lock( m_effectsLock );
if ( m_effects.size() <= 0 )
return ;
EffectsEngine::EffectList::const_iterator it = m_effects.begin();
EffectsEngine::EffectList::const_iterator ite = m_effects.end();
project.writeStartElement( "effects" );
while ( it != ite )
{
project.writeStartElement( "effect" );
project.writeAttribute( "name", (*it)->effect->effect()->name() );
project.writeAttribute( "start", QString::number( (*it)->start ) );
project.writeAttribute( "end", QString::number( (*it)->end ) );
project.writeEndElement();
++it;
}
project.writeEndElement();
EffectsEngine::getInstance()->saveEffects( m_effects, project );
}
void
......
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