Nodes/ComfyUI-Fossiel-QoL-Nodes/Sensor Switch Mask
ComfyUI Node

Sensor Switch Mask

The Sensor Switch for Masks

By Fossiel·Created 10 months ago·Updated 5 months ago· 1
Sensor Switch Mask
  • mask_true
  • mask_false
  • mask
switchtrue

Masks are the quiet workhorses of inpainting, compositing, and regional workflows - and they're the kind of thing you find yourself switching between constantly: a hand-drawn inpaint mask for one run, an auto-segmentation mask for the next. This node is a two-way switch for MASK objects with the same sensor behavior as the rest of the Fossiel switch family.

Same pitch as its siblings: wire a mask into each optional input, and whichever one is actually connected gets routed through. Both connected? The switch boolean decides. Neither? You get a None back instead of a crash - forgiving while you're still building the graph.

Inputs and outputs

  • switch - boolean, default true.
  • mask_true / mask_false - optional MASK inputs.
  • mask - single MASK output.

The selection logic is identical to every node in the family: one connected input wins outright; both connected → switch on picks mask_true, off picks mask_false; none → None. Wire the output into a Set Latent Noise Mask (for inpaint), a mask compositor, or any node that consumes a MASK.

Where you'll actually use it

The practical pattern is keeping a couple of mask strategies alive in one workflow and toggling between them. Maybe mask_true is a blurred edge mask for soft inpaint blending and mask_false is a sharp one, and you flip by hand. Or you've got one mask generation branch that's sometimes bypassed - a face segmentation pass you only run sometimes - and you want the graph to keep working whether it's in or out. That "keep working either way" behavior is the sensor family's whole reason to exist.

The standard caveat

Same one as every sensor switch: ComfyUI lets data pass through a bypassed node, so when both inputs are wired the sensor won't reliably detect a bypass and auto-switch - flip the switch toggle manually. The auto-detection is for genuinely disconnected ports. For a pair of always-connected masks you're effectively just using it as a clean two-way toggle, which is fine too.

Installing it

Manager search "ComfyUI-Fossiel-QoL-Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fossiel/ComfyUI-Fossiel-QoL-Nodes
pip install -r ComfyUI-Fossiel-QoL-Nodes/requirements.txt

Restart, find Sensor Switch Mask under Fossiel/QoL. No models, no downloads - it's one of the eight-node sensor family, and if you're already using the pack's Image or Latent switches you'll recognize this one instantly.

CategoryFossiel/QoL

Inputs (3)

NameTypeDefaultDescription
switchBOOLEANtrue
mask_trueoptMASK
mask_falseoptMASK

Outputs (1)

NameTypeDescription
maskMASK