Nodes/ComfyUI_MieNodes/Mie Loop State Set Float ๐Ÿ‘
ComfyUI Node

Mie Loop State Set Float ๐Ÿ‘

Writing a running number into a ComfyUI loop

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
Mie Loop State Set Float ๐Ÿ‘
  • loop_ctx
  • loop_ctx
โ—„keyfeedback_floatโ–บ
โ—„value0.00โ–บ

Set Float is the write side of the numeric pair in MieNodes' Loop State family, paired with Get Float. If your for-loop needs a number to survive from one pass to the next - a score that should climb toward a threshold, a denoise value that should shrink as you refine, a running average - this is the node that actually commits that value somewhere durable, since ComfyUI throws away everything inside a loop's subgraph between laps by default.

Mechanism. The pack threads loop state through your graph as a custom object, MIE_LOOP_CTX. Set Float takes that context, a key, and a value, stores the float under that key, and returns the updated context so it can keep flowing forward - into the rest of this pass, and out into whatever advances the loop to the next one.

Default key feedback_float follows the family's naming convention and points at the intended use: a scored feedback loop. Compute some numeric signal each pass - a similarity score, a distance metric, an aesthetic rating - write it here, and read it back with Get Float on the next lap (or after the loop exits) to decide what to do with it.

What's on the node.

  • loop_ctx (required) - must come from another Loop-category node in this pack; the typed socket enforces it.
  • key (default feedback_float) - has to match what the corresponding Get Float node reads, character for character.
  • value (default 0) - the number you're writing, typically the output of whatever scoring or math step ran this pass.

Output: the updated loop_ctx, carrying your float forward with everything else already stored in it.

Installing. Manager: search ComfyUI_MieNodes, install. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-MieNodes, restart ComfyUI. No models, no extra dependencies.

Caveat that applies to the whole Loop category: the README doesn't mention it at all - no node list, no example workflow. What's written here is grounded in the node's actual schema and in how a loop needs to be wired mechanically to carry state, not in confirmed pack documentation.

Troubleshooting.

  • Value resets instead of accumulating. This node overwrites whatever was at key with value - it doesn't add to it. If you want a running total or average, you need to read the old value with Get Float first, do the math yourself (add, average, whatever), and feed the result into value here.
  • Downstream Get Float still shows the default. Check that this node's loop_ctx output is actually the one carried into the next iteration, and that the key strings match exactly between the Set and Get nodes - a typo or capitalization mismatch fails silently.
  • Loop never terminates on a float threshold check. Floating point comparisons rarely land on an exact value; comparing value == target after several iterations of accumulated rounding will often just never trigger. Compare with a small tolerance instead of exact equality.
  • loop_ctx type error. Something other than this pack's own MIE_LOOP_CTX output is wired into that socket.
Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (3)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”
keySTRINGfeedback_floatโ€”
valueFLOAT0.00โ€”

Outputs (1)

NameTypeDescription
loop_ctxMIE_LOOP_CTXโ€”