use strings to connect nodes

This makes the node system somewhat more high-level with the intent of making
working with them far more flexible and stable. By making the architecture more
abstracted, it becomes far less rigid which should allow us to do even more
with it and make it much less crash prone.
This commit is contained in:
itsmattkc
2021-02-09 15:48:37 +11:00
parent d1a3e22eaa
commit 81c1922911
138 changed files with 4487 additions and 3913 deletions
+6 -11
View File
@@ -187,8 +187,8 @@ void NodeViewItem::SetNode(Node *n)
if (node_) {
node_->Retranslate();
foreach (NodeInput* input, node_->parameters()) {
if (input->IsConnectable()) {
foreach (const QString& input, node_->inputs()) {
if (node_->IsInputConnectable(input)) {
node_inputs_.append(input);
}
}
@@ -258,7 +258,7 @@ void NodeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
painter->fillRect(input_rect, highlight_col);
}
painter->drawText(input_rect, Qt::AlignCenter, node_inputs_.at(i)->name());
painter->drawText(input_rect, Qt::AlignCenter, node_->GetInputName(node_inputs_.at(i)));
}
}
@@ -430,17 +430,12 @@ QRectF NodeViewItem::GetInputRect(int index) const
return r;
}
QPointF NodeViewItem::GetInputPoint(NodeInput *input, const QPointF& source_pos) const
QPointF NodeViewItem::GetInputPoint(const QString &input, int element, const QPointF& source_pos) const
{
return GetInputPoint(node_inputs_.indexOf(input), source_pos);
return pos() + GetInputPointInternal(node_inputs_.indexOf(input), source_pos);
}
QPointF NodeViewItem::GetInputPoint(int input, const QPointF &source_pos) const
{
return pos() + GetInputPointInternal(input, source_pos);
}
QPointF NodeViewItem::GetOutputPoint() const
QPointF NodeViewItem::GetOutputPoint(const QString& output) const
{
switch (flow_dir_) {
case NodeViewCommon::kLeftToRight: