2013-11-26 21:38:24 +01:00
|
|
|
// Python includes
|
|
|
|
#include <Python.h>
|
2017-08-01 15:42:36 +02:00
|
|
|
#undef B0
|
2013-11-26 21:38:24 +01:00
|
|
|
|
2013-11-30 12:42:08 +01:00
|
|
|
// Qt includes
|
2013-12-11 21:58:59 +01:00
|
|
|
#include <QResource>
|
2013-11-30 12:42:08 +01:00
|
|
|
#include <QMetaType>
|
2013-12-11 21:58:59 +01:00
|
|
|
#include <QFile>
|
|
|
|
#include <QDir>
|
2017-08-04 12:01:45 +02:00
|
|
|
#include <QMap>
|
2013-12-11 21:58:59 +01:00
|
|
|
|
|
|
|
// hyperion util includes
|
2016-10-09 22:22:17 +02:00
|
|
|
#include <utils/jsonschema/QJsonSchemaChecker.h>
|
2017-10-12 11:55:03 +02:00
|
|
|
#include <utils/JsonUtils.h>
|
2016-10-10 18:29:54 +02:00
|
|
|
#include <utils/Components.h>
|
2013-11-30 12:42:08 +01:00
|
|
|
|
2013-11-26 21:38:24 +01:00
|
|
|
// effect engine includes
|
2013-11-24 16:10:48 +01:00
|
|
|
#include <effectengine/EffectEngine.h>
|
2018-12-27 23:11:32 +01:00
|
|
|
#include <effectengine/Effect.h>
|
|
|
|
#include <effectengine/EffectModule.h>
|
2016-06-12 22:27:24 +02:00
|
|
|
#include "HyperionConfig.h"
|
2013-11-24 16:10:48 +01:00
|
|
|
|
2016-10-09 22:22:17 +02:00
|
|
|
EffectEngine::EffectEngine(Hyperion * hyperion, const QJsonObject & jsonEffectConfig)
|
2016-08-08 00:17:00 +02:00
|
|
|
: _hyperion(hyperion)
|
2016-11-20 18:41:10 +01:00
|
|
|
, _effectConfig(jsonEffectConfig)
|
2016-08-08 00:17:00 +02:00
|
|
|
, _availableEffects()
|
|
|
|
, _activeEffects()
|
|
|
|
, _log(Logger::getInstance("EFFECTENGINE"))
|
2013-11-24 16:10:48 +01:00
|
|
|
{
|
2017-10-13 17:49:29 +02:00
|
|
|
|
2016-09-13 11:51:16 +02:00
|
|
|
Q_INIT_RESOURCE(EffectEngine);
|
2013-11-29 23:22:49 +01:00
|
|
|
qRegisterMetaType<std::vector<ColorRgb>>("std::vector<ColorRgb>");
|
2018-12-27 23:11:32 +01:00
|
|
|
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
|
2016-10-10 18:29:54 +02:00
|
|
|
qRegisterMetaType<hyperion::Components>("hyperion::Components");
|
2013-11-29 23:22:49 +01:00
|
|
|
|
2013-11-24 16:10:48 +01:00
|
|
|
// connect the Hyperion channel clear feedback
|
|
|
|
connect(_hyperion, SIGNAL(channelCleared(int)), this, SLOT(channelCleared(int)));
|
|
|
|
connect(_hyperion, SIGNAL(allChannelsCleared()), this, SLOT(allChannelsCleared()));
|
|
|
|
|
|
|
|
// read all effects
|
2016-11-20 18:41:10 +01:00
|
|
|
readEffects();
|
2013-11-24 16:10:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EffectEngine::~EffectEngine()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-04-24 17:07:31 +02:00
|
|
|
const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
|
|
|
|
{
|
|
|
|
_availableActiveEffects.clear();
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-04-24 17:07:31 +02:00
|
|
|
for (Effect * effect : _activeEffects)
|
|
|
|
{
|
|
|
|
ActiveEffectDefinition activeEffectDefinition;
|
2017-08-04 12:01:45 +02:00
|
|
|
activeEffectDefinition.script = effect->getScript();
|
|
|
|
activeEffectDefinition.name = effect->getName();
|
2016-04-24 17:07:31 +02:00
|
|
|
activeEffectDefinition.priority = effect->getPriority();
|
2017-08-04 12:01:45 +02:00
|
|
|
activeEffectDefinition.timeout = effect->getTimeout();
|
|
|
|
activeEffectDefinition.args = effect->getArgs();
|
2016-04-24 17:07:31 +02:00
|
|
|
_availableActiveEffects.push_back(activeEffectDefinition);
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-04-24 17:07:31 +02:00
|
|
|
return _availableActiveEffects;
|
|
|
|
}
|
|
|
|
|
2018-12-27 23:11:32 +01:00
|
|
|
void EffectEngine::cacheRunningEffects()
|
|
|
|
{
|
|
|
|
_cachedActiveEffects.clear();
|
|
|
|
|
|
|
|
for (Effect * effect : _activeEffects)
|
|
|
|
{
|
|
|
|
ActiveEffectDefinition activeEffectDefinition;
|
|
|
|
activeEffectDefinition.script = effect->getScript();
|
|
|
|
activeEffectDefinition.name = effect->getName();
|
|
|
|
activeEffectDefinition.priority = effect->getPriority();
|
|
|
|
activeEffectDefinition.timeout = effect->getTimeout();
|
|
|
|
activeEffectDefinition.args = effect->getArgs();
|
|
|
|
_cachedActiveEffects.push_back(activeEffectDefinition);
|
|
|
|
channelCleared(effect->getPriority());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectEngine::startCachedEffects()
|
|
|
|
{
|
|
|
|
for (const auto & def : _cachedActiveEffects)
|
|
|
|
{
|
|
|
|
// the smooth cfg AND origin are ignored for this start!
|
|
|
|
runEffect(def.name, def.args, def.priority, def.timeout, def.script);
|
|
|
|
}
|
|
|
|
_cachedActiveEffects.clear();
|
|
|
|
}
|
|
|
|
|
2016-09-13 11:51:16 +02:00
|
|
|
bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effectConfigFile, EffectDefinition & effectDefinition)
|
2013-12-11 21:58:59 +01:00
|
|
|
{
|
2016-09-13 11:51:16 +02:00
|
|
|
QString fileName = path + QDir::separator() + effectConfigFile;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-10-12 11:55:03 +02:00
|
|
|
// Read and parse the effect json config file
|
|
|
|
QJsonObject configEffect;
|
|
|
|
if(!JsonUtils::readFile(fileName, configEffect, _log))
|
2013-12-11 21:58:59 +01:00
|
|
|
return false;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-10-09 22:22:17 +02:00
|
|
|
Q_INIT_RESOURCE(EffectEngine);
|
2017-10-12 11:55:03 +02:00
|
|
|
// validate effect config with effect schema(path)
|
|
|
|
if(!JsonUtils::validate(fileName, configEffect, ":effect-schema", _log))
|
2013-12-11 21:58:59 +01:00
|
|
|
return false;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-10-12 11:55:03 +02:00
|
|
|
// setup the definition
|
2016-11-18 18:39:21 +01:00
|
|
|
effectDefinition.file = fileName;
|
2017-10-12 11:55:03 +02:00
|
|
|
QJsonObject config = configEffect;
|
2016-10-09 22:22:17 +02:00
|
|
|
QString scriptName = config["script"].toString();
|
|
|
|
effectDefinition.name = config["name"].toString();
|
|
|
|
if (scriptName.isEmpty())
|
2016-09-13 11:51:16 +02:00
|
|
|
return false;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-10-24 23:52:53 +02:00
|
|
|
QFile fileInfo(scriptName);
|
2016-09-13 11:51:16 +02:00
|
|
|
|
2016-10-09 22:22:17 +02:00
|
|
|
if (scriptName.mid(0, 1) == ":" )
|
2016-10-24 23:52:53 +02:00
|
|
|
{
|
|
|
|
(!fileInfo.exists())
|
|
|
|
? effectDefinition.script = ":/effects/"+scriptName.mid(1)
|
|
|
|
: effectDefinition.script = scriptName;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
(!fileInfo.exists())
|
2017-08-04 12:01:45 +02:00
|
|
|
? effectDefinition.script = path + QDir::separator() + scriptName
|
2016-10-24 23:52:53 +02:00
|
|
|
: effectDefinition.script = scriptName;
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-10-09 22:22:17 +02:00
|
|
|
effectDefinition.args = config["args"].toObject();
|
2017-08-04 12:01:45 +02:00
|
|
|
effectDefinition.smoothCfg = SMOOTHING_MODE_PAUSE;
|
|
|
|
if (effectDefinition.args["smoothing-custom-settings"].toBool())
|
|
|
|
{
|
2017-09-04 23:12:59 +02:00
|
|
|
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(
|
|
|
|
effectDefinition.args["smoothing-time_ms"].toInt(),
|
|
|
|
effectDefinition.args["smoothing-updateFrequency"].toDouble(),
|
|
|
|
0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(true);
|
2017-08-04 12:01:45 +02:00
|
|
|
}
|
2013-12-11 21:58:59 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-10-24 23:52:53 +02:00
|
|
|
bool EffectEngine::loadEffectSchema(const QString &path, const QString &effectSchemaFile, EffectSchema & effectSchema)
|
|
|
|
{
|
|
|
|
QString fileName = path + "schema/" + QDir::separator() + effectSchemaFile;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-10-12 11:55:03 +02:00
|
|
|
// Read and parse the effect schema file
|
|
|
|
QJsonObject schemaEffect;
|
|
|
|
if(!JsonUtils::readFile(fileName, schemaEffect, _log))
|
2016-10-24 23:52:53 +02:00
|
|
|
return false;
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-10-12 11:55:03 +02:00
|
|
|
// setup the definition
|
|
|
|
QString scriptName = schemaEffect["script"].toString();
|
2016-10-24 23:52:53 +02:00
|
|
|
effectSchema.schemaFile = fileName;
|
|
|
|
fileName = path + QDir::separator() + scriptName;
|
|
|
|
QFile pyFile(fileName);
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-10-24 23:52:53 +02:00
|
|
|
if (scriptName.isEmpty() || !pyFile.open(QIODevice::ReadOnly))
|
|
|
|
{
|
|
|
|
fileName = path + "schema/" + QDir::separator() + effectSchemaFile;
|
2017-10-12 11:55:03 +02:00
|
|
|
Error( _log, "Python script '%s' in effect schema '%s' could not be loaded", QSTRING_CSTR(scriptName), QSTRING_CSTR(fileName));
|
2016-10-24 23:52:53 +02:00
|
|
|
return false;
|
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-10-24 23:52:53 +02:00
|
|
|
pyFile.close();
|
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
effectSchema.pyFile = (scriptName.mid(0, 1) == ":" ) ? ":/effects/"+scriptName.mid(1) : path + QDir::separator() + scriptName;
|
2017-10-12 11:55:03 +02:00
|
|
|
effectSchema.pySchema = schemaEffect;
|
2016-10-24 23:52:53 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-20 18:41:10 +01:00
|
|
|
void EffectEngine::readEffects()
|
2013-12-01 14:09:01 +01:00
|
|
|
{
|
2016-11-20 18:41:10 +01:00
|
|
|
// clear all lists
|
|
|
|
_availableEffects.clear();
|
|
|
|
_effectSchemas.clear();
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-11-20 18:41:10 +01:00
|
|
|
// read all effects
|
|
|
|
const QJsonArray & paths = _effectConfig["paths"].toArray();
|
|
|
|
const QJsonArray & disabledEfx = _effectConfig["disable"].toArray();
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-11-20 18:41:10 +01:00
|
|
|
QStringList efxPathList;
|
|
|
|
efxPathList << ":/effects/";
|
|
|
|
QStringList disableList;
|
|
|
|
|
|
|
|
for(auto p : paths)
|
|
|
|
{
|
2017-10-12 11:55:03 +02:00
|
|
|
efxPathList << p.toString().replace("$ROOT",_hyperion->getRootPath());
|
2016-11-20 18:41:10 +01:00
|
|
|
}
|
|
|
|
for(auto efx : disabledEfx)
|
|
|
|
{
|
|
|
|
disableList << efx.toString();
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
QMap<QString, EffectDefinition> availableEffects;
|
|
|
|
for (const QString & path : efxPathList )
|
2016-11-20 18:41:10 +01:00
|
|
|
{
|
|
|
|
QDir directory(path);
|
2017-05-29 15:59:11 +02:00
|
|
|
if (!directory.exists())
|
|
|
|
{
|
|
|
|
if(directory.mkpath(path))
|
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
Warning(_log, "New Effect path \"%s\" created successfull", QSTRING_CSTR(path) );
|
2017-05-29 15:59:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
Warning(_log, "Failed to create Effect path \"%s\", please check permissions", QSTRING_CSTR(path) );
|
2017-05-29 15:59:11 +02:00
|
|
|
}
|
|
|
|
}
|
2017-05-29 21:34:47 +02:00
|
|
|
else
|
2016-11-20 18:41:10 +01:00
|
|
|
{
|
|
|
|
int efxCount = 0;
|
|
|
|
QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
|
2017-08-04 12:01:45 +02:00
|
|
|
for (const QString & filename : filenames)
|
2016-11-20 18:41:10 +01:00
|
|
|
{
|
|
|
|
EffectDefinition def;
|
|
|
|
if (loadEffectDefinition(path, filename, def))
|
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
InfoIf(availableEffects.find(def.name) != availableEffects.end(), _log,
|
2017-10-12 11:55:03 +02:00
|
|
|
"effect overload effect '%s' is now taken from '%s'", QSTRING_CSTR(def.name), QSTRING_CSTR(path) );
|
2016-11-20 18:41:10 +01:00
|
|
|
|
|
|
|
if ( disableList.contains(def.name) )
|
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
Info(_log, "effect '%s' not loaded, because it is disabled in hyperion config", QSTRING_CSTR(def.name));
|
2016-11-20 18:41:10 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
availableEffects[def.name] = def;
|
|
|
|
efxCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-04 12:01:45 +02:00
|
|
|
Info(_log, "%d effects loaded from directory %s", efxCount, QSTRING_CSTR(path));
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2016-11-20 18:41:10 +01:00
|
|
|
// collect effect schemas
|
|
|
|
efxCount = 0;
|
2017-10-12 11:55:03 +02:00
|
|
|
directory = path.endsWith("/") ? (path + "schema/") : (path + "/schema/");
|
2016-11-20 18:41:10 +01:00
|
|
|
QStringList pynames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
|
2017-08-04 12:01:45 +02:00
|
|
|
for (const QString & pyname : pynames)
|
2016-11-20 18:41:10 +01:00
|
|
|
{
|
|
|
|
EffectSchema pyEffect;
|
|
|
|
if (loadEffectSchema(path, pyname, pyEffect))
|
|
|
|
{
|
|
|
|
_effectSchemas.push_back(pyEffect);
|
|
|
|
efxCount++;
|
|
|
|
}
|
|
|
|
}
|
2017-08-04 12:01:45 +02:00
|
|
|
InfoIf(efxCount > 0, _log, "%d effect schemas loaded from directory %s", efxCount, QSTRING_CSTR((path + "schema/")));
|
2016-11-20 18:41:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
for(auto item : availableEffects)
|
2016-11-20 18:41:10 +01:00
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
_availableEffects.push_back(item);
|
2016-11-20 18:41:10 +01:00
|
|
|
}
|
2017-09-04 23:12:59 +02:00
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
ErrorIf(_availableEffects.size()==0, _log, "no effects found, check your effect directories");
|
2018-12-27 23:11:32 +01:00
|
|
|
|
|
|
|
emit effectListUpdated();
|
2013-12-01 14:09:01 +01:00
|
|
|
}
|
|
|
|
|
2017-03-01 15:23:53 +01:00
|
|
|
int EffectEngine::runEffect(const QString &effectName, int priority, int timeout, const QString &origin)
|
|
|
|
{
|
|
|
|
return runEffect(effectName, QJsonObject(), priority, timeout, "", origin);
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
int EffectEngine::runEffect(const QString &effectName, const QJsonObject &args, int priority, int timeout, const QString &pythonScript, const QString &origin, unsigned smoothCfg)
|
2013-11-24 16:10:48 +01:00
|
|
|
{
|
2017-08-04 12:01:45 +02:00
|
|
|
Info( _log, "run effect %s on channel %d", QSTRING_CSTR(effectName), priority);
|
2013-11-26 21:38:24 +01:00
|
|
|
|
2017-03-01 15:23:53 +01:00
|
|
|
if (pythonScript.isEmpty())
|
2013-12-01 14:09:01 +01:00
|
|
|
{
|
2016-10-30 22:59:45 +01:00
|
|
|
const EffectDefinition * effectDefinition = nullptr;
|
|
|
|
for (const EffectDefinition & e : _availableEffects)
|
2013-12-01 14:09:01 +01:00
|
|
|
{
|
2016-10-30 22:59:45 +01:00
|
|
|
if (e.name == effectName)
|
|
|
|
{
|
|
|
|
effectDefinition = &e;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (effectDefinition == nullptr)
|
|
|
|
{
|
|
|
|
// no such effect
|
2018-12-27 23:11:32 +01:00
|
|
|
Error(_log, "Effect %s not found", QSTRING_CSTR(effectName));
|
2016-10-30 22:59:45 +01:00
|
|
|
return -1;
|
2013-12-01 14:09:01 +01:00
|
|
|
}
|
2013-11-30 00:28:04 +01:00
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
return runEffectScript(effectDefinition->script, effectName, (args.isEmpty() ? effectDefinition->args : args), priority, timeout, origin, effectDefinition->smoothCfg);
|
2017-03-01 15:23:53 +01:00
|
|
|
}
|
2017-08-04 12:01:45 +02:00
|
|
|
return runEffectScript(pythonScript, effectName, args, priority, timeout, origin, smoothCfg);
|
2013-12-01 16:35:45 +01:00
|
|
|
}
|
|
|
|
|
2017-08-04 12:01:45 +02:00
|
|
|
int EffectEngine::runEffectScript(const QString &script, const QString &name, const QJsonObject &args, int priority, int timeout, const QString & origin, unsigned smoothCfg)
|
2013-12-01 16:35:45 +01:00
|
|
|
{
|
2013-11-26 21:38:24 +01:00
|
|
|
// clear current effect on the channel
|
|
|
|
channelCleared(priority);
|
|
|
|
|
|
|
|
// create the effect
|
2018-12-27 23:11:32 +01:00
|
|
|
Effect * effect = new Effect(_hyperion, priority, timeout, script, name, args);
|
|
|
|
connect(effect, &Effect::setInput, _hyperion, &Hyperion::setInput, Qt::QueuedConnection);
|
|
|
|
connect(effect, &Effect::setInputImage, _hyperion, &Hyperion::setInputImage, Qt::QueuedConnection);
|
2017-10-12 11:55:03 +02:00
|
|
|
connect(effect, &QThread::finished, this, &EffectEngine::effectFinished);
|
2013-11-26 21:38:24 +01:00
|
|
|
_activeEffects.push_back(effect);
|
|
|
|
|
|
|
|
// start the effect
|
2018-12-27 23:11:32 +01:00
|
|
|
_hyperion->registerInput(priority, hyperion::COMP_EFFECT, origin, name ,smoothCfg);
|
2013-11-26 21:38:24 +01:00
|
|
|
effect->start();
|
|
|
|
|
2013-11-24 16:10:48 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectEngine::channelCleared(int priority)
|
|
|
|
{
|
2013-11-26 21:38:24 +01:00
|
|
|
for (Effect * effect : _activeEffects)
|
|
|
|
{
|
|
|
|
if (effect->getPriority() == priority)
|
|
|
|
{
|
2018-12-27 23:11:32 +01:00
|
|
|
effect->setInteruptionFlag();
|
2013-11-26 21:38:24 +01:00
|
|
|
}
|
|
|
|
}
|
2013-11-24 16:10:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectEngine::allChannelsCleared()
|
|
|
|
{
|
2013-11-26 21:38:24 +01:00
|
|
|
for (Effect * effect : _activeEffects)
|
|
|
|
{
|
2017-10-12 11:55:03 +02:00
|
|
|
if (effect->getPriority() != 254)
|
|
|
|
{
|
2018-12-27 23:11:32 +01:00
|
|
|
effect->setInteruptionFlag();
|
2017-10-12 11:55:03 +02:00
|
|
|
}
|
2013-11-26 21:38:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-12 11:55:03 +02:00
|
|
|
void EffectEngine::effectFinished()
|
2013-11-26 21:38:24 +01:00
|
|
|
{
|
2017-10-12 11:55:03 +02:00
|
|
|
Effect* effect = qobject_cast<Effect*>(sender());
|
2018-12-27 23:11:32 +01:00
|
|
|
if (!effect->hasInteruptionFlag())
|
2013-11-30 15:54:47 +01:00
|
|
|
{
|
|
|
|
// effect stopped by itself. Clear the channel
|
|
|
|
_hyperion->clear(effect->getPriority());
|
|
|
|
}
|
|
|
|
|
2016-06-23 13:48:49 +02:00
|
|
|
Info( _log, "effect finished");
|
2013-11-26 21:38:24 +01:00
|
|
|
for (auto effectIt = _activeEffects.begin(); effectIt != _activeEffects.end(); ++effectIt)
|
|
|
|
{
|
|
|
|
if (*effectIt == effect)
|
|
|
|
{
|
|
|
|
_activeEffects.erase(effectIt);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// cleanup the effect
|
|
|
|
effect->deleteLater();
|
2013-11-24 16:10:48 +01:00
|
|
|
}
|