Nodes/comfyui-obvpm/First Float (else fallback) (obvpm)
ComfyUI Node

First Float (else fallback) (obvpm)

The first value that actually exists, or a fallback you set

By chanon·Created about a month ago·Updated a day ago· 42
First Float (else fallback) (obvpm)
    • float
    fallback0.00
    float1
    float2
    float3

    The moment you add one optional branch to a workflow, you inherit a new problem: your downstream node has one socket and now two or three possible sources for it. ComfyUI has no "first non-null" switch in core, so people end up duplicating the consumer node, or wiring a chain of A/B switches and a boolean to choose between them manually.

    First Float (obvpm) is the fallback shape, and it's the right shape for this: no selector, no boolean to remember. It walks its inputs in order and hands you the first one that carries a value. If they're all empty, you get the fallback you set on the widget.

    The inputs and output

    • fallback - required FLOAT, default 0. What comes out when none of the candidates carry a value.
    • float1, float2, float3 - three optional FLOAT sockets. All three are forceInput, meaning they're sockets only, no typed widget pretending to be a candidate.
    • float - the output. The first connected input with a value, or the fallback.

    The order is positional: 1, then 2, then 3. There's no priority setting and nothing to configure beyond the fallback.

    What counts as "a value"

    This is the fine print, and it's the bit that decides whether the node does what you want. An unwired input isn't passed to the function at all, and a wired input arriving as None is passed - as None. The node skips None and takes the first thing that isn't. In the author's framing, that's the whole point: inputs fed by a gate in bypass mode are skipped over, so several optional paths can fan back into one guaranteed value.

    A zero is a value. 0.0 doesn't get skipped, and neither does a negative. That's the correct behaviour and it's also how people get confused: if you were hoping 0.0 would mean "unset", it doesn't here. Use a gate in bypass mode - Optional Any's on_empty = bypass - to produce a genuine None and this node will do exactly what you expect.

    The workflow shape it unlocks

    Say a workflow has two paths to a strength value: a user-facing ControlNet branch that computes one from a mask, and a "just use the preset" path that reads it from a Value Presets bundle. Both are optional; only one is ever live.

    [derived strength] ──┐
                         ├── First Float ──> (strength input)
    [preset strength]  ──┘
            (nothing)  ──> fallback 0.55
    

    Wire the two live candidates into float1 and float2, leave float3 free, set fallback to the number you'd have hardcoded. Now whatever happens upstream, the sampler gets a float. No second consumer node, no boolean.

    This is the direct counterpart to rgthree's Any Switch - the same first-non-null logic - but typed to FLOAT and with an explicit fallback instead of an empty result. If you want the silent-empty variant, that's what Any Switch is for; if you want "guaranteed number at the end of it", this is the one.

    Install

    ComfyUI Manager → search comfyui-obvpm, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chanon/comfyui-obvpm
    

    Restart. Category obvpm/values, node id First Float (obvpm). Zero Python dependencies. All ids in the pack carry the (obvpm) suffix, added in 0.2.0 after a class-id collision with another pack; old workflows migrate on open.

    Traps

    Three, all small:

    • It doesn't coerce. This is the FLOAT version. First Int (obvpm) is its sibling for integer sockets, and the two don't cross-convert to each other's sockets - pick the one matching the consumer's type.
    • Order is your routing. There's no "which one wins" logic beyond position, so slot choice is the priority. Put the most specific path in float1.
    • It can't recover from work that already happened. Like the gates, this decides what travels down the wire, not what gets executed upstream; if the fan-in has genuinely expensive branches, put a Lazy Switch in front of them instead of running all three and picking the result.
    Categoryobvpm/values

    Inputs (4)

    NameTypeDefaultDescription
    fallbackFLOAT0.00-1000000000000000000–1000000000000000000Output when none of the inputs carry a value.
    float1optFLOATCandidate 1: used when it is the first connected input with a value. Bypassed (None) inputs are skipped.
    float2optFLOATCandidate 2: used when it is the first connected input with a value. Bypassed (None) inputs are skipped.
    float3optFLOATCandidate 3: used when it is the first connected input with a value. Bypassed (None) inputs are skipped.

    Outputs (1)

    NameTypeDescription
    floatFLOATThe first connected input that has a value, or the fallback.