ComfyUI Extension: ComfyUI Logic Support
A collection of logic and utility nodes for ComfyUI to enhance workflow capabilities.
Custom Nodes (0)
README
ComfyUI Logic Support
A collection of logic and utility nodes for ComfyUI to enhance workflow capabilities.
Version: 0.4.0
Overview
ComfyUI Logic Support is a custom node extension that provides various logic and utility nodes to enhance your ComfyUI workflows. These nodes enable more complex conditional logic, string manipulation, and numerical operations.
Installation
-
Clone this repository into your ComfyUI custom_nodes directory:
cd /path/to/ComfyUI/custom_nodes git clone https://github.com/yourusername/Comfyui-Logic-Support.git
-
Restart ComfyUI or refresh the page if it's already running.
Nodes
NumberRangeIndex
Determines which range a number belongs to and returns the corresponding index.
-
Inputs:
number
: The input number to checkbase_type
: Range calculation method ("L <= n < R" or "L < n <= R")value_1
tovalue_15
: Boundary values for rangesdefault_index
: Starting index for results (default: 0)
-
Outputs:
INDEX
: The index of the range the number belongs to
BooleanIndexAdder
Adds the index of the first true value among 15 boolean inputs to a base number.
- Inputs:
base_number
: The number to add the index tobool1
tobool15
: Boolean inputs
- Outputs:
NUMBER
: The result of adding the index to the base number
NumberConditionChecker
Checks if a number is within specified bounds and returns a boolean result.
- Inputs:
lower_value
: Lower bound valuelower_op
: Lower bound operator ("NONE", "<", "<=")number
: The number to checkupper_op
: Upper bound operator ("NONE", "<", "<=")upper_value
: Upper bound value
- Outputs:
BOOLEAN
: True if the number satisfies all conditions, otherwise False
StringConcatenator
Concatenates up to 15 input strings into a single output string with a specified separator.
- Inputs:
separator_type
: Type of separator ("EMPTY", "COMMA", "SPACE", "PIPE")string1
tostring15
: Strings to concatenate
- Outputs:
STRING
: The concatenated string
StringSwitchByNumber
Outputs a string based on a numeric index input, supporting up to 15 strings.
- Inputs:
number
: Index of the string to output (1-based)string1
tostring15
: Available strings
- Outputs:
STRING
: The selected string
NumberSequenceGenerator
Generates a sequence of numbers within a specified range, repeating each number a specified number of times. Maintains state between workflow executions.
- Inputs:
start_number
: Starting number of the sequenceend_number
: Ending number of the sequencerepeat_count
: Number of times to repeat each numberreset
: Whether to reset the sequence ("no" or "yes")
- Outputs:
NUMBER
: Current number in the sequence
- Features:
- State is maintained per workflow, allowing independent use in multiple workflows
- State persists across ComfyUI restarts (file-based state saving)
- State is maintained during repeated operations (multiple Run executions)
Examples
Using NumberRangeIndex for Conditional Processing
[Number Input: 15] → [NumberRangeIndex] → [Index determines further processing]
Creating Dynamic Text with StringConcatenator
[Text Input 1: "Hello"] → [StringConcatenator: SPACE] → [Output: "Hello World"]
[Text Input 2: "World"] ↗
Conditional Logic with BooleanIndexAdder
[Base Number: 10] → [BooleanIndexAdder] → [Output: 12]
[Boolean Input 1: False] ↗
[Boolean Input 2: True] ↗
Sequential Number Generation with NumberSequenceGenerator
[NumberSequenceGenerator: start=1, end=3, repeat=2] → [Output sequence: 1,1,2,2,3,3,1,1,...]
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Example Workflow
The repository includes an example workflow (logic_support_example.json
) that demonstrates how to use the logic nodes to create dynamic text prompts based on numeric inputs like age. This workflow uses:
NumberRangeIndex
to determine age rangesStringSwitchByNumber
to select appropriate text based on the age rangeStringConcatenator
to combine multiple text elements into a final prompt
You can load this example in ComfyUI by using the "Load" button and selecting the logic_support_example.json
file.