Nodes/dn_little_helpers/Boolean to Other
ComfyUI Node

Boolean to Other

The tiny converter that finally got 1-based selectors right

By DN2048·Created 7 months ago·Updated 7 months ago· 0
Boolean to Other
    • INT
    • STRING
    • BOOLEAN
    booleanfalse
    plus_onefalse

    ComfyUI is relentlessly typed, and the type it fights over most is the boolean. You'll have a clean true/false toggle on one side of the graph and a node on the other side that wants an INT, or a STRING, or a number that starts counting at 1 instead of 0. Boolean to Other (node class DNLHBooleanToOther) is a two-input, three-output glue node from the small dn_little_helpers pack that exists to settle exactly that argument. There's nothing clever about it - that's the point. It's the kind of node you add once, forget, and quietly miss when you rebuild a workflow without it.

    Here's the whole mechanism, in full: a one-line Python expression. Give it a boolean and it returns three outputs at once - the same value as an INT, a STRING, and a pass-through BOOLEAN. No models, no network, no hidden dependencies. The pack's pyproject.toml lists zero runtime dependencies, so this is as safe a node to install as any exists.

    Two inputs, and only one of them needs your attention:

    • boolean - the toggle you want converted. Default false.
    • plus_one - the interesting one. When on, it adds 1 to the INT output. false becomes 1 and true becomes 2.

    That plus_one flag is the reason to reach for this node over the stock converters. ComfyUI is full of 1-based selectors and index inputs, and the classic trap is a toggle feeding a 0/1 into something that expects 1/2, silently shifting every selection off by one. With plus_one checked, the arithmetic just works: true → 2, false → 1.

    The three outputs all fire at once, so you wire whichever one you need and let the others dangle:

    • INT - 0/1, or 1/2 with plus_one.
    • STRING - "True" / "False".
    • BOOLEAN - the original value, unchanged.

    Typical use: driving a scheduler, sampler, or selector node from a single toggle, or turning a comparison result into an int for some math. It plays nicely alongside workflow-organizing packs like rgthree - the boolean often comes out of a condition or a muter state, and this node is the adapter that gets it into a numeric input.

    Installing it is the standard dance. In ComfyUI Manager, search for DN Little Helpers (the repo is DN2048/dn_little_helpers) and hit install, or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DN2048/dn_little_helpers
    

    Then restart ComfyUI. That's the entire install - no model downloads, no extra pip packages, nothing to babysit. The README itself was generated from the official Comfy-Org cookiecutter template, which is why it reads so cleanly.

    One honest limitation: the STRING output is always the capitalized Python-style "True" / "False". If a downstream node needs lowercase "true" or "yes"/"no", this node won't give it to you - you'd need a different utility or a tiny custom converter. It's a deliberately minimal tool, and knowing its one edge saves you a confused five minutes. For everything else, it just works, which is the highest compliment a two-line node can get.

    CategoryDNLH_Nodes

    Inputs (2)

    NameTypeDefaultDescription
    booleanBOOLEANfalseThe boolean you want to convert
    plus_oneBOOLEANfalseAdds 1 to the INT output. Useful for selectors that start on 1. (false = 1, true = 2)

    Outputs (3)

    NameTypeDescription
    INTINT
    STRINGSTRING
    BOOLEANBOOLEAN