Nodes/ComfyUI Impact Pack/ImpactLogicalOperators
ComfyUI Node Runs on cloud

ImpactLogicalOperators

AND/OR/XOR two booleans into one

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
ImpactLogicalOperators
    • BOOLEAN
    operator
    bool_a
    bool_b

    A plain logic gate: pick an operator, feed it two booleans, get one boolean back. It's not in the README's own node inventory - worth knowing if you go looking for it there and come up empty - but it does exactly what its name says and needs no more explanation than that.

    Why it exists

    ComfyUI's graph doesn't have an if, so Impact Pack builds control flow out of a handful of small logic nodes: something that produces a boolean (ImpactCompare, ImpactIsNotEmptySEGS, plain ImpactBoolean toggles), something that inverts one (ImpactNeg), and this - something that combines two of them. It's the piece you need the moment a branch condition isn't a single test but two tests that both need to hold, or either one, or exactly one.

    Concrete example: you're running a loop that should keep going only while a counter hasn't hit its limit and the last detection pass actually found something. ImpactCompare gives you the counter check, ImpactIsNotEmptySEGS gives you the detection check, and this node ANDs them together into the single boolean an ImpactConditionalBranch or ImpactConditionalStopIteration actually consumes.

    The inputs and output

    • operator - an enum: and, or, xor. Standard boolean logic: AND is true only if both are true, OR is true if either is, XOR is true if exactly one is (not both, not neither).
    • bool_a, bool_b - the two BOOLEAN inputs being combined.

    Output is a single BOOLEAN. It reads and writes the same type the rest of the logic kit uses, so it composes freely - chain two of these together if you need three or more conditions combined.

    Installing it

    Standard Impact Pack install, no extra dependency for this specific node. Via ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
    cd ComfyUI-Impact-Pack
    pip install -r requirements.txt
    

    (portable: python_embeded\python.exe -m pip install -r requirements.txt), restart. No models needed - it's boolean math.

    Common issues

    There's very little to go wrong in the node itself - the mistakes here are almost always upstream, in whatever's feeding bool_a and bool_b. If a combined condition isn't behaving how you expect, isolate it: check each boolean input individually with a preview or a console node before assuming the AND/OR/XOR logic is wrong, because it isn't going to be - the bug is nearly always that one of the two inputs wasn't the value you thought it was.

    Worth saying plainly: this, like the rest of the pack's Logic category, is niche-of-the-niche. Most people who install Impact Pack are there for FaceDetailer and never open this category at all. It only matters once you're building multi-condition branches or loops by hand - outside that, you'll never miss it.

    CategoryImpactPack/Logic

    Inputs (3)

    NameTypeDefaultDescription
    operatorCOMBO3 options: and, or, xor
    bool_aBOOLEAN
    bool_bBOOLEAN

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN