Nodes/ComfyUI_Eclipse/Convert Primitive
ComfyUI Node

Convert Primitive

Turn any value into the type your node actually wants

By r-vageΒ·Created 10 months agoΒ·Updated a day agoΒ· 31
Convert Primitive
  • input
  • output
β—„convert_toSTRINGβ–Ί

ComfyUI is strict about types right up until it isn't. A node that outputs a string you know is "42" will still refuse to feed an integer socket, and somewhere upstream something handed you an object where a number was supposed to be. Convert Primitive is the node you drop in when the graph says "no" and you know the value is fine - it coerces anything into the primitive type the next node is actually asking for.

What it is

A conversion utility with one * (any-type) input and one * output. The convert_to dropdown picks the target: STRING, INT, FLOAT, or COMBO. You point it at any value - a string, a number, a boolean, even an object - and it comes out as the primitive type you asked for.

The COMBO option is the interesting one and the reason you'll reach for this node over just typing into a widget: it turns an input value into a dropdown-friendly pair (selected_value, [options]). Feed it a list and it produces a combo whose options are those values, with the first one selected. That's how you let a list of options from one part of the graph drive a combo widget elsewhere.

How it works

The conversion logic is deliberately forgiving, and it's worth knowing what "forgiving" means so you're not surprised:

  • To STRING: everything becomes its string form - booleans become "true"/"false" (not Python's True/False), newlines and tabs collapse to spaces, and an object gets a [Object: ...] placeholder instead of a <foo object at 0x...> dump.
  • To INT: string "true"/"yes"/"on"/"1" β†’ 1, "false"/"no"/"off"/"0" β†’ 0, and anything else tries int(float(x)) with a boolean truthiness fallback. So "3.7" becomes 3, not an error.
  • To FLOAT: same tolerant parse - "3.7" β†’ 3.7, booleans β†’ 1.0/0.0.
  • To COMBO: an iterable input becomes a (selected, options) pair; anything else becomes a one-option combo.

The practical rule: it's for cleaning up and coercing, not for data you need to be exact about. If you hand it a string you intended to round, it will happily truncate.

Where you'll use it

The classic case is plumbing: a String node or a widget-to-string reader feeding an integer socket that wants a number, or a prompt-engineered value that needs to become a float for a strength slider. It's also how you rescue values from nodes that return objects when you need text. Wire the thing you have in, pick the type you need out, and the graph stops complaining.

Install

Part of ComfyUI_Eclipse (formerly RvTools, rewritten in v4.0.0). ComfyUI Manager β†’ search ComfyUI_Eclipse β†’ install β†’ restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_Eclipse

Find it under Eclipse β†’ Conversion. No models or extra deps.

Troubleshooting

  • Converting to INT gives the wrong number: it truncates, it doesn't round. "3.9" β†’ 3. If you need rounding, do it upstream.
  • COMBO output doesn't look like a dropdown: the combo pair only materializes as a dropdown where the downstream node accepts a combo; if it's just displaying a string, the target isn't a combo socket.
  • Missing node: restart ComfyUI and check the console for import errors.
CategoryπŸŒ’ Eclipse/ Conversion

Inputs (2)

NameTypeDefaultDescription
input*Any value to convert
convert_toCOMBOSTRINGTarget primitive type

Outputs (1)

NameTypeDescription
output*β€”