Commit 73b90f4f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWorkflow: Don't fallback on library clips when requesting a clip instance

Have a specific getter when we actually want the library clip to be
returned.
parent 0403f58f
......@@ -186,7 +186,7 @@ Item {
}
}
else {
var newClipInfo = workflow.clipInfo( drag.getDataAsString( "vlmc/uuid" ) );
var newClipInfo = workflow.libraryClipInfo( drag.getDataAsString( "vlmc/uuid" ) );
currentUuid = "" + newClipInfo["libraryUuid"];
newClipInfo["position"] = ptof( drag.x );
if ( newClipInfo["audio"] ) {
......
......@@ -230,23 +230,26 @@ MainWorkflow::clipInfo( const QString& uuid )
h["filters"] = EffectHelper::toVariant( clip->input() );
return QJsonObject::fromVariantHash( h );
}
auto lClip = Core::instance()->library()->clip( uuid );
if ( lClip != nullptr )
{
auto h = lClip->toVariant().toHash();
h["length"] = (qint64)( lClip->input()->length() );
h["name"] = lClip->media()->title();
h["audio"] = lClip->formats().testFlag( Clip::Audio );
h["video"] = lClip->formats().testFlag( Clip::Video );
h["begin"] = lClip->begin();
h["end"] = lClip->end();
return QJsonObject::fromVariantHash( h );
}
return QJsonObject();
}
QJsonObject
MainWorkflow::libraryClipInfo( const QString& uuid )
{
auto c = Core::instance()->library()->clip( uuid );
if ( c == nullptr )
return {};
auto h = c->toVariant().toHash();
h["length"] = (qint64)( c->input()->length() );
h["name"] = c->media()->title();
h["audio"] = c->media()->hasAudioTracks();
h["video"] = c->media()->hasVideoTracks();
h["begin"] = c->begin();
h["end"] = c->end();
h["uuid"] = "libraryUuid";
return QJsonObject::fromVariantHash( h );
}
void
MainWorkflow::moveClip( const QString& uuid, quint32 trackId, qint64 startFrame )
{
......
......@@ -133,6 +133,9 @@ class MainWorkflow : public QObject
Q_INVOKABLE
QJsonObject clipInfo( const QString& uuid );
Q_INVOKABLE
QJsonObject libraryClipInfo( const QString& uuid );
Q_INVOKABLE
void moveClip( const QString& uuid, quint32 trackId, qint64 startFrame );
......
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