node switch - blossommerz/locus-hub GitHub Wiki
< Previous: Compare | Next: Series >
Route one of two inputs to the output: the toggle off takes A, on takes B.
Category: Data | Add menu: Data > Numbers > Switch
Switch is a routing node. It takes two inputs and passes exactly one of them through, chosen by a boolean: with Toggle off the output is A, with it on the output is B. Nothing is converted, merged or combined, so whatever arrives on the winning input leaves the node unchanged.
It is type-agnostic. Geometry, numbers, colors, strings and whole collections all travel through it the same way. That is what makes it useful for an A/B comparison: wire two variants of a pattern into A and B, leave the rest of the graph wired exactly as it is, and flip the toggle to see one or the other. Two variants feeding a single Realize is the common shape.
- A (any): the value taken when Toggle is off.
- B (any): the value taken when Toggle is on.
- Toggle (boolean): which input wins. Wire a Toggle node in, or any other boolean source.
- Result (any): whichever input the toggle chose, passed through untouched.
Note
A number wired into Toggle reads as a boolean: 0 is off, any other finite number is on. A non-finite number, the kind a bad division produces upstream, counts as off rather than on. Without that guard a NaN would read as "not zero" and silently flip the switch.
If the chosen input has nothing wired to it, the output is empty geometry rather than an error or a missing value, so downstream nodes see exactly what they would see from any other empty source.
< Previous: Compare | Next: Series >
- Toggle: the boolean source that usually drives it.
- Data nodes | Lists & collections
