Nodes/ComfyUI-NunchakuFluxLoraStacker/ControlAltAI: Boolean Reverse
ComfyUI Node

ControlAltAI: Boolean Reverse

A NOT gate, and the only reason it exists is the switch next to it

By ussoewwin·Created about a year ago·Updated 15 days ago· 22
ControlAltAI: Boolean Reverse
    • BOOLEAN
    ◄booleantrue►

    One boolean in, the opposite boolean out. That's a NOT gate, and ComfyUI technically didn't have one lying around, which is why a node this small is worth knowing about.

    You reach for it when a single flag needs to do two opposing jobs at once - the case people hit constantly with A/B switches. Route a signal one way when the flag is on, the other way when it's off, and instead of wiring the same toggle into two places and mentally tracking which one is inverted, you feed one Boolean Reverse and let the graph hold both states.

    How it works

    The mechanism is the entire node:

    def reverse_boolean(self, boolean):
        return (not boolean,)
    

    There's one required widget, boolean, and note the default is True - the opposite of Boolean Basic, which defaults to False. That mismatch is deliberate-ish but it will trip you up if you drop both nodes in and assume they start in the same state.

    The output is a single BOOLEAN socket. Unlike a toggle you'd wire into a bypass, this is a value, so it needs a consumer that takes a boolean input - which usually means right-clicking a toggle widget on the receiving node and picking Convert widget to input first.

    Inputs and outputs

    • boolean - required widget, default True.
    • output BOOLEAN - not boolean.

    Nothing else. No label, no second output, no type conversion.

    Where it fits in a real graph

    The canonical use in this node family is the two-way switch pattern. Pair it with a plain toggle: the raw boolean drives Switch (Two Way) in one direction, Boolean Reverse drives a second switch the other way, and now flipping one box reroutes the whole branch. The same idea applies to LoRA stack enable toggles, upscaler bypasses, or a "run the detail pass" flag that also needs to disable the base pass.

    It's also the cheapest way to make a fallback work without a fallback node. If your graph has a branch that should only fire when something isn't present or isn't wanted, invert the flag and gate it.

    Installing it

    Same pack as everything else here - the Nunchaku Flux LoRA Stacker repo, which bundles a FLUX/Nunchaku LoRA stacker, Florence-2 captioning nodes, a TensorRT CCSR upscaler and the ControlAltAI utility set. Manager search ComfyUI-NunchakuFluxLoraStacker, or:

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

    Restart afterwards. This node needs no models and no GPU. Install the whole requirements.txt anyway - the pack imports its CCSR dependencies (pytorch-lightning, taming-transformers, omegaconf, einops, open-clip-torch) at import time, and a missing one takes the entire pack down, leaving you with none of its nodes, this one included. Conversely, if nunchaku itself refuses to install, the pack is written to cope: those imports are guarded, and the utility nodes still load.

    If something's off

    The output never flips. You're probably looking at a cached run - ComfyUI only re-executes a node when its inputs change, and it decides that from the graph, not from what you see on screen. Click the widget again (or hit Ctrl+Enter after a small change) and check the console for the node executing.

    Both switches fire at once. Then you've wired the same boolean into both branches instead of inverting one of them. That's not a bug; it's the classic reason to have this node.

    The node won't appear in the menu at all. The pack failed to import. Check the startup console for the traceback - a pip dependency is the usual suspect - and note that these nodes carry an hswq_ class-name prefix to avoid colliding with the upstream gseth/ControlAltAI-Nodes pack, so a workflow saved against that pack won't find this node by class type.

    Worth saying plainly: if you already run ComfyUI core's PrimitiveBoolean plus a "not" expression somewhere, you don't need this. It's here because it completes a small logic kit that's designed to be wired together, and in that role it's the piece that makes one toggle behave like a router.

    CategoryControlAltAI Nodes/Logic

    Inputs (1)

    NameTypeDefaultDescription
    booleanBOOLEANtrue—

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN—