ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Add logic operation nodes

Open LaVie024 opened this issue 6 months ago • 0 comments

This is a continuation of a now dormant PR draft, #8024. This is intended to be a more streamlined and simplified version, and currently I am only focused on adding three logic nodes involving booleans for the moment.

Boolean Logic Gate

2025-06-20_14-27

In the original PR, these were all a bunch of nodes that were simply cumbersome to go through. This node effectively combines it into one node right here. We can select NOT, AND, OR, NAND, NOR, XOR, and XNOR, all the logic functions we could ask for.

Boolean Switch

2025-06-16_18-56_1

A simple switch node, that surprisingly somehow doesn't exist as a core node. Takes any input, outputs any output, it is agnostic to input and output types and is generally simple and streamlined. I made the inputs optional for a simple reason: somebody could turn off a group or such that this node connects to, and set it to true, which enables it to still just work, and this leads right into the fourth node to be added:

Output Exists

2025-06-16_18-56_2

And here is the most dead-simple, yet a node I would argue is quite helpful, the Output Exists node. Does an output from a node exist? Then it's true. If it doesn't? Then it's false, simple as that. To actually defend why this node should exist, I'll give a simple example with the Boolean Switch node:

2025-06-18_19-56

Here, we have connected the latent outputs to the switch, and connected the switch's boolean to the output exists node. Let's now see what happens when we just disable the HiresFix node here:

2025-06-18_19-57

Now, we have seamlessly got the initial KSampler to be the image used by the output image here, which also shows the overall usage for the switch node in these types of circumstances.

LaVie024 avatar Jun 18 '25 23:06 LaVie024