ComfyUI Node

路径收集器

Stop retyping file paths, start dragging them in

By user2318·Created 4 months ago·Updated about a month ago· 56
路径收集器
    • paths_out
    paths
    index0

    Every ComfyUI workflow eventually needs a file path, and typing long absolute paths into a text box is the worst part of the job. Path Collector is the pack's answer: a multi-line box where you paste a list of paths, plus a file-picker button that opens a real dialog so you can select files or a folder without touching the keyboard. Whatever you gather comes out as a single newline-separated string on paths_out.

    It's boring in the best way, and it sits at the head of a small path-handling family in this pack - feed its output into IndexSelectorNode to pick one line, or PathValidatorNode to check the paths exist. In the WanAnimate multi-ref workflow it's how the "secondary reference images" directory gets loaded: one node, a folder pick, done.

    What you set

    • paths - multi-line input, one path per line. Paste, or use the multi-file picker frontend control.
    • index - the surprise feature. 0 (default) outputs all lines. 1 outputs line 1, 2 outputs line 2, etc., 1-based. Out of range outputs an empty string. So the same node doubles as "collect everything" and "grab one."

    The picker dialog is worth knowing about: it's implemented as a backend route that pops a native tkinter file dialog, which is why the pack's install.py includes a tkinter repair step for embedded Python installs. If you're running ComfyUI from the standalone Windows package and the picker button does nothing, that repair step (re-run install.py, restart) is the fix.

    When you'd reach for it

    • Gathering a batch of reference images or pose files without hand-typing a directory listing.
    • Feeding a multi-line path list downstream to an index selector or a validator.
    • Any workflow where the same set of files gets reused - it makes the paths a single editable source of truth (the KB's node-plumbing doc calls this the whole point of the plumbing layer: one source, many consumers).

    Install

    Part of 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.

    The gotcha

    Two things. First, the picker needs tkinter, and on headless/minimal Python installs it's often missing - the pack ships an auto-fix but a manual install that skips install.py won't get it; if the dialog fails, run the install script. Second, index here is 1-based while IndexSelectorNode is 0-based - a genuinely annoying inconsistency in the same pack (index 1 in this node = line 1, index 1 in Index Selector = line 2). If you chain them, don't pass the same number through and expect the same line. The output is also just a string: nothing validates that the paths are real until a downstream node actually tries to open them, which is exactly why the validator node exists.

    CategoryCustom Nodes

    Inputs (2)

    NameTypeDefaultDescription
    pathsoptSTRING输入多个路径,每行一个。可通过多文件选择器前端控件批量选择。Enter multiple paths, one per line. Supports batch selection via the multi-file picker frontend control.
    indexoptINT00–9999选择要输出的行号(从1开始)。0=输出所有行;1=输出第1行;2=输出第2行;以此类推。超出范围时输出空字符串。Select which line number to output (starting from 1). 0=output all lines; 1=output line 1; 2=output line 2; etc. Outputs empty string if out of range.

    Outputs (1)

    NameTypeDescription
    paths_outSTRING