Nodes/ComfyMath/BoolUnaryOperation
ComfyUI Node

BoolUnaryOperation

Flip a true to a false

By evanspearman·Created 3 years ago·Updated about a year ago· 192
BoolUnaryOperation
    • BOOLEAN
    op
    afalse

    BoolUnaryOperation is as small as ComfyMath gets: one operation, Not, which flips a boolean - true becomes false and vice versa. There's no dropdown decision to make here, because there's only one thing a unary operation on a boolean can even mean. You reach for this when you've computed a condition somewhere else in the graph (with BoolBinaryOperation or FloatBinaryCondition, say) and you actually need the opposite of it - "run this unless X" instead of "run this if X."

    How it works

    a (BOOLEAN, default false) in, its inverse comes out. That's the entire operation.

    The inputs and outputs that matter

    • op - technically a dropdown, but with a single choice (Not) there's nothing to pick between.
    • a - the boolean to invert.
    • Output - a single BOOLEAN, the logical opposite of a.

    Installing it

    ComfyUI Manager: search ComfyMath, install, restart. Manually:

    cd ComfyUI/custom_nodes && git clone https://github.com/evanspearman/ComfyMath
    

    then restart. No extra pip dependencies, no models - the whole pack installs in under a minute.

    Common issues

    Given how simple this node is, there's really only one thing to know: it doesn't route anything on its own. Inverting a condition is only half the job - you still need a downstream node built to actually consume a boolean and branch or gate on it (rgthree-comfy's Any Switch is a common choice for that), since ComfyMath's own node set doesn't include a general switch. This node just gives you the flipped answer; something else has to act on it.

    Because it's a single, trivial pure-function node - no external calls, no state, nothing that touches the filesystem or a model - it's about as low-risk as a custom node gets, and correspondingly the least likely node in this whole pack to ever be the actual cause of a problem you're debugging. If your workflow isn't behaving the way you expect after adding a Not, the far more likely culprit is what you're feeding into it or what's consuming its output, not the inversion itself.

    Same standing note as the rest of ComfyMath: no active maintenance since roughly early 2024 by community accounts, which for a node this size genuinely doesn't matter - there's nothing here that a ComfyUI update is likely to break in the first place.

    Worth a mental note if you're new to the pack: ComfyMath keeps unary and binary operations as separate node types throughout (BoolUnaryOperation here versus BoolBinaryOperation for two-input logic, and the same split for floats, ints and the generic NUMBER type). If you go looking for Not and land on BoolBinaryOperation's dropdown instead, you're one node off - its eight operations are all two-input gates, and inversion lives here.

    Categorymath/bool

    Inputs (2)

    NameTypeDefaultDescription
    opCOMBO1 options: Not
    aBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN