Nodes/comfyui-panels/List Transfer Panels
ComfyUI Node

List Transfer Panels

Splice panel lists with Python slice syntax

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
List Transfer Panels
  • to_panels
  • from_panels
  • POLYGON
to_slice0:
from_slice0:

Where List Append Panels is the blunt merge tool, List Transfer Panels is the surgical one: it copies a slice out of one panel list and drops it into a slice of another, using Python slice syntax. It's the node you reach for when a page needs reordering - swap the first two panels of a spread, replace panels 2–4 with the panels you generated separately, or shuffle a sequence - without rebuilding the whole list.

The name "transfer" is doing real work: panels are transferred from the source list into the target list at the positions you specify. The target list keeps its identity and everything outside the replaced slice; only the addressed range changes. The source list isn't consumed - it's deep-copied, so the original stays available for other branches. That copy semantics is worth internalizing: this is a read-from / write-to operation, not a destructive move.

How it works

Both to_slice and from_slice are strings parsed as Python slices - "0:", "2:4", ":-1", even negative indexes. The node validates the strings against a strict pattern first (so garbage input raises a clear error instead of silently misbehaving), then does the splice: it deep-copies the target list, replaces to_list[to_slice] with from_list[from_slice], and returns the modified copy. The slice strings are inputs you can wire, but in practice most people type them: to_slice="1:3", from_slice="0:2" swaps the first two source panels into positions 1–2 of the target.

The inputs that matter

  • to_panels - the list being modified (the output is a copy of this).
  • from_panels - the list being read from.
  • to_slice - default "0:", the target positions to replace.
  • from_slice - default "0:", the source positions to copy.

Output: one POLYGON list.

Installing it

Part of comfyui-panels - Manager, search "comfyui-panels", or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels

Restart, install deps (shapely, matplotlib, opencv-python), no models.

Where people get burned

Slice syntax is the whole learning curve. "2:4" means start at 2, stop before 4 - classic off-by-one territory, and a wrong slice silently reorders panels instead of failing loudly. Test with a Preview Panels node in the loop before you commit a complicated splice. Also: slices are length-flexible, so replacing a 2-element range with a 5-element range works (the list grows) - that's usually what you want, but it changes downstream indices, so if later slices depend on exact positions, recheck them. And the defaults ("0:" both) copy the entire source list onto the entire target list - harmless if that's the plan, surprising if you forgot to set them.

CategoryBmad/Panels

Inputs (4)

NameTypeDefaultDescription
to_panelsPOLYGON
from_panelsPOLYGON
to_sliceSTRING0:
from_sliceSTRING0:

Outputs (1)

NameTypeDescription
POLYGONPOLYGONPanels (Shapely Polygons)