Nodes/Shima/Shima Highway Detour
ComfyUI Node

Shima Highway Detour

Branch your workflow like a road junction

By KDB-USJP·Created 6 months ago·Updated 6 months ago· 2
Shima Highway Detour
  • data
  • Route 1
  • Route 2
active_route0
label_1ROUTE 1
label_2ROUTE 2
route_automate

An A/B switch is one of the most useful little structures in ComfyUI: one selector, two paths, no rewiring. Shima.HighwayDetour is exactly that, built in the visual style of the Highway routing system. You feed it one signal, it sends that signal down Route 1 or Route 2 depending on which route is active - and because both outputs are the wildcard * type, it'll happily branch an IMAGE, a LATENT, a MODEL, whatever you're routing.

Mechanically it's simple and honest. The active route is stored in a hidden active_route INT (0 or 1, JS-managed - the frontend draws the actual junction with the labelled road signs). When the node executes, it checks the route and returns (data, None) for route 0 or (None, data) for route 1 - the losing branch explicitly gets None, which is exactly the "unconnected optional input" idiom the plumbing doc describes: downstream nodes reading a None know the branch is dead and skip it. That's how the unselected route ends up doing nothing without you deleting anything.

Inputs:

  • active_route (INT, 0/1) - which route is live (0 → Route 1, 1 → Route 2). It's frontend-controlled, so you flip it on the node, but it can also be driven by logic.
  • label_1 / label_2 (STRING, default ROUTE 1 / ROUTE 2) - the signs on the road, so you can name the branches something meaningful like HQ UPSCALE vs FAST.
  • data (type *, optional) - the signal to route.
  • route_automate (BOOL, optional) - the automation override: wire a boolean in and it wins over the widget (true → Route 1, false → Route 2). This is what lets another node or a Shima Breaker switch drive the junction programmatically.

Outputs: Route 1 and Route 2, both * type. Only one of them carries data per run.

The intended flow is the full Highway pattern: Detour to branch, the two processing paths, then a Highway Merge to rejoin the routes back into one signal. Build that and you've got a persistent A/B test - flip the Detour, run twice, compare the two post-processing chains - or an optional path like "do the detailer" vs "skip the detailer."

Two things to watch. First, don't expect the losing branch to be evaluated - its downstream nodes get None and effectively no-op, which is what you want for performance, but it means anything on the dead route won't run its side effects (a save node on the dead branch saves nothing). Second, because the routing state is frontend-rendered, the same family rule applies: if the junction visuals vanish, restart ComfyUI and hard-refresh the browser before you suspect your data flow. And remember data is optional - wire nothing and the node still works as a pure visual switch, which is a legitimate way to build a labeled A/B marker.

Install the pack via ComfyUI Manager (search "Shima") or

cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf

then restart. No models, no downloads.

CategoryShima/Utilities

Inputs (5)

NameTypeDefaultDescription
active_routeINT00–1
label_1STRINGROUTE 1
label_2STRINGROUTE 2
dataopt*
route_automateoptBOOLEAN

Outputs (2)

NameTypeDescription
Route 1*
Route 2*