ComfyUI Node

Custom Selector

Closeup' Means Real Settings: Custom Selector, the Text-to-Parameters Router

By gasparuff·Created about a year ago·Updated about a year ago· 1
Custom Selector
    • matched_weight
    • matched_start
    • matched_end
    • matched_denoise
    • cleaned_string
    • matched_keyword
    • image_url
    input_string
    triggerwordsmichipeklo,chrishnsk,renehundertpfund,mikegasparik
    weight_closeup0.50
    weight_medium0.50
    weight_wide0.50
    start_at_closeup0.00
    start_at_medium0.00
    start_at_wide0.00
    end_at_closeup1.00
    end_at_medium1.00
    end_at_wide1.00
    denoise_closeup0.20
    denoise_medium0.20
    denoise_wide0.20
    clear_stringfalse
    url_prefix

    Custom Selector (class CustomSelector) is the rare node that reads your prompt text and turns it into numbers: a weight, a timestep range, and a denoise value. Feed it a string containing crop:closeup, crop:medium, or crop:wide, and it returns the settings you've pre-assigned to that shot type, strips the tag out, and hands you back a clean prompt. It's a lookup table with a regex front door.

    Let's be honest about the audience up front: this node was built for one specific pipeline. The author, Michael Gasparik (publishing as "pixible"), clearly runs an automated setup where a prompt gets generated somewhere outside ComfyUI - think an LLM, an API, or a backend - and needs to drive per-shot sampling settings plus per-artist reference images. The default triggerwords are a list of artists (including the author himself), and there's a url_prefix field whose whole job is building https://your-bucket/…/{artist}.jpg. If you're hand-authoring workflows in the graph, you probably won't need this. If you're piping machine-generated prompts into ComfyUI, this is the glue you'd otherwise write yourself.

    How it works

    The mechanism is refreshingly simple, which is why the pack weighs almost nothing. It's a single Python file using only the standard re module - no requirements.txt, no model files, no torch imports to choke on.

    On every run it does three things:

    1. Lowercases your input and searches for the first of crop:medium, crop:wide, or crop:closeup - in that order. First match wins, then it stops.
    2. On a match, it emits that crop's weight, start, end, and denoise values as outputs, and removes the tag from the string.
    3. Separately, it scans for the first triggerword found as a whole word (case-insensitive) and builds image_url as {url_prefix}/{keyword}.jpg. It doesn't download anything - it just builds the string for whatever other node actually fetches the file.

    If nothing matches, you get silent defaults: matched_weight 0.0, matched_start 0.0, matched_end 1.0, matched_denoise 0.0.

    The inputs that matter

    Most of the required inputs are just per-crop values you're pre-assigning:

    • The three crop sets - weight_closeup/medium/wide, start_at_*, end_at_*, and denoise_*. Each is the value handed back when its tag matches.
    • input_string - whatever text you're parsing.
    • triggerwords - comma-separated keywords used for URL building; defaults to four artist names. Empty it if you don't want that behavior at all.
    • url_prefix - your bucket or domain root. Leave it empty and a match produces "/artist.jpg", a relative URL that goes nowhere. The only commit in the repo is literally "Added bucket URL to be added in the input," so this was the author's own last-minute fix.
    • clear_string - a boolean that wipes cleaned_string after matching. Tick it by accident and your text encoder gets an empty prompt.

    Where the outputs go

    The seven outputs wire into a fairly standard sampling setup. matched_weight feeds a LoRA weight or conditioning strength for that shot type. matched_start and matched_end slot into ConditioningSetTimestepRange's start/end percent, so a closeup's LoRA can, say, only apply during the composition phase. matched_denoise goes straight to the KSampler - a wide shot can be a gentler img2img pass than a closeup. cleaned_string is your CLIP-encoded prompt, and matched_keyword / image_url are the reference-image plumbing.

    Install

    Trivial, which is a nice change of pace from the usual custom-node dependency slog. Via ComfyUI Manager, search "Custom Selector" (pack title comfyui-customselector, registered under publisher "pixible"). Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/gasparuff/CustomSelector
    

    Then restart ComfyUI. That's it - nothing to pip-install.

    Gotchas (read from the source, since the README is empty)

    • Order matters. The node checks crop:medium first, then wide, then closeup, and stops at the first hit. If your string contains both crop:wide and crop:closeup, wide wins even if closeup appears first in the text. That ordering feels backwards for anyone used to "closeup is the strongest shot," so don't assume position-in-text decides.
    • No match is a silent no-op. Weight 0.0 means a LoRA does nothing; denoise 0.0 means an img2img pass returns the input unchanged. No error, just a confusingly identical output.
    • Whole-word matching. "mikegasparik" won't match inside another word, and the first triggerword in your comma list wins.

    The verdict: it's two utilities in one - a crop-tag router and an artist-URL builder - and it's genuinely handy if your prompts are machine-generated. If you're hand-drawing workflows it'll sit unused, but the pattern of turning a text token into numeric sampling settings is worth stealing even if you never run the node itself.

    CategoryCustom

    Inputs (16)

    NameTypeDefaultDescription
    input_stringSTRING
    triggerwordsSTRINGmichipeklo,chrishnsk,renehundertpfund,mikegasparik
    weight_closeupFLOAT0.50
    weight_mediumFLOAT0.50
    weight_wideFLOAT0.50
    start_at_closeupFLOAT0.00
    start_at_mediumFLOAT0.00
    start_at_wideFLOAT0.00
    end_at_closeupFLOAT1.00
    end_at_mediumFLOAT1.00
    end_at_wideFLOAT1.00
    denoise_closeupFLOAT0.20
    denoise_mediumFLOAT0.20
    denoise_wideFLOAT0.20
    clear_stringBOOLEANfalse
    url_prefixSTRING

    Outputs (7)

    NameTypeDescription
    matched_weightFLOAT
    matched_startFLOAT
    matched_endFLOAT
    matched_denoiseFLOAT
    cleaned_stringSTRING
    matched_keywordSTRING
    image_urlSTRING