forked from qt-creator/qt-creator
EffectMaker: Block adding same effect node twice
The actual blocking is done at uniform level, as the problem of having same effect node twice is duplicate uniforms. Fixes: QDS-11470 Change-Id: I77b15b4a207efaebff39b4f6b1700d70262abcdb Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "effectnode.h"
|
||||
#include "compositionnode.h"
|
||||
#include "uniform.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@@ -22,6 +24,12 @@ EffectNode::EffectNode(const QString &qenPath)
|
||||
iconPath = QStringLiteral("%1/%2").arg(parentDir.path(), "placeholder.svg");
|
||||
}
|
||||
m_iconPath = QUrl::fromLocalFile(iconPath);
|
||||
|
||||
CompositionNode node({}, qenPath);
|
||||
const QList<Uniform *> uniforms = node.uniforms();
|
||||
|
||||
for (const Uniform *uniform : uniforms)
|
||||
m_uniformNames.insert(uniform->name());
|
||||
}
|
||||
|
||||
QString EffectNode::name() const
|
||||
@@ -39,5 +47,18 @@ QString EffectNode::qenPath() const
|
||||
return m_qenPath;
|
||||
}
|
||||
|
||||
void EffectNode::setCanBeAdded(bool enabled)
|
||||
{
|
||||
if (enabled != m_canBeAdded) {
|
||||
m_canBeAdded = enabled;
|
||||
emit canBeAddedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectNode::hasUniform(const QString &name)
|
||||
{
|
||||
return m_uniformNames.contains(name);
|
||||
}
|
||||
|
||||
} // namespace EffectMaker
|
||||
|
||||
|
||||
Reference in New Issue
Block a user