简易值切换 (Simple Value Switch)
Return the first input that actually has something in it
- output
The author's own description is the whole spec, and it's clean: iterate through every connected input, and output the first one that isn't None and isn't empty. That's a fallback chain - "use this, unless it's blank, then try the next one" - as a single node instead of a stack of If/Switch logic.
Why this pattern is worth knowing
This is the same shape as the "any switch" / fallback-chain nodes you'll find in other utility packs - rgthree-comfy's Any Switch is the well-known example, and it does the same job the same way: return whichever input is actually populated first. The use case is almost always "I have a manual override that's usually empty, and a computed default that isn't" - wire the override first, the computed value second, and the switch quietly does the right thing without an explicit if/else anywhere in your graph. Or chain three or four optional sources of the same value (a user-typed field, a value pulled from a loader, a hardcoded fallback) and let whichever one is actually filled in win.
Because it accepts "any type," it doesn't care whether you're switching between strings, images, models, or numbers - the logic (non-null, non-empty) is the same regardless of what's flowing through it.
How it works
There's nothing in the required or optional schema - no fixed input slots are declared. That's consistent with this being a dynamic-input node: you add inputs to it on the canvas as you need them (right-click, or drag a new wire to an empty slot the way ComfyUI's own dynamic-input nodes work), rather than filling in a fixed set of named fields. However many you add, the node walks them in order and returns the first that isn't null or empty.
The inputs and outputs that matter
- Inputs are added dynamically on the node itself, in the order you want them checked. Put your highest-priority source first.
output- a single wildcard-typed (*) output carrying whichever input won.
How to install it
ComfyUI Manager: search "ComfyUI-Danbooru-Gallery", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Aaalice233/ComfyUI-Danbooru-Gallery.git
cd ComfyUI-Danbooru-Gallery
pip install -r requirements.txt
Restart ComfyUI. No models or heavy dependencies - pure graph logic.
Common issues & troubleshooting
Wrong input is winning. Order matters - the node returns the first non-empty value, not the "best" one by any other measure. If a later input you actually wanted is being ignored, check that an earlier one isn't sitting there with a stray non-empty default (an empty string is treated as empty, but a string containing just a space, for instance, is not empty).
Output is empty even though something should be connected. Confirm at least one input is actually wired - with nothing connected, there's nothing to return.
Node doesn't show up at all. Standard pack-load check: confirm the repo is at ComfyUI/custom_nodes/ComfyUI-Danbooru-Gallery, dependencies installed cleanly, and check the ComfyUI startup console for an import error from this pack.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | * | — |