Nodes/ComfyUI-CustomNodeKit/Integer Setting (整数设置)
ComfyUI Node

Integer Setting (整数设置)

Stop fighting the 8-pixel multiples in video models

By user2318·Created 4 months ago·Updated about a month ago· 56
Integer Setting (整数设置)
    • aligned_value
    start0
    step1
    value0

    Video models have a secret handshake with arithmetic. Wan wants resolutions that are multiples of 16, SCAIL-2's frame counts follow a 4n+1 rhythm, and half of ComfyUI's video node parameters refuse to work unless the number you type lands on the right step. Integer Setting is the tiny node that does that rounding for you: you give it start, step, and a value, and it returns the nearest number of the form start + step × n.

    It's a number-aligning utility, and it's genuinely useful because the alternative is doing the math in your head every time you tweak a workflow. Set start = 0, step = 16 and any resolution you type gets snapped to the nearest multiple of 16. Set start = 1, step = 4 for a SCAIL-2 segment length and 82 becomes 81, 89 becomes 89, exactly the 4n+1 pattern the model wants. It handles negatives correctly and rounds to whichever neighbor is closer (ties break toward the smaller absolute offset).

    What you set

    • start - the arithmetic sequence's starting value (default 0).
    • step - the spacing, must be positive (default 1; with step 1 it's a passthrough).
    • value - your raw input, which gets aligned.
    • Output: aligned_value (INT).

    That's the whole contract. The V1.7.1 frontend refactor mentioned in the pack's changelog also gave it a single-row layout with start/step/value side by side, so you can set all three at a glance.

    When you'd reach for it

    • Wiring a resolution widget that's elsewhere in the graph to a "rounded to 16" value before it hits a Wan node.
    • Keeping segment lengths on a model's required stride without hand-editing numbers.
    • Any time you find yourself converting a widget to an input so a formula can feed it - this node is that formula, packaged.

    It's textbook plumbing (see the KB's node-plumbing doc): it exists to kill repetition and illegibility, touching no pixels.

    Install

    Ships in user2318/ComfyUI-CustomNodeKit. ComfyUI Manager: search "CustomNodeKit". Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/user2318/ComfyUI-CustomNodeKit.git
    cd ComfyUI-CustomNodeKit
    pip install -r requirements.txt
    

    then restart. No models, no deps beyond the pack base - it's math.floor and a comparison.

    The gotcha

    It aligns, it doesn't validate. If you round a resolution to a multiple of 16 that's still below a model's minimum, or align a frame count to a stride that's too short for your clip, the node happily produces a wrong-but-plausible number and the model fails somewhere else. Treat it as "snap to the nearest valid candidate," not "guarantee this value will work." And remember step must be positive - a negative step just returns start, which is a silent passthrough, not a feature.

    CategoryCustomNodes/Utils

    Inputs (3)

    NameTypeDefaultDescription
    startINT0-99999999–99999999等差数列的起始值。The starting value of the arithmetic sequence.
    stepINT11–99999999等差数列的步进值(正数)。The step value of the arithmetic sequence (positive).
    valueINT0-99999999–99999999输入数值,会自动对齐到最接近的 start + step*n。Input value, automatically aligned to the nearest start + step*n.

    Outputs (1)

    NameTypeDescription
    aligned_valueINT