ComfyUI Node

GetIntByIndex

One integer out of a batch, with training wheels on the index

By xuhongming251·Created 10 months ago·Updated 14 days ago· 77
GetIntByIndex
    • value
    int_batch
    index0

    GetIntByIndex is the reader half of the batch pattern this pack uses to drive its per-segment loop. The InfiniteTalkMultiImage node produces a frame_count_list - one integer per image, telling the workflow how many frames each segment should render. But a for-loop iterates over a count, and needs to reach into that list one value at a time. That's this node: give it the batch and an index, get back the single integer at that position.

    It accepts an int_batch (a tensor or a plain Python list - it handles both) and an index (default 0, minimum 0), and returns one value as an INT. Inside, it clamps: if you ask for an index beyond the batch's length, you get the last element; below zero, the first; and an empty batch returns 0. No out-of-range crashes, ever.

    In the workflow you'll see it sitting inside the loop with the loop counter wired into index, pulling frame_count_list[i] for segment i. That per-segment frame count is what decides how many frames get generated for that image, so this little node is quietly the thing that makes each image's on-screen time actually match your schedule.

    Inputs: int_batch (INT), index (INT). Output: value (INT). That's the whole surface area.

    Same install as every node in the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xuhongming251/ComfyUI-InfiniteTalk-MultiImage
    

    or ComfyUI Manager → search ComfyUI-InfiniteTalk-MultiImage → Install → restart. No dependencies, no downloads.

    The clamping behavior is the thing to keep in mind, because it's friendly and misleading at the same time. A wrong index never errors - it silently returns a boundary value, which means "my video segments are all showing the wrong length" is usually a bug in whatever produces the index, not in this node. If you're writing the loop by hand, start at index 0 and step by 1, and remember the batch is zero-indexed like every sane container.

    CategoryInfiniteTalk

    Inputs (2)

    NameTypeDefaultDescription
    int_batchINT
    indexINT0

    Outputs (1)

    NameTypeDescription
    valueINT