Nodes/noEmbryo nodes/String to Combo /noEmbryo
ComfyUI Node

String to Combo /noEmbryo

String to Combo

By noembryo·Created 3 years ago·Updated 13 days ago· 47
String to Combo /noEmbryo
    • any
    ◄string►

    ComfyUI's type checker is strict in a way that surprises people arriving from a node graph that let them wire anything to anything. A STRING output will not connect to a dropdown. A dropdown selection - sampler name, scheduler, a filename list - is not a STRING output you can produce from a text node. The sockets just refuse each other.

    StringToCombo -noEmbryo is one of the small class of nodes built to get around that, using the one escape hatch the engine has.

    What the escape hatch is

    ComfyUI's type system has exactly one wildcard: the type string *. An input declared as * accepts anything, and a node whose output is * claims to produce something usable anywhere. That's what makes switch nodes possible, and it's what this node is doing - the source defines an AnyType subclass whose __ne__ always returns False, so a comparison against any type comes back "compatible."

    So the node declares a string input and an any output, and the any output will happily plug into a combo widget's socket. That's the trick. It does not make the value correct, only connectable - more on that below.

    Inputs, outputs, and the one-line mechanism

    There's one input, string - a single-line text field, with the author's tooltip "Comma-separated string to convert to combo". There is one output, any.

    The entire body is string.split(',')[0].strip(): split on commas, take the first item, trim the whitespace. If the string is empty, nothing is produced at all.

    That "first item" rule is the design, not an accident. The intended pattern is that you keep your candidate list in the box - dpmpp_2m, euler, heun, dpmpp_sde - and whichever one you put at the front is the live value. Want to switch samplers? Edit the box, no dropdown clicking. Hand-edited config beats five widgets holding the same string in five places, which is the plumbing problem this whole layer of nodes exists to solve.

    Worth knowing: the code comments credit this as a copy of CR String To Combo from Suzie1's ComfyUI_Comfyroll_CustomNodes. Same behavior - this version just spares you installing all of Comfyroll for it.

    Where it actually helps

    The pattern that earns it a slot is one source, many consumers. Right-click a sampler's sampler_name widget, convert it to an input, and wire this node in. Now several nodes on the canvas agree on the same value because one text box says so, instead of because you typed it four times without a typo. Same trick for two checkpoints you swap between, or a filename you reuse as both a loader argument and a save prefix. It's also the clean way to let a choice flow as data rather than as a click.

    Where people get burned

    • Commas are structural, and there's no escaping them. Whatever you pass in gets cut at the first comma. This node is for values that don't contain commas - sampler names, checkpoint filenames, a single word. Feeding it a prompt, or a LoRA filename that looks fine, is how you get a silently truncated value.
    • The wildcard doesn't validate anything. If you hand it euler_a and wire it into a widget that wants one of eight specific names, the failure surfaces at the downstream node, at queue time, with an error that points somewhere other than the box you typed into. Garbage in the string means an error three nodes to the right.
    • With an empty string the source returns an empty tuple, not an empty string. Small thing, until a downstream node built for text gets handed a tuple instead.

    Installing it

    Manager search noEmbryoNodes, or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/noembryo/ComfyUI-noEmbryo
    

    Restart. It lives under Add Node > noEmbryo > Utils. Same story as the rest of the pack: dependencies = [], no requirements file, no models to download, nothing to break.

    An honest note on whether you need it

    This is a plumbing node with no community fanfare behind it - when people get excited about a node pack, it's the ones that change your images, not the ones that convert types. If you're going to click a dropdown with your mouse anyway, you don't need this. Reach for it when the value has to live in one authoritative place, or when it arrives as text from somewhere else in the graph. That's a narrow job, and it does the narrow job cleanly.

    CategorynoEmbryo/Utils

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRINGComma-separated string to convert to combo

    Outputs (1)

    NameTypeDescription
    any*—