YCSwitch(any):
YCSwitch is a versatile node designed to dynamically select and output one of several input values based on a specified index. This node is particularly useful in scenarios where you need to switch between different data streams or configurations during execution. By allowing you to choose which input to output, YCSwitch provides flexibility and control over the data flow within your AI art projects. It supports dynamic input management, meaning you can add or remove inputs as needed, making it adaptable to various use cases. The node is designed to work seamlessly with ComfyUI, ensuring compatibility and ease of use for artists who want to integrate complex logic into their workflows without delving into technical complexities.
YCSwitch(any) Input Parameters:
select
The select parameter is an integer that determines which input value will be output by the YCSwitch node. It allows you to specify the index of the input you wish to select, with a default value of 1. The parameter accepts values ranging from 1 to 999999, providing a wide range of options for selecting inputs. This parameter is crucial for directing the node to output the desired input, and its value directly impacts the node's execution by determining which input is passed through.
sel_mode
The sel_mode parameter is a boolean that controls the selection mode of the YCSwitch node. It has two options: select_on_execution and select_on_prompt. The default setting is select_on_execution, which dynamically selects the input during execution. The select_on_prompt option is compatible with older versions of ComfyUI and allows you to determine the input selection before execution. This parameter provides flexibility in how and when the input selection is made, catering to different workflow requirements.
YCSwitch(any) Output Parameters:
selected_value
The selected_value output parameter provides the content of the input specified by the select parameter. It outputs the actual data or value from the chosen input, allowing you to use it in subsequent nodes or processes. This output is essential for accessing the desired input data based on your selection criteria.
selected_label
The selected_label output parameter returns the label of the selected input slot. This label helps identify the chosen input, providing context and clarity about which input was selected. It is particularly useful for debugging or when you need to verify the input selection.
selected_index
The selected_index output parameter outputs the index of the selected input, which corresponds to the value specified in the select parameter. This output confirms the index used for selection, ensuring that the correct input was chosen and providing a reference for further processing.
YCSwitch(any) Usage Tips:
- Use the
selectparameter to dynamically switch between different inputs during execution, allowing for flexible data flow management in your projects. - Leverage the
sel_modeparameter to choose between dynamic selection during execution or pre-selection before execution, depending on your workflow needs. - Ensure that the
selectparameter is set within the valid range to avoid errors and ensure the correct input is selected.
YCSwitch(any) Common Errors and Solutions:
Invalid select index
- Explanation: This error occurs when the
selectparameter is set to an index that does not correspond to any available input. - Solution: Verify that the
selectparameter is within the valid range and corresponds to an existing input. Adjust the index as necessary to match the available inputs.
Missing input label
- Explanation: This error may arise if the node is unable to retrieve the label for the selected input slot.
- Solution: Ensure that all input slots have labels assigned. If operating in API mode, be aware that label retrieval may not be guaranteed, and consider alternative methods for identifying inputs.
