Nodes/ComfyUI-BCNodes/Logic Boolean
ComfyUI Node

Logic Boolean

A slider that behaves like a switch, and the 0.5 gotcha

By 0xBeycan·Created 23 days ago·Updated 3 days ago· 2
Logic Boolean
    • BOOLEAN
    • NUMBER
    • INT
    • FLOAT
    ◄boolean1.00►

    Sooner or later a node you need wants a BOOLEAN on a socket, and all you have is a number. Logic Boolean is the four-cent adapter: one float in, the same decision out in four types.

    What it is

    A single FLOAT widget in [0, 1], default 1, rounded to a boolean and then re-emitted in every flavour you might need. The pack's own table says it best - for a widget value of 0.7:

    | Output | Type | Value | |---|---|---| | BOOLEAN | BOOLEAN | True | | NUMBER | NUMBER | 1 | | INT | INT | 1 | | FLOAT | FLOAT | 0.7 |

    Note the last row: the FLOAT output is the unrounded input, so the node doubles as a pass-through for a numeric value you want to read from two places at once.

    How it works

    It's about as simple as a node gets: int(round(boolean)), wrapped in bool() for the first output. NUMBER is a socket type this pack defines for plain numerics - it links to any input declared as NUMBER or as the wildcard *, which is the same escape hatch every logic pack leans on.

    The interesting part is that rounding, because Python's round() does round-half-to-even, not round-half-up:

    • 0.7 → 1 → True
    • 0.51 → 1 → True
    • 0.5 → 0 → False

    That last line surprises people. Exactly 0.5 is not "half true" - it's False. If you're using this as a manual gate and you nudge the slider to the middle, you've just turned it off.

    What you'd actually use it for

    The plumbing layer's whole job is repetition and legibility, and this node is a small entry in that ledger. The three real cases:

    1. A hand-operated branch switch. Convert a boolean input on some downstream node (right click → Convert widget to input), wire this in, and you can flip behaviour from the canvas without bypassing nodes or duplicating the graph. Bypassing changes what exists; this changes what executes, which is easier to reason about later.
    2. A number that needs to become a decision. A comparison or threshold computed upstream eventually has to arrive as a real boolean somewhere.
    3. Fanning one value out. FLOAT to the thing that needs precision, INT to the thing that needs a step count, BOOLEAN to the thing that needs a yes.

    Installing it

    ComfyUI Manager → search ComfyUI-BCNodes → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/0xBeycan/ComfyUI-BCNodes
    pip install -r ComfyUI-BCNodes/requirements.txt
    

    Reload the browser tab after the restart. The logic nodes land under BCNodes/logic; typing BCNodes in the node library shows the pack's set. If you've still got a leftover ComfyUI-AutoBypass folder from the pack's earlier name, remove it and restart - it contributes duplicate nodes.

    Where people get burned

    0.5 is False. Covered above, but it's the one that generates confused posts.

    BOOLEAN sockets aren't everywhere. Plenty of nodes take a boolean as a widget (a checkbox in the node body) rather than a socket. If the input you want won't accept a link, convert the widget to an input first, then wire.

    It is not a value source for anything that outlives the run. This is a static number, not a computed one - if you need arithmetic, that's Math Expression; if you need "is this mask empty", that's Is Mask Empty. This one is you, turning a dial.

    CategoryBCNodes/logic

    Inputs (1)

    NameTypeDefaultDescription
    booleanFLOAT1.000–1—

    Outputs (4)

    NameTypeDescription
    BOOLEANBOOLEAN—
    NUMBERNUMBER—
    INTINT—
    FLOATFLOAT—