First Int (else fallback) (obvpm)
One integer out of three maybe-sources, guaranteed
- int
Seed. Steps. Width, height, batch size, frame count. Almost every number you'd want to branch on is an integer, and integer sockets are where ComfyUI's lack of a core first-non-null node hurts most - you can't fudge it with a multiply, and None into an INT input just errors.
First Int (obvpm) is the plain fix. Three optional integer inputs, checked in order; the first one that carries a value comes out. If none do, you get the fallback on the widget. That's the entire node.
Inputs and output
fallback- required INT, default0. Bounded generously (about ±9 × 10¹⁵), which is more room than any seed or step count needs.int1,int2,int3- optional INT sockets, socket-only by design.int- the output: the first connected input with a value, else the fallback.
Why "first connected that carries a value" is the honest description
An unwired optional input simply isn't passed to the node. A wired input whose upstream produced None arrives as None, and gets skipped. That's what makes the node usable with optional branches at all: the text in the author's tooltip - bypassed (None) inputs are skipped - is the load-bearing behaviour, not a footnote.
0 is a value, though. So if your seed logic wants "0 means unset", it doesn't work that way; you need something upstream to genuinely output None (an Optional gate in bypass mode is the tidy way).
Three good uses
Conditional seeds across branches. A graph where two different samplers can run - pick the seed from whichever branch is live, with the fallback acting as the default when you've disconnected both to test something.
Sizing that follows the input. Feed int into width and another into height, sourced from whichever of a "user override" path or a "derive from the loaded image" path is connected. Reading the fallback off a widget means the graph still queues with nothing wired at all, which is exactly when you're sketching.
Frames, steps, batch. Any place where one branch decides a number for you (a preset, a dropdown's index output, a subgraph's exposed input) and you want a hardcoded default otherwise. Set the fallback to the value you'd otherwise have typed, and the branch becomes genuinely optional instead of mandatory.
First Int vs the alternatives
- A core
PrimitiveIntholds one number and fans it out. It has no notion of "first available" - this node is what you put in front of it when the source is conditional. - rgthree's
Any Switchdoes the same first-non-null walk, untyped, and outputs nothing at all when everything is empty. If you want a guaranteed number, you want the version with a fallback. If you want "empty means empty", you don't. - An A/B switch plus a boolean works, and it's the shape most people build first. It's also two nodes and a setting to keep in sync for every value you route, which stops being fun at about the third one.
Install
ComfyUI Manager → search comfyui-obvpm, or:
cd ComfyUI/custom_nodes
git clone https://github.com/chanon/comfyui-obvpm
Restart ComfyUI; the node appears under obvpm/values as First Int (obvpm). No Python dependencies and no models - this is a pure logic node. As of 0.2.0 every node id in the pack ends in (obvpm), which is why a node-menu search for obvpm is the fastest way to browse the whole set; workflows saved before that change migrate when opened.
Traps
The one that bites: this node doesn't stop upstream work. All three candidate paths may still execute if they're wired to something else too - a fan-in decides what travels down a wire, not what runs. If a candidate branch is expensive (a detail pass, an upscale, a second sampler), gate it or put a Lazy Switch in front of it, so the branch you didn't pick costs nothing. Otherwise you're paying for both paths and then throwing one away, which is a real slowdown on a video workflow and invisible on the canvas.
It also won't touch a -1 or a 0 for you. Nothing here infers meaning from sentinel values, which is the right call - but it does mean sentinel-based workflows need their own gate before this node, not after it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| fallback | INT | 0-9007199254740992–9007199254740992 | Output when none of the inputs carry a value. |
| int1opt | INT | Candidate 1: used when it is the first connected input with a value. Bypassed (None) inputs are skipped. | |
| int2opt | INT | Candidate 2: used when it is the first connected input with a value. Bypassed (None) inputs are skipped. | |
| int3opt | INT | Candidate 3: used when it is the first connected input with a value. Bypassed (None) inputs are skipped. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int | INT | The first connected input that has a value, or the fallback. |