MaskComposite_motorway_edition
Layering masks by hand, without a wire in sight
- MOTORWAY ππ¨
- MOTORWAY ππ¨
Building a good inpainting region usually means combining masks - a face mask plus a hands mask plus a background carve-out, layered into one. ComfyUI's stock answer is MaskComposite, which the pack renames "Combine Masks". This is its Motorway-ed clone: same operation, but the two input masks arrive by key instead of by wire, and the result is written back into the Motorway rather than handed out on a connector.
What it does
It takes a destination mask and a source mask, positions the source onto the destination at an x/y offset, and combines the overlap using the operation you pick. Think of it as an image-editing blend mode for masks:
multiply- the overlap survives; both must be white to stay white. Good for intersection-style regions.add- union-ish; either being white makes the result white (clamped).subtract- carve the source out of the destination.and/or/xor- the bitwise versions, if you like thinking in booleans.
The inputs that matter:
INPUT_destination_key(defaultdestination) andINPUT_source_key(defaultsource) - the keys holding the twoMASKtensors in the Motorway. Which is "destination" vs "source" only matters forsubtractand for where the layer lands, so keep them straight.xandy- where the source gets dropped onto the destination. Both default to 0 and go up to 16384.operation- the dropdown above. Default ismultiply, which is the one you usually want for combining inpainting regions.OUTPUT_MASK_key(defaultMASK) - where the composited mask is stored for the next node to read.
The typical flow: a couple of nodes produce masks (edge detection, color keys, a VAE-decode-and-threshold chain), each stored under its own key, then this node merges them into one MASK that your inpainting conditioning reads. Because everything is keyed, you can re-run any producer without re-wiring anything - that's the whole appeal of the pipe.
Motorway plumbing
The wrapper keeps x, y and operation as real widgets, turns the two mask inputs into INPUT_*_key strings, and swaps the output for OUTPUT_MASK_key. Runtime behavior is identical to the built-in MaskComposite - the clone instantiates the stock node, fetches both masks by key, and stores the result. No behavior lost.
Install
One install for the whole pack. ComfyUI Manager β search "ComfyUI_agilly1989_motorway", or:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI. No requirements.txt, no extra deps, no model downloads.
Troubleshooting
'MotorwayClass' object has no attribute 'hash_'- a key you referenced isn't in the Motorway. Confirm the mask producers ran before this node and that the key names match exactly (case matters).- If masks are different sizes,
x/ybehave like a paste offset - the source keeps its own size and overlaps wherever the offset puts it. Misaligned output almost always means the offset is wrong, not the operation. - The pack is BETA and the newest published version (1.1.7) disabled clone generation, so on a fresh install these
_motorway_editionnodes may be absent from the menu. They're present in the 1.1.0β1.1.6 builds comfy.icu indexed.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_destination_key | STRING | destination | β |
| INPUT_source_key | STRING | source | β |
| x | INT | 00β16384 | β |
| y | INT | 00β16384 | β |
| operation | COMBO | 6 options: multiply, add, subtract, and, or, xor | |
| OUTPUT_MASK_key | STRING | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |