- feat(conversion): 新增 Any to Any 通配透传节点 - feat(int): 新增 Int Mask/Audio/Text Count,并统一计数共享层 - feat(logic): Multi Switch Select 支持 a/all 全选 - feat(io): Load PS 预览默认开启并抑制 psd_tools INFO 噪音;Save Audio 默认 mp3,播放器兼容 Nodes 2.0 - fix(multi): Multi String Join 的 string_1 改为纯插槽,修复动态端口错位 - refactor(shared): 复用 parse_pad_color / pad_to_rgb - docs: 同步中英文节点文档、README 列表与 v4.1.0 日志 - test: 新增/更新相关回归测试
5.1 KiB
5.1 KiB
Multi Switch Select - Multi-Output Routing Selector
Node Purpose: Multi Switch Select uses a 1-based select expression to choose one or more inputs from dynamic input_1..input_N, then emits each chosen value only on the matching output_k. All other outputs remain None; setting select to a or all selects every connected input at once.
Shared rules: select and Image Batch Index's index use the same parser (utils/_index_range.py) and accept exactly the same range syntax. The differences are that select is 1-based, its results are deduplicated and sorted, and it additionally accepts the a / all select-all shortcuts (Image Batch Index has no such keyword).
Inputs
| Name | Port | Type | Default | Range | Description |
|---|---|---|---|---|---|
select |
- | STRING | 1 |
1..10 index/range expressions, or a / all |
Same syntax as Image Batch Index's index: 1,3, 1-3, [1,3], [1,3), :step, negative indices; a / all means every connected input |
input_1 |
optional | ANY (*) |
- | - | First candidate input |
input_2…input_10 |
optional (dynamic) | ANY (*) |
- | - | Additional candidate inputs |
Outputs
| Name | Type | Description |
|---|---|---|
output_1…output_10 |
ANY (*) |
Only the output_k matching an index in select carries the value of input_k; all others are None |
Supported Syntax (same as Image Batch Index)
| Syntax | Result |
|---|---|
1, 1,3, 1 3, 1.3, 1,3 |
Single value or list; ., 、 and whitespace are skipped as separators |
1-3, 1 - 3 |
Inclusive range: 1, 2, 3 |
1-5:2 |
Step 2: 1, 3, 5 |
[1,3], 【1,3】 |
Inclusive range: 1, 2, 3 |
[1,3) |
Left-closed, right-open: 1, 2 |
(1,3] |
Left-open, right-closed: 2, 3 |
(1,3) |
Open range: 2 |
[1,5]:2 |
Step 2: 1, 3, 5 |
[1:3] |
1 and 3 (: is only step syntax; it does not expand 1, 2, 3) |
-1 |
Last connected input; e.g. with input_1..input_4 connected, this is input_4 |
[8,12] |
Out-of-range parts are dropped; only 8, 9, 10 remain |
a, all, ALL |
Every connected input: 1..N (N = highest connected slot); case-insensitive |
[1:3]is not a range::belongs to the step syntax; use[1,3]or1-3for a range.- Only
-separates a range;1~3yields 1 and 3, not a range. - Negative indices resolve against the highest connected input slot: with 1..4 connected,
-1=input_4and-4=input_1. - Out-of-range indices are skipped; an empty or fully invalid
selectselects nothing (alloutputvalues areNone). - Results are deduplicated and sorted; duplicates and input order do not affect the final selection.
a/allmust be a standalone token (separated by a comma, semicolon or whitespace);a1andall1still parse as the number1.a/alltakes precedence: numbers in the same expression are ignored (all,2is still everything).- Select-all keeps empty slots in 1..N: a connected-but-empty slot, or an unconnected slot at or below N, still leaves its
output_kasNone.
Features
- Multi-selection:
select=1,2,4evaluatesinput_1,input_2andinput_4;input_3is never evaluated. - Select-all:
select=a(orall) behaves like selecting 1..N, and stays lazy so only actually connected inputs are requested. - Fixed routing:
input_kalways maps tooutput_k. - Lazy evaluation:
check_lazy_statusrequests every selected input that is connected but unresolved in one pass; unselected branches are never added to the execution graph. - Missing-input safety: a selected but unconnected input is not requested, its output stays
None, and noNodeInputErroris raised. - Shared grammar: both nodes use
utils/_index_range.py, so their range syntax cannot drift apart. - Backward compatible: a numeric
selectsaved by older workflows (e.g.2) still works because ComfyUI converts integer widget values to strings.
Typical Usage
- Release several branches at once:
select=1,2,4runs branches 1/2/4 and skips branch 3. - Contiguous range:
select=1-3runs branches 1/2/3. - Only 1 and 3:
select=1,3,select=[1:3]orselect=[1,3]:2. - Last connected branch:
select=-1. - Release everything:
select=all(ora) runs every connected branch. - Dynamic routing driven by another logic node that produces the
selectstring.
Notes & Tips
- Unselected outputs are
None(not empty tensors). Downstream nodes connected to thoseoutput_jports still execute and receiveNone, which usually errors downstream; only connect the outputs covered by the currentselect. - A selected but unconnected
input_kdoes not trigger its upstream branch, andoutput_kisNone. - An empty or invalid
selectdoes not fall back to 1; it selects nothing. Keep the default1if you want the first branch selected. - The front-end exposes as many output slots as dynamic inputs (1..10); using
output_krequires the matchinginput_kslot to exist or be connected. - Unselected branches are not executed, but their links still have to pass prompt validation (types and required inputs).