Nodes/Bjornulf_custom_nodes/โ™ป Loop (All Lines from input ๐Ÿ”— combine by lines)
ComfyUI Node

โ™ป Loop (All Lines from input ๐Ÿ”— combine by lines)

Regroup several text inputs line by line

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
โ™ป Loop (All Lines from input ๐Ÿ”— combine by lines)
    • line_1
    • line_2
    • line_3
    • line_4
    • line_5
    • line_6
    • line_7
    • line_8
    • line_9
    • line_10
    • line_11
    • line_12
    • line_13
    • line_14
    • line_15
    • line_16
    • line_17
    • line_18
    • line_19
    • line_20
    • line_21
    • line_22
    • line_23
    • line_24
    • line_25
    • line_26
    • line_27
    • line_28
    • line_29
    • line_30
    • line_31
    • line_32
    • line_33
    • line_34
    • line_35
    • line_36
    • line_37
    • line_38
    • line_39
    • line_40
    • line_41
    • line_42
    • line_43
    • line_44
    • line_45
    • line_46
    • line_47
    • line_48
    • line_49
    • line_50
    โ—„number_of_inputs2โ–บ
    โ—„number_of_lines3โ–บ

    This is one of the fiddlier, more power-user nodes in the Bjornulf pack - not the first one you reach for, but a genuinely clever fix for a specific annoyance. Say you're feeding several multi-line text inputs into a workflow - a handful of character descriptions, a handful of scene notes - and you don't just want to loop over each input as a whole block. You want to loop by line index across all of them at once: line 1 from every input bundled together, then line 2 from every input, and so on. That's exactly what this node does, and the author built it because the alternative - wiring up a separate loop node per line, or manually re-splitting text mid-graph - gets old fast.

    The inputs and outputs that matter

    Two required settings, and they're the whole interface: number_of_inputs (1โ€“50, default 2) tells the node how many parallel text streams you're feeding in, and number_of_lines (1โ€“50, default 3) tells it how many lines to expect out of each. Once those are set, the node exposes matching text input slots on the left.

    On the output side you get up to fifty separate outputs - line_1 through line_50 - but only however many you set with number_of_lines actually carry real content. Each one is a list output: line_1 collects the first line from every one of your inputs as a batch, line_2 collects the second line from every input, and so on. That list-per-line-index shape is the whole point - it lets you loop over "line 1 across all my sources" as a single connected unit, rather than manually stitching things back together after the fact.

    Installing it

    Through ComfyUI Manager: search Bjornulf_custom_nodes, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    

    Install the shared requirements.txt afterward. This is pure text manipulation - no external dependency does any real work here, so it'll run on the barest possible install of the pack.

    Where people get burned

    The most common trip-up is a mismatch between what you set and what you actually wired: if you set number_of_inputs to 4 but only connected 3 text nodes, or set number_of_lines to 5 when one of your inputs only has 3 lines, you'll get uneven or empty results in the higher-numbered line outputs rather than a clear error. Count your actual inputs and their actual line counts before setting these two numbers, not after.

    The bigger-picture caution: this node, along with the rest of the pack's loop family, is squarely aimed at people already comfortable with ComfyUI's loop mechanics and how control_after_generate interacts with them. If you're new to looping in ComfyUI generally, start with the pack's simpler Loop Texts or Loop (All Lines from Input) nodes first and work up to this one - it's solving a real problem, but it's not where a beginner should start.

    CategoryBjornulf

    Inputs (2)

    NameTypeDefaultDescription
    number_of_inputsINT21โ€“50โ€”
    number_of_linesINT31โ€“50โ€”

    Outputs (50)

    NameTypeDescription
    line_1STRINGโ€”
    line_2STRINGโ€”
    line_3STRINGโ€”
    line_4STRINGโ€”
    line_5STRINGโ€”
    line_6STRINGโ€”
    line_7STRINGโ€”
    line_8STRINGโ€”
    line_9STRINGโ€”
    line_10STRINGโ€”
    line_11STRINGโ€”
    line_12STRINGโ€”
    line_13STRINGโ€”
    line_14STRINGโ€”
    line_15STRINGโ€”
    line_16STRINGโ€”
    line_17STRINGโ€”
    line_18STRINGโ€”
    line_19STRINGโ€”
    line_20STRINGโ€”
    line_21STRINGโ€”
    line_22STRINGโ€”
    line_23STRINGโ€”
    line_24STRINGโ€”
    line_25STRINGโ€”
    line_26STRINGโ€”
    line_27STRINGโ€”
    line_28STRINGโ€”
    line_29STRINGโ€”
    line_30STRINGโ€”
    line_31STRINGโ€”
    line_32STRINGโ€”
    line_33STRINGโ€”
    line_34STRINGโ€”
    line_35STRINGโ€”
    line_36STRINGโ€”
    line_37STRINGโ€”
    line_38STRINGโ€”
    line_39STRINGโ€”
    line_40STRINGโ€”
    line_41STRINGโ€”
    line_42STRINGโ€”
    line_43STRINGโ€”
    line_44STRINGโ€”
    line_45STRINGโ€”
    line_46STRINGโ€”
    line_47STRINGโ€”
    line_48STRINGโ€”
    line_49STRINGโ€”
    line_50STRINGโ€”