node: fixed issue with "taking" values from input tables

As opposed to simply leaving all values in the table, nodes can now "take"
values that they use to free up memory (e.g. "taking" input buffers if they're
used to produce an output buffer).

This is a fairly large change, expect regressions.
This commit is contained in:
itsmattkc
2020-04-16 23:12:05 +10:00
parent cc8699c0bc
commit 2f80be437a
30 changed files with 179 additions and 101 deletions
+7 -3
View File
@@ -148,7 +148,7 @@ void Node::AddParameter(NodeParam *param)
}
}
NodeValueTable Node::Value(const NodeValueDatabase &value) const
NodeValueTable Node::Value(NodeValueDatabase &value) const
{
return value.Merge();
}
@@ -616,7 +616,7 @@ NodeOutput *Node::output() const
return output_;
}
NodeValue Node::InputValueFromTable(NodeInput *input, const NodeValueDatabase &db) const
NodeValue Node::InputValueFromTable(NodeInput *input, NodeValueDatabase &db, bool take) const
{
NodeParam::DataType find_data_type = input->data_type();
@@ -626,7 +626,11 @@ NodeValue Node::InputValueFromTable(NodeInput *input, const NodeValueDatabase &d
}
// Try to get a value from it
return db[input].GetWithMeta(find_data_type);
if (take) {
return db[input].TakeWithMeta(find_data_type);
} else {
return db[input].GetWithMeta(find_data_type);
}
}
const QPointF &Node::GetPosition()