Initial commit

This commit is contained in:
t22m003
2025-12-06 20:33:29 +09:00
commit 230d6f5eb0
5 changed files with 83 additions and 0 deletions
+26
View File
@@ -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
[![Sponsor](https://img.shields.io/badge/Sponsor-t22m003-red)](https://github.com/sponsors/t22m003)
+12
View File
@@ -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.
+45
View File
@@ -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,)