KJNodes/miscgenerated

Lazy Switch KJ(LazySwitchKJ)

From a technical implementation perspective, this node accepts a Boolean `switch` parameter and two inputs, `on_true` and `on_false`, which support any data type.

Lazy Switch KJ

UNKNOWN
switch
on_false
COMBO
on_true
COMBO
KJNodes

From a technical implementation perspective, the Lazy Switch KJ node receives a BOOLEAN switch parameter and two dropdown selections (on_true and on_false) of type COMBO. It selects and outputs one of the two chosen values based on the boolean switch.

Lazy Switch KJ is a flow control node that selects and outputs one of two input values based on a boolean switch. Its core function is to determine which data path in the workflow will be activated, thereby implementing conditional branch logic. It simplifies the construction of complex workflows that require switching between different processing pipelines based on conditions.

Node Functionality

Technically, this node receives a BOOLEAN switch parameter and two dropdown inputs, on_true and on_false, of type COMBO. Its internal mechanism employs lazy evaluation, meaning that only after the value of switch is determined will the corresponding input path be evaluated and passed through. This helps optimize computational resources. The node supports the UNKNOWN type in ComfyUI, ensuring high compatibility.

Node Parameter Description - Lazy Switch KJ

Inputs (Widget Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
on_falseCOMBOYes--**: When switch is False, the value selected in this dropdown will be output by the node.
on_trueCOMBOYes--**: When switch is True, the value selected in this dropdown will be output by the node.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
switchBOOLEANYes--**: Boolean switch used to decide which input value to output. Outputs on_true when True, and on_false when False.

Output

Parameter NameData TypeDescription
ANYUNKNOWN**: Outputs the value from either on_true or on_false, based on the value of switch.

Usage Scenarios

A typical use case is in an image generation workflow, where you can decide whether to output a particular preset value based on the judgment result from a preceding node (e.g., whether an image meets a certain condition). Simply connect the judgment result to switch, and select the desired values from the on_true and on_false dropdowns. The node will then automatically output the chosen result.

Notes

Please note that this node only performs binary data routing and does not execute any data processing or transformation operations itself. Ensure that the values selected in the on_true and on_false dropdowns match the input types expected by downstream nodes; otherwise, workflow execution errors may occur.

The Lazy Switch KJ node is from the ComfyUI-KJNodes node pack.

Comments

Sign in with GitHub to join the discussion.

Loading comments…