Nodes/ComfyUI-3D-MeshTool/array1 select element
ComfyUI Node

array1 select element

Reorder a list without a single math node

By 807502278·Created 2 years ago·Updated 2 years ago· 23
array1 select element
  • array_input
  • element_array
index0,2,1

You've got a list - camera poses, frame indices, batch values - and the order it arrives in isn't the order you need. Most people reach for a pile of index nodes and switches to fix that. array1 select element does it with one text box: you type the order you want, and it spits out the elements in exactly that order.

The inputs are array_input (a LIST) and index, a string that defaults to "0,2,1". The index string is the whole interface: a comma-separated set of positions, parsed with the same tolerant string parser the pack uses everywhere, so "0,2,1", 0,2,1, and even [0 2 1] all work. Each number picks one element from the input, in the order you listed them. So with input [a, b, c, d] and index "3,0,0" you get [d, a, a] - note it can repeat elements, which is how you stretch a short list into a longer one or duplicate a first frame.

The single output is element_array (a LIST). Empty input gives an empty output. One safety behavior worth knowing: indices past the end of the list are clamped down to the last element rather than erroring. That's forgiving - you won't crash a batch run over an off-by-one - but it can also mask a typo. If your output has suspicious duplicates, check whether an index is silently hitting the clamp.

Realistic uses: reordering a batch of images or views to match a prompt sequence, rearranging camera poses so a turntable goes the direction you want, or pulling out every Nth value from a generated sweep. Because the index is plain text, you can also build it dynamically with a string node and change the selection without touching the wiring.

This lives in 807502278/ComfyUI-3D-MeshTool, a one-developer 3D utility pack. Pure Python, no models. Install via ComfyUI Manager (search "ComfyUI-3D-MeshTool") and restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-3D-MeshTool
cd ComfyUI-3D-MeshTool
pip install -r requirements.txt

Pack habits to expect: node renames turn old instances red (recreate and reconnect), and it assumes the list you feed it is a real list - wire in an empty one and you'll get an empty out. For reordering, this is the node you'll actually reach for.

Category3D_MeshTool/Array/list_edit

Inputs (2)

NameTypeDefaultDescription
array_inputLIST
indexSTRING0,2,1

Outputs (1)

NameTypeDescription
element_arrayLIST