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:
itsmattkc
2019-10-25 00:44:14 +11:00
parent 076f2699c5
commit 4d96ac9e39
24 changed files with 83 additions and 249 deletions
+13 -25
View File
@@ -39,14 +39,23 @@ NodeParam::Type NodeInput::type()
return kInput;
}
void NodeInput::add_data_input(const NodeParam::DataType &data_type)
QString NodeInput::name()
{
inputs_.append(data_type);
if (name_.isEmpty()) {
return GetDefaultDataTypeName(data_type());
}
return NodeParam::name();
}
bool NodeInput::can_accept_type(const NodeParam::DataType &data_type)
const NodeParam::DataType &NodeInput::data_type()
{
return AreDataTypesCompatible(data_type, inputs_);
return data_type_;
}
void NodeInput::set_data_type(const NodeParam::DataType &type)
{
data_type_ = type;
}
NodeOutput *NodeInput::get_connected_output()
@@ -163,27 +172,6 @@ void NodeInput::set_maximum(const QVariant &max)
has_maximum_ = true;
}
NodeParam::DataType NodeInput::data_type()
{
if (IsConnected()) {
// Return the connected output's data type
return edges_.first()->output()->data_type();
}
if (inputs_.isEmpty()) {
// Safety if no inputs have been added
return kNone;
}
// Return first
return inputs_.first();
}
const QList<NodeParam::DataType> &NodeInput::inputs()
{
return inputs_;
}
void NodeInput::CopyValues(NodeInput *source, NodeInput *dest)
{
// Copy values