Nodes/ComfyUI-JDCN/JDCN_BoolInt
ComfyUI Node

JDCN_BoolInt

One toggle, two numbers β€” True/False and 1/0 from a single switch

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 160
JDCN_BoolInt
    • boolean
    • int
    β—„Booleanfalseβ–Ί

    JDCN_BoolInt turns a single boolean switch into two things at once: the boolean itself and its integer equivalent (1 or 0). Dead simple, and it exists because ComfyUI's type system is picky in ways that don't care about your philosophical position on whether booleans are ints.

    What it's for

    A boolean input, Boolean, and two outputs:

    • boolean - True or False (BOOLEAN).
    • int - 1 or 0 (INT).

    That's the entire node - no hidden behavior, no state. True β†’ (True, 1), False β†’ (False, 0).

    The use cases are the glue between UI toggles and math:

    • Multiply a strength or weight by the int output: toggle off and the effect is multiplied by 0 (disabled), on and it's 1 (full). A one-node enable switch for any numeric parameter.
    • Feed the int into a counter or index math node where you need a numeric flag.
    • Split a toggle into both forms so you can wire the boolean into a logic branch and the number into a scale without a second node.

    Honestly, the boolean output alone does most of what people need - the int twin is there for the cases where you'd otherwise be stuck searching for an implicit bool→int conversion. ComfyUI has built-in ways to get booleans from toggles, but they don't all hand you a clean 1/0; this does, with zero fuss.

    Installing it

    Part of ComfyUI-JDCN:

    • ComfyUI Manager β†’ Install Custom Node β†’ search JDCN β†’ install ComfyUI-JDCN β†’ restart.
    • Or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart; under πŸ”΅ JDCN πŸ”΅. Only dependency is piexif, no models.

    Common issues

    There's not much to trip on with a node this small. The one thing to keep straight: it's a converter, not a latch - it reflects the current value of the toggle on each run, so if you expect it to remember or toggle state between runs, you'll be disappointed. And when you wire the int into a float input, remember you're feeding an integer; some nodes will happily accept it, others want a float - if you get a type error, route it through the pack's ConvertAny2Float first. Otherwise, this is a "install and forget" utility in the best sense.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (1)

    NameTypeDefaultDescription
    BooleanBOOLEANfalseβ€”

    Outputs (2)

    NameTypeDescription
    booleanBOOLEANβ€”
    intINTβ€”