From 336ef69d738c71d0c4bc49ea0de7f8562e640501 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 13 Apr 2019 20:28:56 +1000 Subject: [PATCH] allow multiple connections to be made from an output --- ui/nodeui.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/nodeui.cpp b/ui/nodeui.cpp index 08ef0b877..e58906bad 100644 --- a/ui/nodeui.cpp +++ b/ui/nodeui.cpp @@ -115,12 +115,13 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event) // See if this socket already has an edge connected QVector edges = central_widget_->GetEffect()->row(clicked_socket_)->edges(); - if (!edges.isEmpty()) { + if (!edges.isEmpty() && edges.last()->input()->GetParentEffect() == central_widget_->GetEffect()) { NodeEdge* e = edges.last().get(); - EffectRow* other_row = (e->input()->GetParentEffect() == central_widget_->GetEffect()) ? - e->output() : e->input(); + // If this node is the edge's "input", then we'll drag that instead of creating a new edge + + EffectRow* other_row = e->output(); Node* other_node = other_row->GetParentEffect(); @@ -136,6 +137,8 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event) // Disconnect the existing edge, and treat our dynamic one as an edit of that one EffectRow::DisconnectEdge(edges.last()); + + } else { // Start a new edge here