Nodes/comfyui_bmad_nodes/FromListGet1Float
ComfyUI Node Runs on cloud

FromListGet1Float

Pull One Float Out of a List Without a Whole New Node

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
FromListGet1Float
    • FLOAT
    list
    index0

    FromListGet1Float is the "give me exactly one float from this list" node. You feed it a FLOAT list and an index, it hands back the single float at that position. It's the inverse of the pack's list-making nodes, and it's the tool for when a list-producing node is more convenient than a plain value but your downstream node wants one number.

    Why you'd reach for it

    Plenty of nodes in ComfyUI output lists even when you only care about one element - a batch of denoise values, a generated sweep of CFG settings, a list you built with ExtendFloatList. FromListGet1Float grabs the one you want and hands it to a sampler, a math node, or wherever a plain FLOAT is expected.

    The index is what makes it interesting. It's a widget by default, but it can be driven by another node, which turns this into a random-access selector. Combined with a seed or a loop counter, you get "sample a different value from this list on every run" without touching the list itself.

    How it works

    Under the hood it's a modulo lookup: index % len(list), so it's index-safe by construction. Negative indexes work - -1 grabs the last item, exactly like Python. Out-of-range positive indexes wrap around rather than erroring, so index 5 on a 4-item list returns item 0.

    The list input is forced - it has to be wired from a node that emits a FLOAT list (you can't type values into it). The index input takes an INT; it's a widget by default but accepts a connection. The output is a single FLOAT.

    Install

    Part of the bmad4ever pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_bmad_nodes
    

    then restart ComfyUI. Manager users search "comfyui_bmad_nodes". The pack's Python requirements install automatically; this node is pure Python.

    Common issues

    • Wiring a single float into list. The input is a list socket - wrap with ToFloatList first.
    • Index semantics. Zero-based, and negative indexes count from the end. "I set index 2 and got the wrong value" usually means forgetting it's zero-based.
    • Wrapping instead of erroring. Out-of-range indexes wrap, which is friendly but can silently grab the wrong item. If you want a hard guarantee, index within len(list) - 1.

    That's it - one value out, exactly where you asked for it.

    CategoryBmad/Lists/Get1

    Inputs (2)

    NameTypeDefaultDescription
    listFLOAT
    indexINT0

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT