forked from qt-creator/qt-creator
EffectComposer: Check property usage in customValues of other properties
Properties may be used in customValues of other properties instead of being used in shaders, so need to check for those as well to find if property is in use. Fixes: QDS-14236 Change-Id: Ifc272d5fdc02596484dbb0b9d04a1b9e02d4ad7f Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -290,6 +290,16 @@ void CompositionNode::updateAreUniformsInUse(bool force)
|
||||
if (force || m_InUseCheckNeeded) {
|
||||
const QString matchTemplate("\\b%1\\b");
|
||||
const QList<Uniform *> uniList = uniforms();
|
||||
|
||||
// Some of the uniforms may only be used by customValue properties
|
||||
QString customValues;
|
||||
for (const Uniform *u : uniList) {
|
||||
if (!u->customValue().isEmpty()) {
|
||||
customValues.append(u->customValue());
|
||||
customValues.append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < uniList.size(); ++i) {
|
||||
Uniform *u = uniList[i];
|
||||
QString pattern = matchTemplate.arg(QRegularExpression::escape(u->name()));
|
||||
@@ -298,6 +308,8 @@ void CompositionNode::updateAreUniformsInUse(bool force)
|
||||
found = regex.match(m_fragmentCode).hasMatch();
|
||||
if (!found)
|
||||
found = regex.match(m_vertexCode).hasMatch();
|
||||
if (!found && !customValues.isEmpty())
|
||||
found = regex.match(customValues).hasMatch();
|
||||
m_uniformsModel.setData(m_uniformsModel.index(i), found,
|
||||
EffectComposerUniformsModel::IsInUse);
|
||||
}
|
||||
|
Reference in New Issue
Block a user