Flatten Any List
The flatten node for everything that isn't an image
- any
- any
Flatten Image List has a type-specific sibling that handles everything else. Flatten Any List takes a list of just about anything - tensors, plain lists, strings - and merges it into a single set, in order. Where its sibling is the cleanup step for image loaders, this one is the cleanup step for everything your graph emits as a list that some downstream node refuses to accept. It's from SineSwiper's LoadAnim-Adv pack, and it's deceptively small for how often it saves you.
What it does
One required input, any (a * type - "must be a list-like or iterable object"), one output, any: the combined set. The node runs in list-input mode, so it collects whatever items your source emits and merges them. The rules are simple:
- Tensors get concatenated along the first dimension (
torch.cat, dim 0). - Lists and other iterables get extended into one longer list.
- Anything else raises an error rather than guessing.
It's the "reduce a list of things into one thing" node with the type checker loosened to everything. That's both its power and its risk.
When you'd reach for it
- Merging lists of strings - filenames from two List Files From Directory scans, or prompt variants from a list-builder node - into one list to feed a batch loop.
- Concatenating a list of latents or conditioning tuples that don't have a dedicated merge node.
- The general "list came out of a list-supporting node, target node wants a single item" adapter.
The multi-item nuance
Here's the part that trips people up: ComfyUI list semantics. A node that outputs a list gives you either "one item, which happens to be a list" or "several items, run per-item." This node expects the multiple items form - that's what list-input mode collects. If you feed it something whose "list" is really one bundled object, you get the weird case where the output is basically a list containing that one thing. When in doubt, test with a preview node and look at what shape actually comes out.
Inputs and outputs
Input: any (required, *). Output: any (*). Two ports total. Empty input returns an empty list rather than failing, which keeps loops from exploding on their first pass.
Installing
Part of ComfyUI-LoadAnim-Adv by SineSwiper. ComfyUI Manager → search "LoadAnim", or:
cd ComfyUI/custom_nodes
git clone https://github.com/SineSwiper/ComfyUI-LoadAnim-Adv.git
Restart ComfyUI. No models, no dependencies beyond the pack's torch, numpy, Pillow.
Gotchas
- Type mixing fails. The node checks the first item's type and sticks to it. A list that's half tensors and half strings raises a clear error - good behavior, but know that "any" doesn't mean "heterogeneous."
- Shape mismatch on tensors fails the same way as Flatten Image List:
torch.catneeds matching shapes except along the merge axis. - It's not a deep flatten.
[[1,2],[3,4]]becomes[1,2,3,4]- one level. If your list contains lists of lists, you'll need to handle that yourself.
For the times when Flatten Image List is too specific and Select Indexes From Any is overkill, this is the boring, correct middle ground. Keep it in the toolbox.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| any | * | Object set to combine. Must be a list-like or iterable object. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| any | * | The combined set. |