Nodes/ComfyUI Web Viewer/Trigger Toggle x4 @ vrch.ai
ComfyUI Node

Trigger Toggle x4 @ vrch.ai

Four latched switches in one node

By VrchStudio·Created 2 years ago·Updated about a month ago· 358
Trigger Toggle x4 @ vrch.ai
    • OUTPUT1
    • OUTPUT2
    • OUTPUT3
    • OUTPUT4
    • JSON
    initial_state1false
    initial_state2false
    initial_state3false
    initial_state4false
    debugfalse
    trigger1
    trigger2
    trigger3
    trigger4

    Trigger Toggle x4 is the same one-bit latch as the pack's single Trigger Toggle, repeated four times in one node. Four independent flip-flops, each with its own trigger input and its own boolean output, plus one combined JSON output that reports all four states at once. If you need multiple latched switches in a workflow - and once you start building interactive graphs you always do - this collapses four nodes of clutter into one box.

    How it works

    Each channel is a self-contained T flip-flop. trigger1 through trigger4 are the pulse inputs: feed one a true and its output flips. initial_state1 through initial_state4 set where each starts (all default OFF). The outputs are OUTPUT1 through OUTPUT4, each a plain BOOLEAN.

    The interesting output is JSON: it mirrors all four channel states in one structure. Feed that into a JSON-aware node and you get the whole switch bank as data - useful for logging, for driving a status display in a web viewer, or for any logic that wants to see the combined state rather than four loose booleans.

    The channels are fully independent, so you can use them for four unrelated things or gang them into a single multi-position control. There's no shared state and no interaction between them.

    Where it fits

    The natural driver is the pack's SWITCH OSC Control - eight OSC toggles in, and you want a few of them latched so they survive whatever the controller does next. Feed four of those switches into this node's four triggers and you've got four persistent states you can toggle from a tablet without ever touching the graph. The x4 version is the sweet spot for most builds: prompts on/off, branch mutes, effect toggles - four is usually enough, and when it isn't, the pack has the x8.

    Installing it

    Standard pack install:

    1. ComfyUI Manager → search ComfyUI Web Viewer → install.
    2. Manual:
      cd ComfyUI/custom_nodes
      git clone https://github.com/VrchStudio/comfyui-web-viewer
      pip install -r requirements.txt
      
      Windows portable: python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\comfyui-web-viewer\requirements.txt.
    3. Restart ComfyUI.

    No models or extra config. The pack's requirements.txt bundles the optional Music2Emotion stack, which slows the first install but has nothing to do with this node.

    Gotchas

    Same rules as the single toggle, times four. Each triggerN is optional and default-empty - an unconnected channel just sits at its initial_state, so check your wires before assuming a channel is broken. And remember these are pulse latches: feed a channel a continuous high and it will flip on one execution and flip back on the next. Drive them with momentary pulses, not held levels. Enable debug if a channel ever misbehaves and the console will show you what's landing.

    Categoryvrch.ai/logic

    Inputs (9)

    NameTypeDefaultDescription
    initial_state1BOOLEANfalse
    initial_state2BOOLEANfalse
    initial_state3BOOLEANfalse
    initial_state4BOOLEANfalse
    debugBOOLEANfalse
    trigger1optBOOLEAN
    trigger2optBOOLEAN
    trigger3optBOOLEAN
    trigger4optBOOLEAN

    Outputs (5)

    NameTypeDescription
    OUTPUT1BOOLEAN
    OUTPUT2BOOLEAN
    OUTPUT3BOOLEAN
    OUTPUT4BOOLEAN
    JSONJSON