ComfyUI  >  Nodes  >  ComfyUI-JNodes >  Parse Wildcards

ComfyUI Node: Parse Wildcards

Class Name

JNodes_ParseWildcards

Category
wildcards
Author
JaredTherriault (Account age: 3626 days)
Extension
ComfyUI-JNodes
Latest Updated
8/11/2024
Github Stars
0.0K

How to Install ComfyUI-JNodes

Install this extension via the ComfyUI Manager by searching for  ComfyUI-JNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-JNodes 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Parse Wildcards Description

Dynamically replace wildcards in text with values from predefined files for varied AI-generated content.

Parse Wildcards:

The JNodes_ParseWildcards node is designed to dynamically replace wildcard notations within a given text string with specific values sourced from predefined text files. This node is particularly useful for AI artists who want to introduce variability and randomness into their prompts or descriptions. By defining wildcard files with multiple options, you can ensure that each instance of a wildcard in your text is replaced with a value from the corresponding file, either randomly or based on a specific index. This functionality allows for the creation of diverse and unique outputs from a single template, enhancing creativity and reducing repetitive patterns in generated content.

Parse Wildcards Input Parameters:

text

This parameter takes a string that contains wildcard notations, such as __HairColors__. The wildcards will be replaced with values from corresponding text files. The input should be a multiline string to accommodate complex prompts or descriptions.

absolute_path_to_wildcards_directory

This parameter specifies the absolute path to the directory where the wildcard text files are stored. Each wildcard in the input text should have a corresponding text file in this directory, named after the wildcard (e.g., HairColors.txt for __HairColors__). This path should be a single-line string.

mode

This parameter determines how the values from the wildcard files are selected. It can be set to either seed or index. If set to seed, a random index is generated using the provided seed value. If set to index, the value at the specified index in the file is used. If the index is out of bounds, the node reverts to seed behavior. The available options are seed and index.

seed

This parameter is an integer used to generate a random index when the mode is set to seed. It ensures that the same seed will produce the same random selection, allowing for reproducibility. The default value is 0, and the maximum value is 0xffffffffffffffff.

use_same_seed_for_multiple_occurrences

This boolean parameter determines whether the same seed should be used for multiple occurrences of the same wildcard within the input text. If set to True, all instances of a wildcard will be replaced with the same value. If set to False, each instance will be replaced independently, potentially with different values. The default value is False.

Parse Wildcards Output Parameters:

STRING

The output is a single string with all wildcard notations replaced by the corresponding values from the text files. This processed string can then be used in further stages of your AI art generation workflow.

Parse Wildcards Usage Tips:

  • Ensure that the wildcard text files are properly named and placed in the specified directory to avoid missing file errors.
  • Use the seed mode with a fixed seed value for reproducible results, which is useful for debugging or creating consistent outputs.
  • Set use_same_seed_for_multiple_occurrences to False if you want more variability in your output, especially when the same wildcard appears multiple times in the input text.

Parse Wildcards Common Errors and Solutions:

Wildcard file not found for <wildcard_name>

  • Explanation: This error occurs when the node cannot find a text file corresponding to a wildcard in the input text.
  • Solution: Ensure that the text file for the wildcard exists in the specified directory and is correctly named.

Index out of bounds

  • Explanation: This error occurs when the mode is set to index and the provided seed value is outside the range of available lines in the text file.
  • Solution: Ensure that the seed value is within the range of the number of lines in the text file, or switch to seed mode for random selection.

Invalid mode

  • Explanation: This error occurs when an invalid mode is specified.
  • Solution: Ensure that the mode parameter is set to either seed or index.

Invalid seed value

  • Explanation: This error occurs when the seed value is not an integer or is out of the acceptable range.
  • Solution: Ensure that the seed value is a valid integer within the range of 0 to 0xffffffffffffffff.

Parse Wildcards Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-JNodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.