Commit 7fe1fcac authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWorkflow: Factorize effect loading code.

parent 07fe5c39
......@@ -184,10 +184,14 @@ EffectUser::loadEffects( const QDomElement &parent )
{
Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
if ( e != NULL )
addEffect( e, effect.attribute( "start" ).toLongLong(),
effect.attribute( "end" ).toLongLong() );
{
EffectHelper *helper = addEffect( e, effect.attribute( "start" ).toLongLong(),
effect.attribute( "end" ).toLongLong() );
if ( helper == NULL )
qCritical() << "Can't load effect" << effect.attribute( "name" );
}
else
qCritical() << "Renderer: Can't load effect" << effect.attribute( "name" );
qCritical() << "Can't load effect" << effect.attribute( "name" );
}
effect = effect.nextSiblingElement();
}
......
......@@ -59,6 +59,7 @@ class EffectUser : public QObject
void cleanEffects();
virtual qint64 length() const = 0;
virtual Type effectType() const = 0;
void loadEffects( const QDomElement &project );
protected:
EffectUser();
......@@ -69,7 +70,6 @@ class EffectUser : public QObject
//Filters:
quint32 *applyFilters( const Workflow::Frame *frame,
qint64 currentFrame, double time );
void loadEffects( const QDomElement &project );
void saveFilters( QXmlStreamWriter &project ) const;
//Mixers methods:
......
......@@ -295,27 +295,7 @@ MainWorkflow::loadProject( const QDomElement &root )
end.toLongLong(), chUuid );
track( type, trackId )->addClip( ch, startFrame.toLongLong() );
QDomElement effects = clip.firstChildElement( "effects" );
if ( effects.isNull() == false )
{
QDomElement effect = effects.firstChildElement( "effect" );
while ( effect.isNull() == false )
{
if ( effect.hasAttribute( "name" ) == true &&
effect.hasAttribute( "start" ) == true &&
effect.hasAttribute( "end" ) == true )
{
Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
qint64 start = effect.attribute( "start" ).toLongLong();
qint64 end = effect.attribute( "end" ).toLongLong();
if ( e != NULL )
ch->clipWorkflow()->addEffect( e, start, end );
else
qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
}
effect = effect.nextSiblingElement();
}
}
ch->clipWorkflow()->loadEffects( clip );
}
clip = clip.nextSiblingElement();
}
......
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