ComfyUI > Nodes > ComfyUI-YCNodes > Mask Condition Switch (YC)

ComfyUI Node: Mask Condition Switch (YC)

Class Name

YC Mask Condition Switch

Category
YCNode/Logic
Author
yichengup (Account age: 473days)
Extension
ComfyUI-YCNodes
Latest Updated
2025-06-03
Github Stars
0.02K

How to Install ComfyUI-YCNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-YCNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-YCNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Mask Condition Switch (YC) Description

Facilitates dynamic mask selection based on text comparison for conditional logic in AI art projects.

Mask Condition Switch (YC):

The YC Mask Condition Switch node is designed to facilitate decision-making processes in your AI art projects by allowing you to dynamically select between two mask outputs based on a text comparison. This node is particularly useful when you need to apply different masks depending on whether a specific condition is met, such as matching input text with a preset text. By providing a straightforward mechanism to switch between two masks, this node enhances the flexibility and adaptability of your workflow, enabling you to create more complex and responsive art pieces. Its primary function is to compare an input text with a preset text and, based on whether they match, output one of two masks, thus offering a conditional logic layer to your creative process.

Mask Condition Switch (YC) Input Parameters:

input_text

This parameter represents the text input that you want to compare against a preset text. It is a string value and serves as the basis for determining which mask to output. The comparison can be case-sensitive or case-insensitive, depending on the configuration of the case_sensitive parameter.

preset_text

The preset_text parameter is the reference text against which the input_text is compared. It is also a string value and is used to define the condition for switching between the two masks. The comparison outcome determines whether mask_a or mask_b is selected as the output.

case_sensitive

This boolean parameter specifies whether the text comparison should be case-sensitive. If set to true, the comparison will consider the case of the characters in both input_text and preset_text. If false, the comparison will ignore case differences, treating uppercase and lowercase characters as equivalent. The default value is true.

mask_a

This optional parameter is the mask that will be output if the input_text matches the preset_text. It is a mask type and is used to define the visual output when the condition is met.

mask_b

Similar to mask_a, this optional parameter is the mask that will be output if the input_text does not match the preset_text. It provides an alternative visual output when the condition is not met.

Mask Condition Switch (YC) Output Parameters:

mask

The mask output is the result of the condition switch, providing either mask_a or mask_b based on the text comparison. This output is crucial for determining the visual representation in your project, allowing for dynamic changes based on textual conditions.

is_matched

This boolean output indicates whether the input_text matched the preset_text. It provides a simple true or false value, which can be used for further logic processing or decision-making in your workflow.

Mask Condition Switch (YC) Usage Tips:

  • Use the case_sensitive parameter to control the strictness of your text comparisons, especially when dealing with user inputs that may vary in case.
  • Consider providing default masks for mask_a and mask_b to ensure that your node outputs a valid mask even if the input conditions are not met.

Mask Condition Switch (YC) Common Errors and Solutions:

Input text or preset text is empty

  • Explanation: This error occurs when either the input_text or preset_text is not provided, leading to an invalid comparison.
  • Solution: Ensure that both input_text and preset_text are populated with valid string values before executing the node.

Mask output is None

  • Explanation: This issue arises when neither mask_a nor mask_b is provided, resulting in a None output for the mask.
  • Solution: Always provide at least one valid mask for mask_a or mask_b to ensure a proper output is generated.

Mask Condition Switch (YC) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-YCNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

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.