Nodes/ComfyUI_MieNodes/Mie Loop State Get Int ๐Ÿ‘
ComfyUI Node

Mie Loop State Get Int ๐Ÿ‘

Reading a counter out of a ComfyUI loop

By MieMieeeeeยทCreated 2 years agoยทUpdated 27 days agoยท 225
Mie Loop State Get Int ๐Ÿ‘
  • loop_ctx
  • INT
โ—„keyfeedback_intโ–บ
โ—„default_value0โ–บ

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 (default feedback_int) - rename per counter if you're tracking more than one number through the loop.
  • default_value (default 0) - 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 the loop_ctx you'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 key breaks the connection without an error, and you'll just keep seeing default_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.
Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (3)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”
keySTRINGfeedback_intโ€”
default_valueINT0โ€”

Outputs (1)

NameTypeDescription
INTINTโ€”