don't police data type connections between nodes
Nodes were previously written to be "strongly typed" in that a parameter's "type" enforced whether it could be connected to another. All code related to that has now been removed since not only is it hard to maintain and likely unnecessary, it's possible the nodes will work differently later on anyway.
This commit is contained in:
+10
-27
@@ -24,7 +24,7 @@
|
||||
|
||||
NodeOutput::NodeOutput(const QString &id) :
|
||||
NodeParam(id),
|
||||
data_type_(kNone)
|
||||
linked_input_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,32 +33,6 @@ NodeParam::Type NodeOutput::type()
|
||||
return kOutput;
|
||||
}
|
||||
|
||||
NodeParam::DataType NodeOutput::data_type()
|
||||
{
|
||||
return data_type_;
|
||||
}
|
||||
|
||||
void NodeOutput::set_data_type(const NodeParam::DataType &type)
|
||||
{
|
||||
if (data_type_ == type) {
|
||||
return;
|
||||
}
|
||||
|
||||
data_type_ = type;
|
||||
|
||||
// If this output is connected to other inputs, check if they're compatible with this new data type
|
||||
if (IsConnected()) {
|
||||
for (int i=0;i<edges_.size();i++) {
|
||||
NodeEdgePtr edge = edges_.at(i);
|
||||
|
||||
if (!AreDataTypesCompatible(this, edge->input())) {
|
||||
DisconnectEdge(edge);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant NodeOutput::get_value(const rational& in, const rational& out)
|
||||
{
|
||||
mutex_.lock();
|
||||
@@ -87,3 +61,12 @@ void NodeOutput::push_value(const QVariant &v, const rational &in, const rationa
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
NodeInput *NodeOutput::linked_input()
|
||||
{
|
||||
return linked_input_;
|
||||
}
|
||||
|
||||
void NodeOutput::set_linked_input(NodeInput *link)
|
||||
{
|
||||
linked_input_ = link;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user