> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-custom-nodes-sdk-v2-frontend.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ComfySoftSwitchNode - ComfyUI Built-in Node Documentation

> Soft Switch 节点根据布尔条件在两个可能的输入值之间进行选择。

Soft Switch 节点根据布尔条件在两个可能的输入值之间进行选择。当 `switch` 为 true 时，输出 `on_true` 输入的值；当 `switch` 为 false 时，输出 `on_false` 输入的值。该节点设计为惰性求值，这意味着它只会根据开关状态计算所需的那一个输入。

## 输入

| 参数         | 描述                                                                     | 数据类型        | 是否必需 | 范围                           |
| ---------- | ---------------------------------------------------------------------- | ----------- | ---- | ---------------------------- |
| `switch`   | 决定将哪个输入传递到输出的布尔条件。为 true 时，选择 `on_true` 输入；为 false 时，选择 `on_false` 输入。 | BOOLEAN     | 是    | True or False                |
| `on_false` | 当 `switch` 条件为 false 时输出的值。此输入为可选，但 `on_false` 和 `on_true` 中至少必须连接一个。  | MATCH\_TYPE | 否    | Same data type as `on_true`  |
| `on_true`  | 当 `switch` 条件为 true 时输出的值。此输入为可选，但 `on_false` 和 `on_true` 中至少必须连接一个。   | MATCH\_TYPE | 否    | Same data type as `on_false` |

**注意：** `on_false` 和 `on_true` 输入必须具有相同的数据类型，由节点的内部模板定义。这两个输入中至少必须连接一个，节点才能正常工作。由于节点是惰性求值的，当只连接一个输入时，无论 `switch` 状态如何，节点始终输出该输入的值。

## 输出

| 输出名称     | 描述                                                                                                                       | 数据类型        |
| -------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| `output` | 所选的值。其数据类型与所连接的 `on_false` 或 `on_true` 输入一致。当两个输入都连接时，若 `switch` 为 true，则输出 `on_true`；若 `switch` 为 false，则输出 `on_false`。 | MATCH\_TYPE |

> 本文档由 AI 生成。如果您发现任何错误或有改进建议，欢迎贡献！ [在 GitHub 上编辑](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ComfySoftSwitchNode/zh.md)

***

**Source fingerprint (SHA-256):** `7bf4bed69d8fd8c360e971ab8068382cd8ebaa02004d5df44312977a7309ae00`
