Logic node
The if/compare node in Derfuu's pack
- CompareValue_A
- CompareValue_B
- OnTrue
- OnFalse
- *
Derfuu's take on an if statement. It compares two values with an operator you pick and, based on true/false, passes through one of two other values. "If A is greater than B, output this, else output that." In a graph that otherwise just runs straight down, this is how you get a branch.
It's a "Functions" node in Derfuu_ComfyUI_ModdedNodes. Quick naming note: "Logic node" (with a space) is the older class name; current pack builds register it as DF_Logic_node. Same node, newer page here - the main visible difference is the operator labels (this older version uses bare >, <, =, AND, OR, XOR).
How it works
Operation->,<,=,AND,OR,XOR. First three compare, last three are boolean logic.CompareValue_A(required, wildcard*) andCompareValue_B(optional,*) - the values being compared. The*type accepts anything.OnTrue/OnFalse(both optional,*) - the values passed out for each result.- Output: a single wildcard
*.
Behavior, per the pack README: it "compares 2 values and returns one of 2 others (if not set - returns False)." Wire OnTrue/OnFalse and it emits one of them; leave them blank and it emits the raw boolean of the comparison.
Where you'd use it
Reacting to inputs. Compare a computed number against a threshold, or an image's width against its height (via Get image size), and use OnTrue/OnFalse to pick which value drives the downstream graph. It turns a fixed pipeline into one that adapts to what it's fed.
Keep expectations right: it selects a value, it doesn't skip execution of a branch. For actually muting or bypassing whole sections of a graph, that's rgthree's group bypassers or Impact Pack switches. This is the "pick a value" primitive.
Common issues & troubleshooting
This node is red in an old workflow - or vanished after a pack update. That's the core Derfuu gotcha. The maintainer has a documented habit of deleting deprecated node classes on reorganizations rather than leaving them in labeled as old, so saved graphs break. Replace the red node with the current DF_Logic_node and re-wire.
ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'. Same cause - an old graph pointing at a module path that moved. Update the pack, reload, swap the node.
It returned False instead of my value. OnTrue/OnFalse weren't wired. Connect them to output real values instead of the bare comparison result.
Mismatched compare types. The * ports take anything, but comparing a string to a number is meaningless - keep both compare values the same kind.
Install: ComfyUI Manager → search "Derfuu" → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes then restart. No models, no heavy dependencies.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| Operation | COMBO | 6 options: >, <, =, AND, OR, XOR | |
| CompareValue_A | * | — | |
| CompareValue_Bopt | * | — | |
| OnTrueopt | * | — | |
| OnFalseopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |