Custom Selector
Closeup' Means Real Settings: Custom Selector, the Text-to-Parameters Router
- matched_weight
- matched_start
- matched_end
- matched_denoise
- cleaned_string
- matched_keyword
- image_url
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:
- Lowercases your input and searches for the first of
crop:medium,crop:wide, orcrop:closeup- in that order. First match wins, then it stops. - On a match, it emits that crop's weight, start, end, and denoise values as outputs, and removes the tag from the string.
- Separately, it scans for the first triggerword found as a whole word (case-insensitive) and builds
image_urlas{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_*, anddenoise_*. 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_stringafter 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:mediumfirst, thenwide, thencloseup, and stops at the first hit. If your string contains bothcrop:wideandcrop: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.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| triggerwords | STRING | michipeklo,chrishnsk,renehundertpfund,mikegasparik | — |
| weight_closeup | FLOAT | 0.50 | — |
| weight_medium | FLOAT | 0.50 | — |
| weight_wide | FLOAT | 0.50 | — |
| start_at_closeup | FLOAT | 0.00 | — |
| start_at_medium | FLOAT | 0.00 | — |
| start_at_wide | FLOAT | 0.00 | — |
| end_at_closeup | FLOAT | 1.00 | — |
| end_at_medium | FLOAT | 1.00 | — |
| end_at_wide | FLOAT | 1.00 | — |
| denoise_closeup | FLOAT | 0.20 | — |
| denoise_medium | FLOAT | 0.20 | — |
| denoise_wide | FLOAT | 0.20 | — |
| clear_string | BOOLEAN | false | — |
| url_prefix | STRING | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| matched_weight | FLOAT | — |
| matched_start | FLOAT | — |
| matched_end | FLOAT | — |
| matched_denoise | FLOAT | — |
| cleaned_string | STRING | — |
| matched_keyword | STRING | — |
| image_url | STRING | — |