Nodes/MachinePainting Nodes/πŸ‘Ύ Boolean Input Value Switch
ComfyUI Node

πŸ‘Ύ Boolean Input Value Switch

Turn a float into a yes/no decision

By machinepaintingΒ·Created 10 months agoΒ·Updated 4 months agoΒ· 9
πŸ‘Ύ Boolean Input Value Switch
    • boolean
    β—„FLOAT_inputβ€”β–Ί
    β—„true_min0.51β–Ί
    β—„true_max1.00β–Ί
    β—„false_min0.00β–Ί
    β—„false_max0.50β–Ί
    β—„overlap_behaviorrandomizeβ–Ί

    Say you've got a seed or a random float in your graph and you want to branch on it: "if this value lands above 0.5, take the cinematic route, otherwise go flat." Normally that's a little dance with math nodes and a comparison. Boolean Input Value Switch does it in one node by mapping an input float to a true/false output, based on which of two ranges the value falls into. It's a threshold, but a properly opinionated one.

    How it works

    You define two ranges: a true range and a false range, each as a min/max pair:

    • true_min / true_max (defaults 0.51–1.0)
    • false_min / false_max (defaults 0.0–0.5)

    The incoming FLOAT_input gets tested against both. If it's in the true range you get true; in the false range you get false. The defaults are set up so anything 0–0.5 is false and 0.51–1.0 is true, which is a natural mapping for a 0–1 random value.

    The genuinely clever part is overlap_behavior. Real values don't always play nice, so when a value lands in both ranges you get three options:

    • randomize - flip a coin each run.
    • force_true / force_false - break the tie deterministically.

    Note that "randomize" re-evaluates on every queue run, so it's genuinely random per run rather than cached. If you want a stable decision from a fixed seed, pick one of the force modes or widen your ranges so there's no overlap.

    Inputs you'll actually set

    The FLOAT_input is the only required data input - and it's forceInput, meaning it must arrive on a wire (you can't just type a number). Set the four range values to carve out your decision boundary. That's the whole surface area: five numbers and a behavior dropdown, one boolean out.

    Where it fits

    The output is a BOOLEAN, which slots straight into the pack's other switch nodes - Boolean Switch Value Output to pick a number, Boolean Master Switch to fan out a decision, or any node with a boolean input. It's niche, but for anyone building "choose a path based on a generated value" logic without writing a custom node, it's the missing link.

    Install

    Part of MachinePainting Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/machinepainting/ComfyUI-MachinePaintingNodes.git
    pip install -r requirements.txt
    

    Or ComfyUI Manager β†’ search "MachinePaintingNodes" β†’ install β†’ restart.

    Gotchas

    The quiet trap is range math you don't notice: if your true and false ranges overlap and you've left overlap_behavior on randomize, the same value can flip-flop between runs and you'll swear the graph is haunted. That's the tooltip's whole warning - "what to do when value falls in both ranges" - and it's worth resolving deliberately. Also, values outside both ranges default to false, so a float of 2.0 with the default ranges reads as false, not true. Set your bounds accordingly.

    CategoryMachinePaintingNodes/Util

    Inputs (6)

    NameTypeDefaultDescription
    FLOAT_inputFLOATβ€”
    true_minFLOAT0.51-9999–9999β€”
    true_maxFLOAT1.00-9999–9999β€”
    false_minFLOAT0.00-9999–9999β€”
    false_maxFLOAT0.50-9999–9999β€”
    overlap_behaviorCOMBOrandomizeWhat to do when value falls in both ranges

    Outputs (1)

    NameTypeDescription
    booleanBOOLEANβ€”