Documentation for LayerUtility: ChoiceTextPreset Node
Overview
The LayerUtility: ChoiceTextPreset node is a component of the ComfyUI's LayerStyle utilities. This node provides functionality to select a specific text preset from a given set of text presets. It can choose a preset either based on a predefined title or randomly.
Node Functionality
The LayerUtility: ChoiceTextPreset node is designed to fetch a specific title and its associated content from a collection of text presets. This helps in dynamically selecting text data based on specific criteria or via random selection, introducing adaptability and variability to workflows in ComfyUI.
Inputs
The LayerUtility: ChoiceTextPreset node accepts the following inputs:
- text_preset (LS_TEXT_PRESET) [Required]:
- This is the collection of text presets from which the node will select a specific entry.
- choice_title (STRING) [Required]:
- A string identifier indicating the title of the text preset you want to extract from the collection.
- random_choice (BOOLEAN) [Required]:
- A flag to determine whether the selection should be random. True enables random selection, whereas False allows for a deterministic choice based on provided criteria.
- default (INT) [Required]:
- An integer index that specifies the default position from which to select a preset if no specific title is provided and random selection is disabled.
- seed (INT) [Required]:
- A seed value for generating random numbers, ensuring consistent random choices across different runs when
random_choice
is set to True.
Outputs
The node produces the following outputs:
-
title (STRING):
- The title of the selected text preset.
-
content (STRING):
- The content associated with the selected title from the collection of text presets.
Usage in ComfyUI Workflows
The LayerUtility: ChoiceTextPreset node can be effectively utilized in ComfyUI workflows to manage and manipulate a catalog of textual data. It introduces flexibility by allowing selections to be made either on a user-defined basis or randomly, adding dynamism and variability. This can be particularly useful in scenarios where the full range of text variables needs to be exploited without predefined scripts or predictable outputs.
Example Workflow
- Text Management: Use this node to switch between various message templates dynamically in response to user actions or specific triggers.
- Random Prompts: Implement random selection of prompts or messages to introduce creative randomness into your workflow.
- Seed Control: Maintain consistency in scenario testing by setting a predetermined seed for the random selections or simulations.
Special Features and Considerations
- Random Selection: By setting the
random_choice
to True, users can instruct the node to pick a text preset randomly, bringing a level of unpredictability that can be valuable in generative design processes or creative applications.
- Seed-based Consistency: Incorporating a seed value for randomness allows users to reproduce the same random outputs consistently, which is beneficial for development and consistent testing scenarios.
- Fallback on Default: The integration of a default index ensures that there's always a fallback option to select a text preset, maintaining workflow continuity even when specific conditions aren’t met.
The LayerUtility: ChoiceTextPreset node can be a powerful tool in any ComfyUI workflow requiring dynamic text handling, providing both flexibility and control to developers and designers alike.