Nodes/Comfyui-PixNodes/List from Loop (PixNodes)
ComfyUI Node

List from Loop (PixNodes)

Collect what each loop iteration made into one list

By pixixai·Created 11 months ago·Updated 16 days ago· 23
List from Loop (PixNodes)
  • list_in
  • item
  • collection
  • length
◄split_itemstrue►

A loop that produces something every iteration is only useful if you can collect what it made. List from Loop is the collector: it accumulates each iteration's output into a growing list (or a proper image/latent batch), so that when the loop finishes you have one tidy result - every generated image, every prompt, every JSON object - ready for downstream use.

The name says where it lives: this node sits inside a loop, built for the pack's For/While loop family (the PixNodes/loop category, with flow control ports). The loop-start node hands you an index and values; you run your per-iteration work; this node appends that work to the collection; you feed the collection back around the loop; and the accumulated result comes out at the end.

How the accumulation works

Three inputs: list_in (the collection from the previous iteration, or the empty start), item (the new data this iteration produced), and split_items (boolean, default on). split_items controls whether a list item gets spread into the collection element-by-element (extend) or appended as a single nested entry. If a downstream step hands you a whole list in one iteration and you want each element kept separate, leave it on.

The smart part is what happens at the end. If everything collected is a tensor with matching shapes, it's torch.cat'd into a single proper image batch - so collecting images across loop iterations gives you a real IMAGE batch you can feed a sampler or save, not a Python list of tensors. The same trick applies to latents: collected {"samples": ...} dicts get their tensors concatenated, noise masks included when they align. Strings and numbers just accumulate as a plain Python list.

Outputs are collection (the accumulated result) and length (INT), the running count - handy as a loop bound.

Install

Part of Comfyui-PixNodes. ComfyUI Manager → search "PixNodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes

then restart. (The README's manual-install line pastes the wrong repo URL, ComfyUI-AlignLayout - use the one above.)

The loop gotchas

Loops are the fiddliest thing in this pack, and the changelog is the proof: v1.1.0's entire entry is "fixed loop node data not transferring." If a loop looks like data isn't arriving at list_in, update the pack first. Two habits keep you out of trouble: always feed list_in from the loop's previous round (not a fresh node), and remember the tensor-cat only fires when shapes match - collect images of different sizes and you'll silently get a Python list back instead of a batch, which downstream IMAGE ports will reject. Keep the per-iteration output uniform and this node stays the boring, reliable collector it's meant to be.

CategoryPixNodes/loop

Inputs (3)

NameTypeDefaultDescription
list_in*来自循环开始节点或上一轮迭代的列表/Batch
item*当前迭代产生的新数据项
split_itemsBOOLEANtrue如果为True,在追加之前展开列表数据

Outputs (2)

NameTypeDescription
collection*—
lengthINT—