implemented the ability to make inputs that can't be connected

This commit is contained in:
itsmattkc
2019-12-15 04:15:09 +11:00
parent f3acc369ff
commit a977020833
4 changed files with 32 additions and 4 deletions
+16 -1
View File
@@ -32,7 +32,8 @@
#include "node/output.h"
NodeParam::NodeParam(const QString &id) :
id_(id)
id_(id),
connectable_(true)
{
Q_ASSERT(!id_.isEmpty());
}
@@ -91,6 +92,16 @@ bool NodeParam::IsConnected()
return !edges_.isEmpty();
}
bool NodeParam::IsConnectable() const
{
return connectable_;
}
void NodeParam::SetConnectable(bool connectable)
{
connectable_ = connectable;
}
const QVector<NodeEdgePtr> &NodeParam::edges()
{
return edges_;
@@ -105,6 +116,10 @@ void NodeParam::DisconnectAll()
NodeEdgePtr NodeParam::ConnectEdge(NodeOutput *output, NodeInput *input, bool lock)
{
if (!input->IsConnectable()) {
return nullptr;
}
// If the input can only accept one input (the default) and has one already, disconnect it
DisconnectForNewOutput(input);