Nodes/Comfyroll Studio/βš™οΈ CR Set Value On Binary
ComfyUI Node Runs on cloud

βš™οΈ CR Set Value On Binary

A ternary node β€” pick one of two numbers from a 0/1 flag

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,287
βš™οΈ CR Set Value On Binary
    • INT
    • FLOAT
    • show_help
    β—„binary1β–Ί
    β—„value_if_11.00β–Ί
    β—„value_if_00.00β–Ί

    This is if binary: value_if_1 else: value_if_0, as a node. You've got a 0-or-1 flag coming from somewhere upstream in your graph, and you want an actual numeric value to change based on it - steps, CFG, a batch size, anything a downstream node accepts as a number. This node resolves the flag into the real value, both as an INT and a FLOAT, so you're covered whichever type the next node wants.

    Where the flag comes from

    binary isn't computed by this node - it's meant to arrive already set from somewhere else in your graph, whether that's a manual toggle widget, the output of a comparison node, or a CR Binary To List-style upstream step. Think of this node as the last mile: it takes a plain 0/1 and turns it into the two actual numbers your workflow cares about for each state.

    How it works

    If binary is 1, the node outputs value_if_1. If it's 0, it outputs value_if_0. Both are emitted as an INT and a FLOAT simultaneously - you just wire from whichever output socket matches what the receiving node expects.

    The inputs and outputs that matter

    • binary (0 or 1, default 1) - the switch. This is what actually decides the output; everything else is the two candidate values.
    • value_if_1 - the number to output when binary is 1.
    • value_if_0 - the number to output when binary is 0.

    Outputs: INT and FLOAT - the same resolved value, cast both ways - plus the standard show_help link.

    How to install it

    Comfyroll Studio (Suzie1 and RockOfFire), no models or heavy dependencies. It's one of a small family of "Set Value On X" nodes in the same Conditional group - siblings handle a Boolean input (CR Set Value On Boolean) and a String input (CR Set Value On String) for the same pattern with a different flag type.

    • ComfyUI Manager - search "Comfyroll Studio," install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git, then restart.

    Common issues & troubleshooting

    Nothing changes when you flip binary. Double check value_if_1 and value_if_0 are actually set to different numbers - if both are left at their defaults or set identically, the flag toggles correctly but the output never visibly changes because there's nothing to distinguish.

    You've got a Boolean or a string flag, not a literal 0/1. This node specifically wants an integer 0 or 1 - for a true/false toggle use the sibling CR Set Value On Boolean instead, and for a flag arriving as text use CR Set Value On String. Wiring a Boolean-typed output directly into binary may not connect cleanly depending on how the upstream node types its output.

    Comfyroll nodes missing entirely. If the whole pack fails to load, check your startup log for Comfyroll Studio: Failed to load Graphics nodes and a trailing NameError: name 'CR_HalftoneGrid' is not defined - a symptom of an earlier import error, commonly a Pillow version conflict from another custom node. Force-reinstall Pillow (pip install --upgrade --force-reinstall pillow) or reinstall the pack cleanly, then restart.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/πŸ”€ Conditional

    Inputs (3)

    NameTypeDefaultDescription
    binaryINT10–1β€”
    value_if_1FLOAT1.00-18446744073709550000–18446744073709550000β€”
    value_if_0FLOAT0.00-18446744073709550000–18446744073709550000β€”

    Outputs (3)

    NameTypeDescription
    INTINTβ€”
    FLOATFLOATβ€”
    show_helpSTRINGβ€”