Commit 94e5c9ad authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

SequenceWorkflow: Fix project loading

Clip linking isn't available yet
parent 2180dfc3
......@@ -206,7 +206,6 @@ Clip::toVariant() const
}
else
h.insert( "linked", false );
h.insert( "filters", EffectHelper::toVariant( m_input.get() ) );
return QVariant( h );
}
......@@ -230,14 +229,3 @@ Clip::input()
{
return m_input.get();
}
void
Clip::loadFilters( const QVariantMap& m )
{
if ( m.contains( "filters" ) )
{
const auto& filters = m["filters"].toList();
for ( const auto& f : filters )
EffectHelper::loadFromVariant( f, input() );
}
}
......@@ -115,9 +115,6 @@ class Clip : public Workflow::Helper
Backend::IInput* input();
//FIXME: This shouldn't be represented in the Library
void loadFilters(const QVariantMap& v );
private:
QWeakPointer<Media> m_media;
std::unique_ptr<Backend::IInput> m_input;
......
......@@ -232,9 +232,9 @@ Media::loadSubclip( const QVariantMap& m )
const auto& uuid = m["uuid"].toUuid();
const auto begin = m["begin"].toLongLong();
const auto end = m["end"].toLongLong();
const auto formats = m["formats"].toInt();
auto clip = QSharedPointer<Clip>( new Clip( sharedFromThis(), begin, end, uuid ) );
//FIXME: This shouldn't be loaded from the library
clip->loadFilters( m );
clip->setFormats( static_cast<Clip::Formats>( formats ) );
m_clips[uuid] = clip;
emit subclipAdded( clip );
......
......@@ -208,9 +208,13 @@ SequenceWorkflow::toVariant() const
auto clip = std::get<ClipTupleIndex::Clip>( it.value() );
auto trackId = std::get<ClipTupleIndex::TrackId>( it.value() );
auto position = std::get<ClipTupleIndex::Position>( it.value() );
auto h = clip->toVariant().toHash();
h.insert( "position", position );
h.insert( "trackId", trackId );
QVariantHash h {
{ "uuid", clip->uuid() },
{ "position", position },
{ "trackId", trackId },
{ "filters", EffectHelper::toVariant( clip->input() ) }
};
//FIXME: Missing linking informations
l << h;
}
QVariantHash h{ { "clips", l }, { "filters", EffectHelper::toVariant( m_multitrack ) } };
......@@ -222,31 +226,25 @@ SequenceWorkflow::loadFromVariant( const QVariant& variant )
{
for ( auto& var : variant.toMap()["clips"].toList() )
{
//FIXME!!!
auto m = var.toMap();
auto clip = Core::instance()->library()->clip( m["uuid"].toUuid() );
// auto m = var.toMap();
// auto parentClip = Core::instance()->library()->clip( m["parent"].toString() );
if ( clip == nullptr )
{
vlmcCritical() << "Couldn't find an acceptable parent to be added.";
continue;
}
// if ( parentClip == nullptr )
// {
// vlmcCritical() << "Couldn't find an acceptable parent to be added.";
// continue;
// }
addClip( clip, m["trackId"].toUInt(), m["position"].toLongLong() );
// auto c = std::make_shared<Clip>( parentClip, m["begin"].toLongLong(), m["end"].toLongLong() );
// c->setUuid( m["uuid"].toString() );
// c->setFormats( (Clip::Formats)m["formats"].toInt() );
auto isLinked = m["linked"].toBool();
clip->setLinked( isLinked );
if ( isLinked == true )
clip->setLinkedClipUuid( m["linkedClip"].toString() );
// addClip( c, m["trackId"].toUInt(), m["position"].toLongLong() );
EffectHelper::loadFromVariant( m["filters"], clip->input() );
// auto isLinked = m["linked"].toBool();
// c->setLinked( isLinked );
// if ( isLinked == true )
// c->setLinkedClipUuid( m["linkedClip"].toString() );
// EffectHelper::loadFromVariant( m["filters"], c->input() );
// emit Core::instance()->workflow()->clipAdded( c->uuid().toString() );
emit Core::instance()->workflow()->clipAdded( clip->uuid().toString() );
}
EffectHelper::loadFromVariant( variant.toMap()["filters"], m_multitrack );
}
......
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