Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
# ComfyUI Loop Node
|
||||
|
||||
Custom node that provides loop (for-loop) functionality in ComfyUI.
|
||||
This allows you to repeat execution steps by outputting a list of integers, which triggers ComfyUI's list execution behavior.
|
||||
|
||||
## Features
|
||||
|
||||
- **For Loop (Count)**: Simple loop that runs `N` times. outputs `0` to `N-1`.
|
||||
- **For Loop (Range)**: Loop based on python `range(start, stop, step)`.
|
||||
|
||||
## Installation
|
||||
|
||||
Navigate to your `ComfyUI/custom_nodes/` directory and clone this repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/t22m003/ComfyUI_LoopNode.git
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Found under the category: `Loop`
|
||||
|
||||
## Sponsor
|
||||
|
||||
[](https://github.com/sponsors/t22m003)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
|
||||
from .loop_node import SimpleForLoop, SimpleForLoopRange
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"SimpleForLoop": SimpleForLoop,
|
||||
"SimpleForLoopRange": SimpleForLoopRange,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SimpleForLoop": "For Loop (Count)",
|
||||
"SimpleForLoopRange": "For Loop (Range)",
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
|
||||
class SimpleForLoop:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"total": ("INT", {"default": 1, "min": 1, "max": 100, "step": 1}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT",)
|
||||
RETURN_NAMES = ("index",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "execute"
|
||||
CATEGORY = "Loop"
|
||||
|
||||
def execute(self, total):
|
||||
return (list(range(total)),)
|
||||
|
||||
class SimpleForLoopRange:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"start": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}),
|
||||
"stop": ("INT", {"default": 10, "min": 0, "max": 10000, "step": 1}),
|
||||
"step": ("INT", {"default": 1, "min": 1, "max": 10000, "step": 1}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT",)
|
||||
RETURN_NAMES = ("index",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "execute"
|
||||
CATEGORY = "Loop"
|
||||
|
||||
def execute(self, start, stop, step):
|
||||
range_vals = list(range(start, stop, step))
|
||||
return (range_vals,)
|
||||
Reference in New Issue
Block a user