Mie Loop State Get Int ๐
Reading a counter out of a ComfyUI loop
- loop_ctx
- INT
Every for-loop eventually needs to know where it is - which lap this is, how many frames you've generated so far, what seed offset to use this time around. ComfyUI doesn't give you that for free: a loop's subgraph re-runs clean each pass, so a plain counter variable just resets every time unless you explicitly carry it forward. Get Int is the read half of how MieNodes solves that for whole-number state.
How it fits together. The pack passes loop state around as a custom object, MIE_LOOP_CTX, produced by other nodes in the same Loop category and updated as your loop runs. Get Int takes that context plus a key string and returns whatever integer is stored there - an iteration counter, a frame index, a retry count, whatever you're using it for. If nothing's been written yet (lap one, or a mismatched key), you get default_value instead of a crash.
The default key, feedback_int, follows the same naming pattern as its Bool and Float siblings, and points at the same intended use: a feedback-driven loop where something gets counted or scored each pass - retries attempted, frames collected, a numeric verdict from a check - and read back to decide what happens next.
Schema, plainly.
loop_ctx(required) - from this pack's Loop nodes only; the typed socket won't accept a stand-in.key(defaultfeedback_int) - rename per counter if you're tracking more than one number through the loop.default_value(default0) - what you get before anything's written under that key.
Output is a single INT, which wires into anything expecting a whole number - a seed input, an iteration limit comparison, an index into a list, a frame count.
Installing. Search ComfyUI Manager for ComfyUI_MieNodes and install from there, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-MieNodes, restart ComfyUI. No models, no heavy dependencies - this is bookkeeping, not generation.
One honest caveat: the pack's README says nothing about the Loop category - no node table, no workflow image, nothing to cross-check against. What's above comes from reading the schema and knowing how a for-loop counter mechanically has to be threaded through a graph, not from confirmed author documentation.
Troubleshooting.
- Counter never increments, stuck at
default_value. Check that theloop_ctxyou're reading from is the one being rewritten each pass by a Set Int node, not a stale copy from before the loop started - this is the single most common wiring mistake with this whole family. - Key mismatch silently resets the counter. These are free-text fields; a stray space or a different capitalization between the Get and Set node's
keybreaks the connection without an error, and you'll just keep seeingdefault_value. - Off-by-one behavior across iterations. Whether your counter reads as "laps completed" or "laps remaining" depends entirely on where in your graph you read versus write it - read it at the top of a pass before you increment, and you'll see last pass's value; increment first, and you'll see this pass's.
- Type error wiring
loop_ctx. You're feeding it something other than another Loop node's output from this same pack - a plain int or a generic dict won't satisfy the socket.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| key | STRING | feedback_int | โ |
| default_value | INT | 0 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | โ |