added IDs to parameters for serialization

This commit is contained in:
itsmattkc
2019-08-13 17:22:32 +10:00
parent e9702aeb52
commit 02ea535c8a
13 changed files with 59 additions and 17 deletions
+18
View File
@@ -44,6 +44,9 @@ void Node::Release()
void Node::AddParameter(NodeParam *param)
{
// Ensure no other param with this ID has been added to this Node (since that defeats the purpose)
Q_ASSERT(!HasParamWithID(param->id()));
param->setParent(this);
connect(param, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SIGNAL(EdgeAdded(NodeEdgePtr)));
@@ -120,3 +123,18 @@ QVariant Node::PtrToValue(void *ptr)
{
return reinterpret_cast<quintptr>(ptr);
}
bool Node::HasParamWithID(const QString &id)
{
QList<NodeParam*> params = parameters();
foreach (NodeParam* p, params)
{
if (p->id() == id)
{
return true;
}
}
return false;
}