From 06afe067744c7a9de8d1e7d5f3abb2a46218089f Mon Sep 17 00:00:00 2001 From: redPanther Date: Tue, 24 May 2016 22:14:45 +0200 Subject: [PATCH] better output for effect path loading (#652) * better output for effect path loading * effectengine: error when no efx available Former-commit-id: 7724e56850ef9f9a703fb41e82baf88e5534f492 --- libsrc/effectengine/EffectEngine.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index 97492a85..c5a554cd 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -35,23 +35,28 @@ EffectEngine::EffectEngine(Hyperion * hyperion, const Json::Value & jsonEffectCo { const std::string & path = paths[i].asString(); QDir directory(QString::fromStdString(path)); - if (!directory.exists()) + if (directory.exists()) { - std::cerr << "EFFECTENGINE ERROR: Effect directory can not be loaded: " << path << std::endl; - continue; - } - - QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase); - foreach (const QString & filename, filenames) - { - EffectDefinition def; - if (loadEffectDefinition(path, filename.toStdString(), def)) + int efxCount = 0; + QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase); + foreach (const QString & filename, filenames) { - _availableEffects.push_back(def); + EffectDefinition def; + if (loadEffectDefinition(path, filename.toStdString(), def)) + { + _availableEffects.push_back(def); + efxCount++; + } } + std::cerr << "EFFECTENGINE INFO: " << efxCount << " effects loaded from directory " << path << std::endl; } } + if (_availableEffects.size() == 0) + { + std::cerr << "EFFECTENGINE ERROR: no effects found, check your effect directories" << std::endl; + } + // initialize the python interpreter std::cout << "EFFECTENGINE INFO: Initializing Python interpreter" << std::endl; Effect::registerHyperionExtensionModule();