Nodes/ComfyUI-JakeUpgrade/Bool To Int JK๐Ÿ‰
ComfyUI Node

Bool To Int JK๐Ÿ‰

True becomes 1, False becomes 0 โ€” converting a toggle into math

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
Bool To Int JK๐Ÿ‰
    • INT
    โ—„afalseโ–บ

    Booleans are great for toggles and switches, useless for arithmetic. CM_BoolToInt is the one-liner bridge: feed it a BOOLEAN, get an INT - True โ†’ 1, False โ†’ 0. That's the entire node, and the trick is how often you need it.

    Why convert a boolean to a number?

    Because a 0/1 is a multiplier, a gate, and an index all at once:

    • Multiply a strength by on/off. Want a detail pass at strength 0.6 that a toggle can disable? Wire the toggle through this node into a float math node and multiply. Disabled = 0 ร— anything = nothing runs.
    • Index into a list or switch. A two-way switch keyed by an int takes 0 or 1 - a boolean converted cleanly drives it.
    • Build counters. Sum a bunch of condition results and you get "how many of these conditions are true," a useful number for branching logic.

    Input is a (BOOLEAN), output is INT. The sibling conversion in the other direction - CM_IntToBool, where 0 โ†’ False and anything non-zero โ†’ True - completes the round trip.

    Installing it

    It's one node in the ComfyUI-JakeUpgrade pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    # Windows standalone: install.bat
    # or: python_embeded\python.exe -s -m pip install -r requirements.txt
    pip install -r requirements.txt   # non-Windows
    

    Or ComfyUI Manager, search "JakeUpgrade", install, restart. Nothing to download.

    Gotchas

    • It converts, it doesn't coerce mid-expression. Wire the boolean in before arithmetic; there's no "true counts as 1" magic inside other math nodes in this pack.
    • Use it with the pack's condition nodes. An Int or Float condition spits out a boolean; converting that to 0/1 and multiplying is the cleanest way to turn a condition into a continuous influence instead of a hard gate.
    • Manager's JakeUpgrade / IPAdapter_plus conflict warning is a false positive from the pack's replacement/ folder.
    • ComfyUI-MultiGPU causes CUDA errors with recent ComfyUI - disable it per the README.
    Category๐Ÿ‰ JK/โœ–๏ธ Math/๐Ÿ’  Conversion

    Inputs (1)

    NameTypeDefaultDescription
    aBOOLEANfalseInput boolean value to convert

    Outputs (1)

    NameTypeDescription
    INTINTโ€”