Visit ComfyUI Online for ready-to-use ComfyUI environment
Dynamically swap function outputs based on trigger condition for flexible AI art workflows.
The FunctionSwap node is designed to dynamically swap the outputs of two functions based on a specified trigger condition. This node is particularly useful when you need to alternate between two different functions' outputs depending on a boolean condition. By leveraging this node, you can create more flexible and adaptive workflows in your AI art projects, allowing for conditional logic to determine which function's output should be used at any given time. This can be especially beneficial in scenarios where the output of one function needs to be prioritized over another based on specific criteria or states within your project.
The trigger parameter is a boolean input that determines whether the outputs of the two functions should be swapped. When set to True, the outputs of func1 and func2 are swapped. When set to False, the outputs remain in their original order. This parameter allows you to control the swapping behavior dynamically. The default value is False.
The func1 parameter represents the first function whose output may be swapped. This can be any function, such as Mask_1, and it serves as one of the two possible outputs of the node. The specific function you choose for func1 will depend on your project's requirements and the type of output you need.
The func2 parameter represents the second function whose output may be swapped. Similar to func1, this can be any function, such as Mask_2, and it serves as the alternative output of the node. The specific function you choose for func2 will depend on your project's requirements and the type of output you need.
The A output parameter represents the first output of the node after evaluating the trigger condition. If trigger is True, A will be the output of func2. If trigger is False, A will be the output of func1. This output allows you to dynamically switch between the two functions' outputs based on the trigger condition.
The B output parameter represents the second output of the node after evaluating the trigger condition. If trigger is True, B will be the output of func1. If trigger is False, B will be the output of func2. This output complements A and provides the alternative function's output based on the trigger condition.
trigger parameter to dynamically control which function's output should be prioritized in your workflow. This can be particularly useful in conditional logic scenarios.func1 and func2 are properly defined and return the expected outputs to avoid unexpected behavior when the outputs are swapped.func1 and func2 to see how swapping their outputs can impact your project's results.FunctionSwap node. Adjust the linked nodes' return types if necessary to resolve the mismatch.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.