Nodes/ComfyUI-JakeUpgrade/Boolean JK๐Ÿ‰
ComfyUI Node

Boolean JK๐Ÿ‰

A true/false in, three datatypes out โ€” the tiny converter that unclogs switch graphs

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
Boolean JK๐Ÿ‰
    • boolean
    • number
    • int
    โ—„boolean_valuefalseโ–บ

    ComfyUI is aggressively typed on the wire: a BOOLEAN socket won't happily feed an INT socket, and if you want to drive a seed or a step count from a checkbox, you need a conversion in between. Boolean JK๐Ÿ‰ is that conversion - one toggle in, and you get the same value out as boolean, number, and integer, so you can wire whichever datatype the next node actually wants.

    It's the smallest node in JakeUpgrade's switch family, but it's the one that makes the rest of them useful. Every "Input Switch" node in this pack takes a boolean_value to pick between two inputs; when you want that condition to also mean something numerically - "if true, steps = 40, else 20" - this node turns the same checkbox into a 1 or a 0 you can pipe anywhere.

    How it works

    Read the source and it's five lines:

    numeric_value = 1 if boolean_value else 0
    return (boolean_value, float(numeric_value), numeric_value)
    

    True becomes 1, False becomes 0, and you get all three representations simultaneously. No state, no surprises - it's a pure mapping.

    The single input, boolean_value, is a plain toggle. The three outputs are named boolean, number, and int:

    • boolean โ†’ BOOLEAN, same as input (a pass-through you can use to branch again).
    • number โ†’ NUMBER (a float, so nodes that expect continuous values are happy).
    • int โ†’ INT (for seeds, step counts, switch indices).

    Because the outputs are all live at once, one toggle can drive a seed node, a resolution choice, and another switch's condition without any extra converter nodes cluttering the graph.

    Where you'd reach for it

    The classic pattern in JakeUpgrade's own workflows: a "quality vs speed" checkbox. Checked โ†’ int output feeds a high step count and a high-res latent; unchecked โ†’ everything routes the fast path. Or chain it into an Int Input Switch where the boolean decides which constant gets through. It also plays well with rgthree-style seed/context plumbing - the boolean output lets you keep a condition in the graph after it's been converted for a numeric consumer.

    Install

    Part of ComfyUI-JakeUpgrade: ComfyUI Manager โ†’ search ComfyUI-JakeUpgrade, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade && pip install -r requirements.txt
    

    Nothing to configure, no models. It's under the ๐Ÿ‰ JK/๐Ÿ”€ Switch menu category. If you search the node palette and it's missing, check the pack's config.ini - modules are toggleable there, and the switch module is on by default, so it should just be present. That's about the whole troubleshooting story for this one; a five-line converter doesn't leave much room to go wrong.

    Category๐Ÿ‰ JK/๐Ÿ”€ Switch

    Inputs (1)

    NameTypeDefaultDescription
    boolean_valueBOOLEANfalseInput boolean value to convert

    Outputs (3)

    NameTypeDescription
    booleanBOOLEANโ€”
    numberNUMBERโ€”
    intINTโ€”