ComfyUI Node

Motorway 4x2

Merge four, keep two lanes moving

By agilly1989Β·Created 2 years agoΒ·Updated about a year agoΒ· 7
Motorway 4x2
  • MOTORWAY πŸšŒπŸ’¨
  • ANY_(A)
  • ANY_(B)
  • ANY_(C)
  • ANY_(D)
  • MOTORWAY πŸšŒπŸ’¨
  • ANY (A)
  • ANY (B)
β—„ANY_(A)_keyβ€”β–Ί
β—„ANY_(B)_keyβ€”β–Ί
β—„ANY_(C)_keyβ€”β–Ί
β—„ANY_(D)_keyβ€”β–Ί

Motorway 4x2 is the modest middle ground of the agilly1989 Motorway pack: four values in, two values out. It's for the workflow where you want to consolidate - pull the four things you keep touching down into one place, file them onto the bus - but you only need a couple of them to keep flowing as live wires into the next stretch. It's a "tidy up here" node, the kind you drop in at a natural seam in the graph.

The pack is a pipe implementation. A custom bus object (MotorwayClass) travels node to node carrying values under string keys; every Motorway AxB node is an on/off ramp that files inputs onto the bus and pulls outputs off it. Journeys start with MotorwayStart (or a Motorway primitive like MotorwayInt), and the bus always continues out of the first output socket. It's marked beta - the README is upfront that "IF THINGS BREAK ITS BECAUSE I BROKE IT" - so don't build your only copy of a workflow on it.

What's on the node

Required input MOTORWAY πŸšŒπŸ’¨ (the bus), four data inputs ANY_(A) through ANY_(D) (typed *, so any type rides in), and four key fields ANY_(A)_key through ANY_(D)_key - one per slot, because every input and every output gets a key.

Each letter's key is shared between that letter's input and output. Input A files under key A; output ANY (A) reads key A back out. So if the model comes in on ANY_(A) with key model, output ANY (A) hands it straight back out - a write-through lane. The second output, ANY (B), works the same way with key B. Inputs C and D have no matching output, so they're pure store lanes: file them with keys and let something downstream pull them.

In practice that means: pick your two most-inline values for lanes A and B, and treat C and D as "put this on the bus for later." The two outputs then feed directly into your next node while everything else waits on the bus.

Install

ComfyUI Manager, search "ComfyUI_agilly1989_motorway". Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart ComfyUI. No model downloads, no pip packages - it's pure Python.

The traps

The README documents the main one: 'MotorwayClass' object has no attribute 'hash_...' when you pull a key that was never written. Keys are sha256-hashed internally, so a typo reads an empty slot instead of complaining about spelling. Second: on a 4x2, an output with a blank key is a blank output - fill the key for any lane you actually wire. And remember the bus needs a start; don't hang a 4x2 off nothing.

Categoryagilly1989 Nodes/Motorways

Inputs (9)

NameTypeDefaultDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
ANY_(A)opt*β€”
ANY_(B)opt*β€”
ANY_(C)opt*β€”
ANY_(D)opt*β€”
ANY_(A)_keyoptSTRINGβ€”
ANY_(B)_keyoptSTRINGβ€”
ANY_(C)_keyoptSTRINGβ€”
ANY_(D)_keyoptSTRINGβ€”

Outputs (3)

NameTypeDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
ANY (A)*β€”
ANY (B)*β€”