Nodes/ComfyUi-MpiNodes/Mpi Boolean Compare
ComfyUI Node

Mpi Boolean Compare

The eight-way boolean comparison you'll actually use once you see it

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Boolean Compare
    • result
    atrue
    btrue
    mode

    Boolean logic in ComfyUI is usually a pain because you end up stacking nodes to express things like "both of these are true" or "exactly one of these is on." Mpi Boolean Compare collapses that whole mess into a single node with a dropdown. Two booleans in, one result out, and the mode menu picks which of eight relationships you mean.

    The modes, read straight from the node: equal, not_equal, both_false, both_true, a_true_b_false, a_false_b_true, one_is_true, and not_both_true. That covers the everyday boolean vocabulary - equality, AND-ish combos (both_true), OR-ish combos (one_is_true), NAND (not_both_true), and the two directional "one but not the other" checks that are surprisingly handy for routing. a and b are the two inputs, both forceInput booleans (they're meant to be wired, not typed - the source shows label_on/label_off styling and no free widget), and the single output is result, a BOOLEAN.

    The output is the boring part in the best way: it's a plain boolean, so it plugs straight into an if/else, a blocker, or a switch. The value of this node is that you never have to decompose "is this condition right" into a chain of primitive logic nodes again - you pick the phrase that matches the thought and move on. It's the boolean equivalent of what MpiCompare does for general values: one operation, named, with no wiring surprises.

    A pattern that shows why the directional modes exist: say you have a workflow with two optional features, each enabled by a boolean from upstream. You want to run a special pass only when feature A is on and feature B is off (maybe B is a fallback that supersedes A). a_true_b_false is literally that condition, one dropdown away. Or you want a validation gate that fails unless both inputs agree - equal gives you "same state," and not_equal gives you "state changed," which is useful for detecting a toggle flip between runs.

    Two honest notes. First, the inputs are wire-driven by design - if you just want to type two values and compare them, this isn't the node; you'd type them into widgets or use a source boolean and compare. Second, all eight modes are just combinations of the two inputs, so if you find yourself needing a relationship that isn't in the list - and there aren't many - you can build it from a/b and a couple of MpiBooleanInvert gates. The dropdown exists to save you exactly that work in the common cases.

    Install is pack-standard: ComfyUI Manager → search ComfyUi-MpiNodes → install, or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
    

    Restart, and it's under MpiNodes/Logic. No dependencies beyond ComfyUI itself - pure Python utilities, no model files, and the same pack that powers the open-source Cubric Vision desktop app.

    CategoryMpiNodes/Logic

    Inputs (3)

    NameTypeDefaultDescription
    aBOOLEANtrue
    bBOOLEANtrue
    modeCOMBO8 options: equal, not_equal, both_false, both_true, a_true_b_false, a_false_b_true, +2

    Outputs (1)

    NameTypeDescription
    resultBOOLEAN