Nodes/ComfyUI Prepack/đź’€Prepack Logic Int
ComfyUI Node

đź’€Prepack Logic Int

Branch your workflow on numbers — with a built-in 'any value' escape hatch

By S4MUEL-404·Created 12 months ago·Updated 10 months ago· 2
đź’€Prepack Logic Int
  • true
  • false
  • any
  • output
â—„target_int0â–ş
â—„comparison_aA = targetâ–ş
â—„comparison_bB = targetâ–ş
â—„int_a0â–ş
â—„int_b0â–ş
â—„any_target_nameâ–ş
â—„any_nameâ–ş

ComfyUI workflows grow branches fast - "if the step count is low, use this sampler; otherwise use that one" - and vanilla ComfyUI makes conditional routing awkward. The đź’€Prepack Logic Int is the branch condition: you set a target integer, define up to two comparisons against it, and the node hands back one of the inputs you give it based on whether the comparison passes. It's an if/then for numbers, with a string-matching override bolted on that I'll get to in a second.

How it works

The core comparison is simple. target_int is the reference value. comparison_a and comparison_b are two dropdowns - each with the six options A = target, A ≠ target, A < target, A > target, A <= target, A >= target (and the same set for B). You feed int_a and int_b as the values to compare. If both comparisons hold, the node outputs whatever is on the true input; otherwise it outputs the false input.

So a "check if my width is big enough" gate looks like: target 1024, A >= target, int_a wired to your width, true → the upscale path, false → the straight-to-output path.

The interesting part is the any input and its two string fields, any_target_name and any_name. These add a string-match priority on top of the integer logic: if any_target_name is a substring of any_name (case-insensitive), the node returns the any input immediately, before the integer comparisons even run. That's a text-passthrough escape hatch - a way to force a particular branch by name ("if this checkpoint is 'realvisxl', route here") without needing a second node.

The output is a single output typed *, so it passes through whatever you put on true/false/any - a model, a conditioning, a string, anything. The node also logs its decisions to the console with a [Prepack] prefix, which is genuinely handy when a branch takes a path you didn't expect; the log tells you which case matched.

Where people get burned

The true and false inputs are both optional. If you wire only true and the comparison fails, you get None out - which then flows into whatever's downstream and produces a "value is None" style error. Wire both branches, or accept that the unconnected side is deliberately a dead end.

The string-match override trips people up more than anything. If you populate any, any_target_name, and any_name, a substring match always wins over the integer logic - it's not a fallback, it's a priority. If you're getting the any branch when you expected the int comparison to decide, that's why.

Installing it

It's part of the Prepack pack:

cd ComfyUI/custom_nodes
git clone https://github.com/S4MUEL-404/ComfyUI-Prepack.git
pip install -r ComfyUI-Prepack/requirements.txt

Or search "Prepack" in ComfyUI Manager. Dependencies are minimal (PyTorch, NumPy, Pillow). Restart, find it under đź’€Prepack. No models, no config.

If a branch seems to fire at the wrong time, read the console - the node prints which comparison case it took, and that tells you instantly whether the issue is the target value, a missing comparison, or the string-match override stealing the decision.

Categoryđź’€Prepack

Inputs (10)

NameTypeDefaultDescription
target_intINT0—
comparison_aCOMBOA = target6 options: A = target, A ≠ target, A < target, A > target, A <= target, A >= target
comparison_bCOMBOB = target6 options: B = target, B ≠ target, B < target, B > target, B <= target, B >= target
trueopt*—
falseopt*—
anyopt*—
int_aoptINT0—
int_boptINT0—
any_target_nameoptSTRING—
any_nameoptSTRING—

Outputs (1)

NameTypeDescription
output*—