Nodes/Difforum/Difforum · Workflow Switches
ComfyUI Node

Difforum · Workflow Switches

The on/off panel that actually knows your graph

By chillithebillis·Created 4 months ago·Updated 11 days ago· 10
Difforum · Workflow Switches

      Every big workflow ends up with the same problem: you want the same graph to do a fast previz and a full render, and the difference is five nodes deep in the middle of it. So you hunt for the bypass arrows, you miss one, and twenty minutes of sampling later you work out that the preview pass ran on the wrong payload.

      Difforum · Workflow Switches is a control panel for exactly that. It has no inputs, no outputs, and runs nothing - the node itself is a UI widget. What it does is find the groups in your workflow and give you one switch per group, plus a ⌖ button that jumps the canvas to it.

      How the switching actually works (and why it's better than a wrapper)

      The state doesn't live in some custom execution layer - it's written into the nodes' own mode. A group that's turned off gets its members muted (mode 2) when the group contains an output node such as a Previz or a Render, because nothing downstream needs it; a group in the middle of the chain - Live Preview, Fill Reveal, Restyle, Look Mix, Upscale - gets bypassed (mode 4) instead, so data passes straight through and the rest of the graph keeps running. That's the right call on both counts: muting a middle block would cut the wire and kill everything downstream.

      Because it's the real node mode, three nice things follow for free. It survives save and load. It stays in sync with manual Ctrl+M / Ctrl+B, so a node you bypassed by hand shows up as part of the group's state instead of being silently overwritten. And when you flip a group back on, each member returns to its own previous mode rather than everything being forced to active, which means the optional LoRA you deliberately had bypassed is still bypassed.

      There's one more piece of housekeeping worth knowing: if you mute a group that some other output node depends on, the node mutes those downstream outputs too, and remembers which ones it muted so it can put them back when you re-enable the group. Without that, ComfyUI would throw a validation error at queue time for a node whose input no longer exists.

      Group detection, which is positional

      The node finds each group by looking at the rectangle of the group frame and testing whether a node's centre falls inside it. That's it. It's a clean implementation of a slightly awkward rule, and it means group membership is a visual fact rather than a wiring one - drag a node half out of the group box and it stops being switched by that group. Which is worth remembering when you tidy a workflow and suddenly your "Render" switch no longer turns off the sampler.

      Install

      ComfyUI Manager → search Difforum, or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/chillithebillis/Difforum.git difforum
      

      Restart, then reload the browser tab - the panel is JavaScript, so a full page refresh is what registers the widget. numpy is the only declared dependency; none of this touches Python at runtime. Every Difforum template (Templates → Difforum) ships with the panel already in place and the graph laid out in named blocks, which is the layout it was designed against: Control, Direction and Previz on the top row, Models → Render → Restyle → Upscale 2K → Output along the bottom.

      Where people get burned

      The honest answer is that this node is fixing something ComfyUI already sort of does, and it earns its place in their templates specifically because those templates are built around named groups. Copy the panel into a hand-rolled workflow with no groups and you get an empty widget - there's nothing for it to switch. Build the groups first.

      Two smaller traps. Copying the graph into a new workflow but pasting only some of the nodes means the panel still lists a group whose members aren't all there; you'll see the switch flip and effect nothing. And because a switched-off group is muted rather than deleted, the render outputs inside it disappear from the run entirely - so if you press Queue, the progress bar does nothing and the workflow finishes in a second, that's usually the Render switch off, or the Previz-only state you set earlier and forgot about. The pack's templates put a note block next to the panel for exactly this reason; read it before you assume ComfyUI is broken.

      CategoryDifforum/1 · Setup

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs