For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /nodes/10/ComfySwitchNode.md.

切换(ComfySwitchNode)

ComfySwitchNodeutilities/logic角色:功能节点

If/Else Switch 节点根据布尔条件在两个可能的输入之间进行选择。当 switch 启用(true)时,它将 on_true 输入传递到输出;当禁用(false)时,它传递 on_false。这些输入是惰性的,因此只会对所选分支进行求值,另一个输入无需连接。

参数

参数类型默认 / 范围说明
switchBOOLEAN · 布尔true / false—
on_false(选填)COMFY_MATCHTYPE_V3—(连线输入)—
on_true(选填)COMFY_MATCHTYPE_V3—(连线输入)—

输出

输出类型说明
outputCOMFY_MATCHTYPE_V3COMFY_MATCHTYPE_V3

怎么接

  • 上游:同类型上游
  • 下游:同类型下游
  • 接线:上游由 同类型上游 提供 on_false,输出 output(COMFY_MATCHTYPE_V3) 交给 同类型下游。

使用案例

从 switch(true / false) 开始填就能跑起来。典型接法:同类型上游 → 本节点 → 同类型下游。输出类型是 COMFY_MATCHTYPE_V3,只能接同类型的输入端口,颜色对不上就是接错了。

端口与连线示意

ComfySwitchNode 端口与连线示意

同类节点

与 · 非 · 或