Nodes/MTB Nodes/Int To Bool (mtb)
ComfyUI Node Runs on cloud

Int To Bool (mtb)

The tiny node that gates mtb's feedback-loop trick

By melMass·Created 3 years ago·Updated about a month ago· 721
Int To Bool (mtb)
    • BOOLEAN
    int0

    About as simple as a node gets, and the description says it outright: "Basic int to bool conversion, >= 1 is true." Feed it an integer, get a boolean back. Anything 1 or higher is true; 0 (and, presumably, negative numbers) is false. That's the entire node.

    The reason it's worth its own page rather than dismissing it as trivial: it's the small connective piece that makes a genuinely useful pattern work. In mtb's own reference example for Get Batch From History (mtb), this exact node sits between an Animation Builder (mtb) node's frame output (a plain INT counting up each queue run) and Get Batch From History's enable input, which needs a BOOLEAN. On frame 0, Int To Bool outputs false, so the history-fetching node skips the (still-empty) history and uses a passthrough seed image instead. From frame 1 onward it flips to true, and the feedback loop kicks in. That single wire is the difference between the loop erroring out on its very first run and working cleanly from frame zero.

    Inputs and outputs

    • int - the value to convert (default 0).
    • Output: BOOLEAN - true if int >= 1, false otherwise.

    No other settings. There's no way to flip the threshold or invert the output on this node itself - if you need the opposite logic, you'd add a separate boolean-invert node after it, or restructure which branch of your graph runs on true vs false.

    Where else you'd use it

    Any time something upstream hands you an integer - a frame counter, an item count from Image Batch To Sublist (mtb), a loop index - and something downstream needs a plain on/off gate instead. It's the kind of node you don't plan around in advance; you hit the type mismatch first, then reach for this.

    Installing it

    • ComfyUI Manager - search "MTB Nodes", install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb, restart. A manual clone needs pip install -r requirements.txt run inside the comfy_mtb folder first.

    Nothing to it dependency-wise - this is a handful of lines of Python doing a comparison.

    Common issues & troubleshooting

    It's true when you expected false, or vice versa. Remember the threshold is >= 1, not > 0 in some looser sense and not != 0 - a negative integer is also false under this rule, same as 0. If your upstream counter can go negative and you were expecting only 0 to read as false, that's the gap to check.

    You need the inverted logic and there's no toggle. There isn't one on this node - swap which branch of your graph treats true/false as "go" instead, or chain a separate boolean-not node if your setup has one.

    Some mtb nodes fail to load at startup. Standard for this pack given how many nodes it ships at once - check the console for [comfy_mtb] STATUS and http://127.0.0.1:8188/mtb for what didn't load. This node is about as dependency-free as they come, so it's essentially never the one missing.

    Categorymtb/number

    Inputs (1)

    NameTypeDefaultDescription
    intINT0

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN