Nodes/ComfyUI-Visionatrix/Dictionary Update
ComfyUI Node

Dictionary Update

Merge up to four dicts, later keys winning

By Visionatrix·Created 2 years ago·Updated about a year ago· 3
Dictionary Update
  • dict_1
  • dict_2
  • dict_3
  • dict_4
  • DICT

VixDictionaryUpdate is the merge node of the ComfyUI-Visionatrix dictionary family. You feed it up to four DICTs and it returns one combined dict, with a simple precedence rule: later dicts win. dict_1's keys get overridden by dict_2's, which get overridden by dict_3's, and so on.

It's the natural way to combine settings from different sources in a graph - say a base config dict from VixDictionaryConvert, overlaid with per-run overrides you built in VixDictionaryNew. One wire out carries the merged result, ready for VixDictionaryGet to pick apart.

Inputs

  • dict_1 and dict_2 are required; dict_3 and dict_4 are optional. So the minimum merge is two dicts, the maximum is four.

Outputs

One DICT output - the merged result. The merge is shallow, which matters: values are taken whole from whichever dict defined them last, and no nested dict inside a value gets deep-merged. If you're merging configs that contain sub-dicts, the sub-dict from the later dict completely replaces the earlier one, it doesn't combine.

How it works

The source is a single expression: {**dict_1, **dict_2, **dict_3 or {}, **dict_4 or {}} - the or {} is just there to keep optional empty dicts from breaking the merge. Python's dict-unpacking semantics give you the "later wins" rule for free. Keys present in both dicts keep the value from whichever came later in the argument order.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Visionatrix/ComfyUI-Visionatrix

Restart ComfyUI, or install ComfyUI-Visionatrix via ComfyUI Manager. No model downloads; deps are the stock torch/pillow/numpy.

Gotchas

Three things to remember. First, ordering is meaningful - swap dict_1 and dict_2 and the override direction flips, which is a genuinely easy way to ship a bug. Second, the merge is shallow, so don't expect nested dicts to combine; if two configs both carry a "model" sub-dict, you get one whole sub-dict, not a blend. Third, values keep their types here (it's pure dict surgery, no string coercion), so unlike VixDictionaryGet you don't have to worry about everything turning into text - but the merged output is only as typed as the inputs you fed it.

CategoryVisionatrix/Text

Inputs (4)

NameTypeDefaultDescription
dict_1DICT
dict_2DICT
dict_3optDICT
dict_4optDICT

Outputs (1)

NameTypeDescription
DICTDICT