ComfyUI Node

FEDictPacker

Pack loose wires into a dictionary by field name

By fexli·Created 3 years ago·Updated about a year ago· 3
FEDictPacker
  • input
  • output
in_fielda,b

FEDictPacker is the dictionary version of FEDataPacker, with a twist: you tell it the names of the keys, and it builds a dict from whatever values you wire in. Type a,b into in_field, connect two values, and out comes {a: value1, b: value2}. It's how this pack turns an unruly bundle of wires into structured data.

The dynamic-socket behavior is here too - the pack's frontend adds an input socket for every value you connect and removes empty ones - but with one important difference: the in_field string is a fixed widget, and the values are assigned to keys in comma order. First comma-separated field name gets the first connected value, second gets the second, and so on. So in_field and your wires have to stay in sync: type seed,prompt,steps and connect three wires in exactly that order.

The inputs that matter

  • in_field - the comma-separated key names, default "a,b".
  • input - optional, *-typed; more sockets appear as you connect.

The output is output, type *, a plain dict. This is the node to use when you want named, self-describing data rather than positional lists - a config object for a subgraph, a metadata bag, a payload for a save step. The key is that the field names are on the node, visible in the graph, so anyone reading the workflow knows what each wire means.

Where people get burned:

  • Order and count drift. The node pairs values to keys by position; if you connect a third wire while in_field only has two names, that value is silently dropped (the code indexes into the values list by position and will throw or misbehave once out of range). Keep the field list current.
  • Spacing. a, b with a space makes a key " b" - it does in_field.split(",") with no stripping. Keep it tight: a,b.
  • The *-type trap. It accepts anything, so a mismatched type won't be caught here.

It's the more "designed" of the pack/unpack pair, and the right choice whenever the downstream consumer cares about names over order. Pair it with FEDictUnpacker (which takes the same comma-separated field list) and you have a clean way to define and consume structured data entirely inside the graph.

Categoryfexli/utils

Inputs (2)

NameTypeDefaultDescription
in_fieldSTRINGa,b
inputopt*

Outputs (1)

NameTypeDescription
output*