Skip to content

Commit

Permalink
Fixed an issue with multiple instances of wires.
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadtahasuhail authored Dec 22, 2020
1 parent 2af1986 commit b12644e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ def build():
###################### Setting up communication between blocks ######################
loginfo("Setting up connections...")

wire_id = 0

for wire in wires:

src_block, src_port = wire['source']['block'], wire['source']['port']
tgt_block, tgt_port = wire['target']['block'], wire['target']['port']

wire_id = src_block+str(src_port)


# Connecting Paramters to Blocks
Expand All @@ -178,17 +180,16 @@ def build():

# Connecting Wires to Blocks
else:
wire_name = "wire_"+str(wire_id)
wire_id += 1
#wire_name = "wire_"+str(wire_id)

for block in blocks:
if tgt_block == block.id:
block.connect_input_wire(wire_name, tgt_port)
block.connect_input_wire(wire_id, tgt_port)
break

for block in blocks:
if src_block == block.id:
block.connect_output_wire(wire_name, src_port)
block.connect_output_wire(wire_id, src_port)
break
######################################################################################

Expand Down

0 comments on commit b12644e

Please sign in to comment.