Nodes/CalculatorPro - Node Suite for ComfyUI/🔧 Convertisseur Universel
ComfyUI Node

🔧 Convertisseur Universel

Four outputs from one wire — the type bridge you didn't know you needed

By orion4d·Created about a year ago·Updated about a year ago· 0
🔧 Convertisseur Universel
    • FLOAT
    • INT
    • STRING
    • BOOLEAN
    float_in0.00
    int_in0
    string_in
    bool_infalse

    The single most annoying thing in ComfyUI after a week of use: you compute a nice FLOAT like 768.0 in a math node, and the Empty Latent Image node refuses to take it because it wants an INT. ComfyUI is strict about types on the wire - a float socket won't snap into an int socket - and there's no built-in "cast this" node. 🔧 Convertisseur Universel from CalculatorPro is the cast node. Give it any one of the four basic types and it hands you all four back.

    What it is

    This one breaks the pack's usual shape. Every other node in CalculatorPro has required inputs; this one has only optional inputs: float_in, int_in, string_in, and bool_in. You wire in whichever single value you actually have - or several, if you're feeling chaotic - and get four outputs named FLOAT, INT, STRING, and BOOLEAN. One node, one wire in, four typed values out, and you can grab whichever the next node demands.

    The README's example is the classic: compute width = 1024 and height = width × 0.75 as floats, feed them into the Universal Converter, and connect the INT outputs to the width/height of an Empty Latent Image. That's the whole job, and it does it without you hunting through a giant "utils" pack for a float-to-int node.

    How it decides

    There's a priority order baked into the code: float_in wins, then int_in, then string_in, then bool_in. So if you wire in a float and a string, the float is what gets converted and everything else is ignored. The conversion is plain Python:

    • Float in → int truncates (768.9 becomes 768), string is the decimal text, bool is True for anything nonzero.
    • String in → it tries float()/int() parsing, and treats "true", "1", "t", "yes", "vrai", "oui" (and a few friends) as boolean true. Unparseable strings come out as 0.0/0, which is worth remembering - a typo doesn't error, it silently zeroes.
    • Bool in → 1.0/0.0 floats, 1/0 ints, "True"/"False" strings.

    The traps

    The silent-zero-on-bad-string thing is the main one. If you're feeding a string from a text node and the math downstream suddenly collapses to zero, your string didn't parse - you won't get an error, just nothing. The bool_in socket only shows up when you need it (all optional), so don't be confused by a node that appears to have no required inputs at all when you first drop it in - that's the point. And the display name is French, as with the whole pack; the input/output names themselves are plain English.

    Install

    Part of the CalculatorPro suite - one install, eight nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/Calculator_Pro
    

    then restart ComfyUI, or search "Calculator_Pro" in ComfyUI Manager. No dependencies beyond Python's stdlib, no model files, no API keys. It's the rare custom node you can trust to never be the thing that breaks your environment.

    CategoryCalculatorPro/Converters

    Inputs (4)

    NameTypeDefaultDescription
    float_inoptFLOAT0.00
    int_inoptINT0
    string_inoptSTRING
    bool_inoptBOOLEANfalse

    Outputs (4)

    NameTypeDescription
    FLOATFLOAT
    INTINT
    STRINGSTRING
    BOOLEANBOOLEAN