Nodes/ComfyUI_Lam/开关分段
ComfyUI Node

开关分段

Toggle a segment of your pipeline on or off from one control point

By yanlang0123·Created 2 years ago·Updated about a month ago· 76
开关分段
  • base
  • new
  • base

LamSwitchMiddle (开关分段, "switch segment") is a segment bypass: it sits in the middle of a chain of nodes and, depending on a switch setting, either passes the pipeline's value through untouched or substitutes a new value you've wired in. It's one piece of a two-node system - the matching control node is LamSwitchStart (开关控制), and without it the middle nodes have nothing to read their switch state from.

The scenario it solves is the one every big workflow eventually hits: you've built a linear chain of processing stages, and you want to try a run with the upscaler (or the refiner, or the detailer) enabled versus bypassed - without muting nodes one by one. With this system you chain a series of LamSwitchMiddle nodes between your stages, run the chain back to a LamSwitchStart, and set a comma-separated pattern of 1/0 bits on the start node. Each middle node checks its position in the chain: bit 1 → it outputs its new (i.e. the segment's alternative value); bit 0 → it passes base through, effectively skipping the segment.

Inputs

  • base - the incoming pipeline value (whatever your chain carries - an image, a latent, a conditioning).
  • new - the alternative value to substitute when this segment's switch bit is on.

Outputs

  • base - the outgoing value: either the original base (segment off) or new (segment on). Same type as whatever you feed in, since it's all *.

The output is named base regardless, which is the author's way of saying "the chain continues from here."

Install

Part of the ComfyUI_Lam pack:

cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam

or via ComfyUI Manager, then the README's install + 修改文件 steps.

Gotchas

The biggest one is that this node is useless on its own - you need LamSwitchStart wired as the head of the chain, and every LamSwitchMiddle must sit on the base chain leading back to it, or the hidden switchs string has nothing to read and you'll get errors or silent passthrough. It also only switches a single value at a time, so a segment with three connections needs three middle nodes. This is powerful glue but it's clearly built for the author's own workflow style - if you just want to mute a group, the rgthree Muter/Bypasser nodes are the more ergonomic, less clever option.

Categorylam

Inputs (2)

NameTypeDefaultDescription
base*
new*

Outputs (1)

NameTypeDescription
base*