Simplify Readme

This commit is contained in:
Rocky-PC
2026-01-25 14:27:55 +08:00
parent 99a17dffbb
commit f2caafc7b2
+6 -70
View File
@@ -59,29 +59,6 @@ Use this when you already have an external loop/for/while node pack and you want
5. `GetPathByIndex.filepath` → your loader node (Load Image / Load Video / etc.)
6. Do your processing + save/export inside your external loop pack
### Node reference
#### `LoadFilePathsFromFolder`
- **Parameters**
- `folder_path`: folder to scan
- `extension`: pattern like `"*.png"`, `"*.jpg"`, `"*.txt"`
- **Outputs**
- `filepaths`: newline-separated full paths
- `filenames`: newline-separated base names (no extension)
- `count`: number of matched files
#### `GetPathByIndex`
- **Inputs**
- `filepaths`: from `LoadFilePathsFromFolder`
- `filenames`: from `LoadFilePathsFromFolder`
- **Parameter**
- `index`: 0-based index
- **Outputs**
- `filepath`: selected full path
- `filename`: selected base name
<a id="option-b-internal-loop"></a>
## Option B — Internal loop (this repo’s loop node, list batching)
@@ -93,15 +70,6 @@ Use this when you want the simplest setup: `FilePathsForLoop` returns lists, and
- (Optional) `FilePathsEnsureExecution`: “anchors” a route so it definitely runs (useful for save/write/export routes) (UI: `File Paths Loop Ensure Execution`)
- `FilePathsLoopClose`: loop terminator / completion signal (UI: `File Paths Loop End`)
### Memory note
`FilePathsForLoop` uses **ComfyUI list batching** (it sets `OUTPUT_IS_LIST`). This is not a “while/for loop” that runs one full item end-to-end.
- **What you may observe**: ComfyUI often runs **node-by-node for the batch**. So a route like `Load X From Path` → `Process` → `Save` can look like “all loads”, then “all processing”, then “all saves” (not Load→Process→Save per file).
- **Why memory can grow**: batching can keep more intermediate results “alive” until later nodes run; heavy nodes (models / large frames / big tensors) can push VRAM/RAM peak usage.
- **Practical tip**: if you notice memory climbing, add “Clean VRAM” / “Clean RAM” (or equivalent) at safe points after heavy steps.
- **If you need strict sequential iteration** (finish item 0 completely before item 1): use an external loop/for/while node pack and Option A.
### Example workflow (internal loop: once per file)
![Option B — Internal Loop Node Method](screenshots/Option%20B%20(Interal%20Loop%20Node%20Method).jpg)
@@ -113,46 +81,14 @@ Use this when you want the simplest setup: `FilePathsForLoop` returns lists, and
5. `current_index` → `FilePathsLoopClose.current_index`
6. (Optional) `FilePathsEnsureExecution.passthrough` → `FilePathsLoopClose.passthrough` (this “anchors” the route so it executes)
### Node reference (internal loop nodes)
### Memory note
#### `FilePathsForLoop`
`FilePathsForLoop` uses **ComfyUI list batching** (it sets `OUTPUT_IS_LIST`). This is not a “while/for loop” that runs one full item end-to-end.
- **Parameters**
- `folder_path`
- `extension`
- **Outputs** (**all are lists**)
- `current_filepath`
- `current_filename`
- `current_index` (0-based)
- `total_file_count`
**Key detail:** this node sets `OUTPUT_IS_LIST`. Downstream nodes receive **one item per execution** (not the whole list).
#### `FilePathsEnsureExecution`
- **What it does**: “collects” outputs so a route becomes **required** (and actually runs).
ComfyUI schedules execution based on **dependencies**: if nothing downstream “needs” a route’s results, ComfyUI may skip that route (or only run part of it).
`FilePathsEnsureExecution` is a simple way to **guarantee a route runs**: plug the outputs you care about into `passthrough_1`…`passthrough_5`, then plug `passthrough` into `FilePathsLoopClose.passthrough` so the graph *depends on* that route.
Practical rule of thumb: you usually only need to connect the **terminal node/output** of the route you want to guarantee (the last node in that route). If the end node must run, everything upstream of it becomes required too.
Example route: `Load Image From Path` → processing → `Save Image` → connect the **`Save Image` output** to `FilePathsEnsureExecution.passthrough_*` to “anchor” the whole chain.
- **Inputs**
- `passthrough_1` … `passthrough_5`: any type (`*`)
- **Outputs**
- `passthrough`: first non-None input
Tip: if you need more than 5 inputs, chain multiple `FilePathsEnsureExecution` nodes.
#### `FilePathsLoopClose`
- **Inputs**
- `current_index`: from `FilePathsForLoop` (required)
- `passthrough`: optional (often from `FilePathsEnsureExecution.passthrough`)
- **Outputs**
- `processed_count`
- **What you may observe**: ComfyUI often runs **node-by-node for the batch**. So a route like `Load X From Path` → `Process` → `Save` can look like “all loads”, then “all processing”, then “all saves” (not Load→Process→Save per file).
- **Why memory can grow**: batching can keep more intermediate results “alive” until later nodes run; heavy nodes (models / large frames / big tensors) can push VRAM/RAM peak usage.
- **Practical tip**: if you notice memory climbing, add “Clean VRAM” / “Clean RAM” (or equivalent) at safe points after heavy steps.
- **If you need strict sequential iteration** (finish item 0 completely before item 1): use an external loop/for/while node pack and Option A.
## License