Index LoRA Loader Counter (TJ)
Count active LoRAs without a wire — the loop-safety valve no one asks for
- total_count
Index LoRA Loader Counter (TJ) has a single job: tell you how many LoRAs are active in an Index LoRA Loader on your canvas, live, without a single wire between them. Its one output, total_count, is meant to be plugged into a Queue Loop's queue_count so a LoRA sweep runs exactly as many passes as there are LoRAs to test. It sounds trivial, and the reason it exists is a genuinely clever piece of problem-solving.
Why it can't just be a wire
You'd think the obvious design is: connect the Index LoRA Loader's own total_count output straight into the Queue Loop's queue_count. It doesn't work. The Queue Loop already feeds its index into the loader, so wiring the loader back into the loop's count creates a cycle: Queue Loop → Index LoRA Loader → (count) → Queue Loop. ComfyUI detects the circular dependency and refuses to run the workflow at all - the queue just won't start.
The Counter sidesteps this by not being connected at all. Its frontend JS scans the canvas for the target Index LoRA Loader node, reads that node's lora_1…lora_20 widget values directly (counting the ones that aren't [none]), and mirrors the number into the Counter's hidden active_count widget. When the Counter executes, it clamps that number to 0–20 and returns it. No graph link, no cycle, problem solved. It's the kind of frontend-reads-widgets trick that's fragile in theory and perfectly reliable in practice for a read-only value.
Inputs and outputs that matter
target_picker- if you have several Index LoRA Loaders, choose which one to track.(auto)handles the single-loader case.active_count,target_label- hidden widgets the JS fills; you don't edit these.- Output:
total_count(INT) - the active LoRA count, ready forqueue_countorend_index.
Install
ComfyUI Manager → Install Custom Nodes → search TJ_NODE, or:
cd ComfyUI/custom_nodes
git clone https://github.com/designloves2/ComfyUI-TJ_NODE
Restart ComfyUI. Nothing extra. Category: ✨ TJ_Node/Utility.
The workflow it unlocks
The intended setup: Index LoRA Loader (with your combos) → Queue Loop driving index; Counter wired into queue_count. Add overflow_mode: CLAMP or LOOP on the loader as insurance, and you can run "test all 14 LoRA combos against this prompt, save each result" without touching the workflow between passes. That's a small thing that saves a lot of clicks, and it's exactly the kind of automation the pack's queue-loop tooling is built around. One caveat: because the count is read from the loader's widgets, the loader has to actually be on the canvas with its combos configured - the Counter can't infer anything about a loader that doesn't exist yet.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| target_picker | COMBO | (auto) | 1 options: (auto) |
| active_count | INT | 00–20 | — |
| target_label | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| total_count | INT | — |