Nodes/ComfyUI-JDCN/LogicUtil_Add Values
ComfyUI Node

LogicUtil_Add Values

Add two numbers mid-graph without a math node

By daxcay·Created 2 years ago·Updated about a year ago· 159
LogicUtil_Add Values
  • input1
  • input2
  • *

Sometimes you just need to add two numbers. Steps plus an offset. A seed plus a delta. Frames plus a lead-in. ComfyUI makes you reach for a full math-expression node for that, which is overkill and honestly annoying to type into. LogicUtil_Add Values is the "two wires in, sum out" node: input1 plus input2, output is their total. That's the entire job, and it does it without ceremony.

How it works

Both inputs are wildcard * - they accept INT, FLOAT, and friends - and the node runs Python's + operator on them. That one word, "Python's," hides a detail worth knowing: + is polymorphic, so this node isn't strictly a math node. Wire in two strings and you get concatenation ("foo" + "bar" → "foobar"). Wire in an int and a float and you get a float back. The output type is *, meaning it mirrors whatever the inputs were, so an INT+INT stays an INT and an INT+FLOAT becomes a FLOAT. Handy, and occasionally surprising.

Both inputs default to 0, so you can wire up just one and treat it as a passthrough plus offset.

Where it fits

Any place a constant doesn't work because the value is computed elsewhere in the graph. Common patterns: adding a batch_size-derived offset to an index you're feeding a loader, bumping a step count before it reaches a sampler, or summing two float parameters that were split across different widgets. Because this is a full pack install, you get it alongside the rest of the LogicUtil set (the LogicUtil_ prefix means it's a port of the aria1th LogicUtils nodes) - which means you usually grab Add while you're already using Divide or Convert in the same graph.

Install

This node ships in ComfyUI-JDCN, so it's a pack-level install. ComfyUI Manager → Install Custom Nodes → search "JDCN", or:

cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
pip install -r requirements.txt

The pack's only Python dependency is piexif (plus psutil, already in ComfyUI). No models to download.

Gotchas

  • The string trap - because * accepts strings and + concatenates them, feeding it two text wires gives you glued-together text, not a number. If your downstream expects a numeric total and you're getting "3foo", check what's on the wire.
  • Type flow - the sum carries the input types with it. If you add two ints and need a float downstream, use LogicUtil_Convert to Float before the consumer rather than assuming Add will promote.
  • Default zeros are silent - an unwired input quietly contributes 0. That's usually what you want; just don't mistake it for a missing connection you need to chase.

It's not glamorous and it's not supposed to be. It's the node you pull when the alternative is writing a four-line expression just to add a constant to a seed.

CategoryLogicUtil

Inputs (2)

NameTypeDefaultDescription
input1*0
input2*0

Outputs (1)

NameTypeDescription
**