Nodes/ComfyUI-ZML-Image/ZML_顺序加载整数
ComfyUI Node

ZML_顺序加载整数

Walk a range of integers one step at a time, and loop when you hit the end

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_顺序加载整数
    • 整数
    • 浮点
    起始数0
    最终数3
    间隔1

    Sometimes you don't want a random number, you want a sequence: seed 100, then 101, then 102, up to 109, then back to 100 and around again. ZML_SequentialIntegerLoader is that. You tell it a start, an end, and a step, and each time it runs it hands you the next integer in the range, wrapping around to the start when it reaches the end. It's the "iterate through this batch" node, and its job description is exactly one sentence: advance, output, loop.

    The inputs

    • 起始数 - where the sequence starts (default 0).
    • 最终数 - where it ends (default 3).
    • 间隔 - the step size, minimum 1. Note the range is inclusive-ish and wraps: it walks start, start+step, … until it would exceed the end, then loops.

    If you put start above end it quietly swaps them, so you can't crash it by entering a backwards range. The outputs are 整数 (INT) and 浮点 (FLOAT) - the same value in both types, so you can feed an integer slot or a float slot without a conversion node.

    The mechanism that matters

    Two implementation details are worth knowing because they're the whole character of the node.

    First, it keeps its position in a file - 顺序加载整数.txt in the pack's counter directory - so the sequence state survives restarts and is shared across node instances. The same file trick as the pack's TextCounter, used for a different purpose.

    Second, it forces itself to run every single execution by returning float("nan") from IS_CHANGED. That's the standard ComfyUI idiom for "never cache me" - without it, ComfyUI would skip re-running the node when nothing upstream changed, and your sequence would never advance. The trade-off (documented in the KB's node-plumbing notes) is that a node that's always dirty defeats the execution cache for everything downstream of it. For this node that's not a bug, it's the point - but don't be surprised if a workflow with a SequentialIntegerLoader re-executes more than you expect.

    Where it fits

    The natural pairing is with the pack's path-based LoRA loader or any indexed loader: step the index through a folder of LoRAs or images in order, one per run, and use it for automated sweep runs where you want to visit every value in sequence rather than roll the dice. Or feed it to a seed so a batch walks seeds deterministically - same images every loop, which is exactly what you want for comparing runs. The float output is handy for CFG or denoise sweeps where you want, say, 0.0, 0.1, 0.2….

    Install

    In ComfyUI-ZML-Image: ComfyUI Manager → search "ComfyUI-ZML-Image", or cd ComfyUI/custom_nodes && git clone https://github.com/zml-w/ComfyUI-ZML-Image, restart. Labeled ZML_顺序加载整数 in the Chinese-default UI; the English patch covers it. No models, no extra dependencies.

    Categoryimage/ZML_图像/整数

    Inputs (3)

    NameTypeDefaultDescription
    起始数INT0-999999–999999
    最终数INT3-999999–999999
    间隔INT11–999999

    Outputs (2)

    NameTypeDescription
    整数INT
    浮点FLOAT