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

Int To Bool JK๐Ÿ‰

Zero is False, everything else is True

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

    The inverse of "True becomes 1": CM_IntToBool takes an INT and returns True when it's non-zero, False when it's exactly zero. One input, one BOOLEAN output, no other options. It's the node that lets a number decide something.

    When a number should make a decision

    ComfyUI has plenty of places that output numbers but where you really want a yes/no:

    • A node reports a count (faces detected, frames, LoRAs in a stack) and you want "did we get any?" - convert and feed a switch.
    • An index or ID from a list operation - is it 0, or is it something real? Non-zero โ†’ true is the "there's actually an entry here" test.
    • You have integer math (say, seed % 2) and want its result as a branch: even/odd from arithmetic feeding a boolean input.

    A clean pattern: compute something in CM_IntBinaryOperation or CM_IntUnaryOperation, pipe it through this node, and drive a Bool gate or switch with it. Combined with CM_BoolToInt you can go number โ†’ decision โ†’ number again, which is how a lot of self-adjusting graphs end up wired.

    Installing it

    Ships with ComfyUI-JakeUpgrade:

    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.

    Gotchas

    • This is strict a != 0 - and yes, that's Python truthiness. Negative numbers are True. That's usually what you want ("any value"), but if you meant "positive," check CM_IntUnaryCondition's IsPositive instead.
    • The exact-zero case is the trap. If your upstream math can produce 0 when you expected "something," this node will quietly say False. Pair it with a condition node when the boundary matters.
    • Manager's JakeUpgrade / IPAdapter_plus conflict warning is a false positive from the pack's replacement/ folder.
    • ComfyUI-MultiGPU causes CUDA errors on recent ComfyUI; the README says to disable it.
    Category๐Ÿ‰ JK/โœ–๏ธ Math/๐Ÿ’  Conversion

    Inputs (1)

    NameTypeDefaultDescription
    aINT0Input integer value to convert

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEANโ€”