πΎ Boolean Switch Value Output
The ternary operator, now with a wire
- INT
- FLOAT
This is the node for "if this toggle is on, use 0.7, otherwise use 0.25" - a plain conditional value picker that outputs the same result as both an INT and a FLOAT. If you've ever built that with three math nodes and a switch, you know exactly why this exists. One boolean decides, two numbers are the options, and out comes the winner in whatever type your downstream node wants.
How it works
You set true_value (default 1) and false_value (default 0), then feed a boolean. On true you get true_value back, on false you get false_value. The output comes in two flavors at once - INT and FLOAT - so you don't have to think about what the receiving node expects. The boolean is optional: leave it disconnected and the node simply defaults to true, which makes it a very small, very boring constant node. Wire it up and it earns its keep.
The inputs that matter
true_valueandfalse_value- the two candidate numbers, both -9999 to 9999 with 0.01 steps. These are the only two you'll actually set.boolean(optional) - where you connect your decision source: a Boolean node, a Boolean Master Switch, a Boolean Input Value Switch, or anything else that emits a boolean wire.
Since it emits INT and FLOAT side by side, the classic trick is using it to pick a CFG, a denoise strength, a mask expand amount, or a seed - anything numeric that has two "moods." It's the glue between a toggle and a number-hungry node, and it removes about three nodes from the equivalent hand-rolled graph.
Where it fits in the pack
The MachinePainting boolean family is a small ecosystem: Boolean makes the signal, Boolean Input Value Switch derives a boolean from a float, Boolean Master Switch fans one toggle out to many, and this node converts a boolean back into a number. They chain together cleanly - float β decision β number - which is the kind of logic ComfyUI's default nodes make surprisingly awkward.
Install
Standard MachinePainting Nodes install:
cd ComfyUI/custom_nodes
git clone https://github.com/machinepainting/ComfyUI-MachinePaintingNodes.git
pip install -r requirements.txt
Or ComfyUI Manager β "MachinePaintingNodes" β install β restart.
Gotchas
Two small things. First, the INT output is a truncated/rounded cast of the float you set - if you put 1.5 in true_value, the INT output is 1, so if you need an exact integer, set your values as integers in the first place. Second, values are stored as floats in the node, so a "false" of 0.0 and a "true" of 1.0 is the setup you want for a clean 0/1 pair. And if you leave boolean disconnected and wonder why you're always getting true_value - that's the default kicking in, not a bug.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| true_value | FLOAT | 1.00-9999β9999 | β |
| false_value | FLOAT | 0.00-9999β9999 | β |
| booleanopt | BOOLEAN | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | β |
| FLOAT | FLOAT | β |