Skip to content
Permalink
Browse files

Fix modeler draws lines to wrong output

  • Loading branch information
github-actions authored and nirvn committed Jan 31, 2020
1 parent ac3b446 commit 528a45d7453b7cbeb44450d5c81de80c8dd66611
Showing with 10 additions and 2 deletions.
  1. +10 −2 python/plugins/processing/modeler/ModelerScene.py
@@ -157,14 +157,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))
@@ -176,7 +185,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 528a45d

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