Nodes/ComfyUi-MpiNodes/Mpi Boolean Invert
ComfyUI Node

Mpi Boolean Invert

One wire in, the opposite wire out

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Boolean Invert
    • inverted
    boolean

    Sometimes you just need the opposite of a boolean, and this is the node for exactly that. Mpi Boolean Invert is a pass-through NOT gate: a boolean goes in, its inverse comes out. true becomes false, false becomes true, nothing else happens, there are no settings. It is the smallest useful node in the pack, and it earns its place by keeping your graph honest.

    The notable detail is in how the input is declared: boolean is forceInput - wire-only, no widget. The source comment says it plainly: "a NOT gate has nothing to set by hand, so the input is wire-only." You can't type a value and flip it; you have to connect something. That's deliberate, and it's the same design choice as MpiBooleanCompare's inputs. The single output is inverted.

    Why does such a trivial node matter? Because ComfyUI's logic vocabulary is mostly positive. Boolean conditions come out of checkers, comparers, and if/else nodes in the form "this thing is true," and the graph around them frequently wants the negation - "run the fallback when the main path is not active," "stop when the detector says no face." Without an invert node you'd be wiring an if/else with a false branch, or contorting a comparison to produce the opposite polarity, and both of those are harder to read than a single explicit NOT. In the KB's framing, this is the plumbing layer's version of a language primitive: one node per concept, so the graph reads like a sentence instead of a tangle.

    A realistic example: Mpi Any Checker gives you has_value - true when a wire holds something. You want the empty case to do the work. Instead of rewiring the checker's output through a whole conditional, drop Mpi Boolean Invert on has_value and feed the inverted result into your gate. "Not has value" is now a first-class wire. Same idea with MpiBooleanCompare's both_true: invert it and you've got "not both true," which is the not_both_true mode spelled out in two nodes when you need to combine it with other logic.

    The honest caveat: it does not handle other types. If you feed it an integer or a string, you're doing it wrong - this is strictly boolean-in, boolean-out. For general type inversion you'd be in the wrong node entirely; for numeric negation you'd want a math node. Within its lane, though, it's fire-and-forget.

    Install is the 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 requirements file, no model downloads - pure Python on top of what ComfyUI already ships, the same utility pack that backs the Cubric Vision app.

    CategoryMpiNodes/Logic

    Inputs (1)

    NameTypeDefaultDescription
    booleanBOOLEAN

    Outputs (1)

    NameTypeDescription
    invertedBOOLEAN