Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
29df1929
Commit
29df1929
authored
Aug 05, 2021
by
Julius Künzel
Browse files
Add dependency system for assets to depend on other assets
parent
ad7cbbb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/assets/abstractassetsrepository.ipp
View file @
29df1929
...
...
@@ -21,6 +21,7 @@
#include "xml/xml.hpp"
#include "kdenlivesettings.h"
#include "core.h"
#include <QDir>
#include <QFile>
...
...
@@ -94,6 +95,7 @@ template <typename AssetType> void AbstractAssetsRepository<AssetType>::init()
}
// We add the custom assets
QStringList missingDependency;
for (const auto &custom : customAssets) {
// Custom assets should override default ones
if (emptyMetaAssets.contains(custom.second.mltId)) {
...
...
@@ -101,8 +103,39 @@ template <typename AssetType> void AbstractAssetsRepository<AssetType>::init()
emptyMetaAssets.removeAll(custom.second.mltId);
}
m_assets[custom.first] = custom.second;
QString dependency = custom.second.xml.attribute(QStringLiteral("dependency"), QString());
if(!dependency.isEmpty()) {
bool found = false;
QScopedPointer<Mlt::Properties> effects(pCore->getMltRepository()->filters());
for(int i = 0; i < effects->count(); ++i) {
if(effects->get_name(i) == dependency) {
found = true;
break;
}
}
if(!found) {
QScopedPointer<Mlt::Properties> transitions(pCore->getMltRepository()->transitions());
for(int i = 0; i < transitions->count(); ++i) {
if(transitions->get_name(i) == dependency) {
found = true;
break;
}
}
}
if(!found) {
// asset depends on another asset that is invalid so remove this asset too
missingDependency << custom.first;
qDebug() << "Asset" << custom.first << "has invalid dependency" << dependency << "and is going to be removed";
}
}
}
// Remove really invalid assets
emptyMetaAssets << missingDependency;
emptyMetaAssets.removeDuplicates();
for (const auto &invalid : emptyMetaAssets) {
m_assets.erase(invalid);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment