Mie Loop State Set Float ๐
Writing a running number into a ComfyUI loop
- loop_ctx
- loop_ctx
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(defaultfeedback_float) - has to match what the corresponding Get Float node reads, character for character.value(default0) - 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
keywithvalue- 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 intovaluehere. - Downstream Get Float still shows the default. Check that this node's
loop_ctxoutput is actually the one carried into the next iteration, and that thekeystrings 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 == targetafter several iterations of accumulated rounding will often just never trigger. Compare with a small tolerance instead of exact equality. loop_ctxtype error. Something other than this pack's ownMIE_LOOP_CTXoutput is wired into that socket.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| key | STRING | feedback_float | โ |
| value | FLOAT | 0.00 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ |