summaryrefslogtreecommitdiff
path: root/src/gui/util/qshadergraphloader.cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2017-07-05 16:16:10 +0200
committerSean Harmer <sean.harmer@kdab.com>2017-07-08 09:05:19 +0000
commit13ecd686b93a8c8d915301e95eb4f1a2626651de (patch)
tree8687acd48169aa222f68ca25792bcf995bec1be3 /src/gui/util/qshadergraphloader.cpp
parent5667c870fb526b2bf0a5d4097e0f166b546550f0 (diff)
downloadqtbase-13ecd686b93a8c8d915301e95eb4f1a2626651de.tar.gz
Add support for node parameters in QShaderGraphLoader
Now the parameters from the prototypes are used as default values and the graph file can overload them. Change-Id: I9a8a73963c7e578bd0a34e96f76f147a12224f4f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/util/qshadergraphloader.cpp')
-rw-r--r--src/gui/util/qshadergraphloader.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp
index d246654b9c..717a9e18d9 100644
--- a/src/gui/util/qshadergraphloader.cpp
+++ b/src/gui/util/qshadergraphloader.cpp
@@ -152,6 +152,15 @@ void QShaderGraphLoader::load()
auto node = m_prototypes.value(type);
node.setUuid(uuid);
+
+ const auto parametersValue = nodeObject.value(QStringLiteral("parameters"));
+ if (parametersValue.isObject()) {
+ const auto parametersObject = parametersValue.toObject();
+ for (const auto &parameterName : parametersObject.keys()) {
+ node.setParameter(parameterName, parametersObject.value(parameterName).toVariant());
+ }
+ }
+
m_graph.addNode(node);
}