Skip to content
Permalink
Browse files

[processing] Fix modeler draws lines to wrong output when connecting

the green output boxes back to their linked algorithms
  • Loading branch information
nyalldawson committed Jan 31, 2020
1 parent 17448b1 commit 5ae9807303e909a504288d97a2efc4cc04a62670
Showing with 10 additions and 2 deletions.
  1. +10 −2 python/plugins/processing/modeler/ModelerScene.py
@@ -161,14 +161,23 @@ def paintModel(self, model, controls=True):
for alg in list(model.childAlgorithms().values()):
outputs = alg.modelOutputs()
outputItems = {}
idx = 0

for key, out in outputs.items():
if out is not None:
item = ModelerGraphicItem(out, model, controls, scene=self)
item.setFlag(QGraphicsItem.ItemIsMovable, True)
item.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.addItem(item)
pos = out.position()

# find the actual index of the linked output from the child algorithm it comes from
source_child_alg_outputs = alg.algorithm().outputDefinitions()
idx = -1
for i, child_alg_output in enumerate(source_child_alg_outputs):
if child_alg_output.name() == out.childOutputName():
idx = i
break

if pos is None:
pos = (alg.position() + QPointF(ModelerGraphicItem.BOX_WIDTH, 0) +
self.algItems[alg.childId()].getLinkPointForOutput(idx))
@@ -180,7 +189,6 @@ def paintModel(self, model, controls=True):
item.addArrow(arrow)
arrow.updatePath()
self.addItem(arrow)
idx += 1
else:
outputItems[key] = None
self.outputItems[alg.childId()] = outputItems

0 comments on commit 5ae9807

Please sign in to comment.
You can’t perform that action at this time.