Lazy Switch | Deforum| Lazy Switch | Deforum:
LazySwitch| Lazy Switch | Deforum chooses between two possible values using a true-or-false condition. Its lazy behavior means it requests the selected branch when that value is needed, rather than requesting both branches simply to make a choice. This is useful when you want a workflow to follow one of two paths while avoiding unnecessary work on the path you did not select. The node passes through the chosen value; it does not modify that value.
Lazy Switch | Deforum| Lazy Switch | Deforum Input Parameters:
switch
A required BOOLEAN value that determines which branch the node selects. When it is true, the node selects on_true; when it is false, it selects on_false. The available states are true and false. The source does not specify a default value, and numeric minimum and maximum values do not apply.
on_false
A required connection that supplies the value selected when switch is false. Its * type indicates that the node interface accepts a value without specifying one particular data type. This input is marked lazy: when the false branch is selected and its value has not been supplied, the node requests it. No default, numeric minimum, maximum, or additional options are specified for this input.
on_true
A required connection that supplies the value selected when switch is true. Like on_false, its * type does not restrict it to one specified data type, and it is marked lazy. When the true branch is selected and its value has not been supplied, the node requests it. No default, numeric minimum, maximum, or additional options are specified for this input.
Lazy Switch | Deforum| Lazy Switch | Deforum Output Parameters:
*
The node’s single output is the value from the selected branch: on_true when switch is true, or on_false when it is false. The * label indicates that the output has no single specified data type. The node returns the chosen value as it receives it, so what you can do with the output depends on that value and on what the next node accepts.
Lazy Switch | Deforum| Lazy Switch | Deforum Usage Tips:
- Connect the two alternative values to
on_falseandon_true, then useswitchto choose which one should continue through your workflow. - Put work you only need under one condition on its corresponding branch. The lazy inputs let the node request the selected value without requesting the other branch for this choice.
- Check that the node receiving
*can handle either value you might select. An unrestricted socket on LazySwitch| Lazy Switch | Deforum does not make unlike values interchangeable for downstream nodes. - If the result is unexpected, inspect the current value of
switchfirst:trueselectson_true, andfalseselectson_false.
Lazy Switch | Deforum| Lazy Switch | Deforum Common Errors and Solutions:
Required input is not connected
- Explanation: The interface lists
switch,on_false, andon_trueas required. Your workflow may report a missing-input or validation error if one is left unconnected; the exact message is not defined in the supplied source. - Solution: Connect a boolean condition to
switchand provide values for both branches.
Selected branch produces no value
- Explanation: The node requests the selected lazy input when that input is
None. If the selected branch still does not supply a value, the switch method can returnNone; the source does not define a dedicated error message for this case. - Solution: Check the node feeding the selected branch and make sure it produces a value for the current workflow run.
Downstream node rejects the selected value
- Explanation: LazySwitch| Lazy Switch | Deforum passes through the chosen value without converting it. A later node may reject that value if it expects a different type or format. Any error wording comes from that later node and is not specified here.
- Solution: Make both branches produce values the receiving node can accept, or add an appropriate conversion on the branch that needs it.
Output comes from the opposite branch than expected
- Explanation: The choice follows the boolean value exactly:
trueselectson_trueandfalseselectson_false. The supplied source defines no error message for an unexpected but valid selection. - Solution: Inspect the value connected to
switchand confirm that each branch is connected to the intended input.
