Nodes/XB_ToolBox/XB-BOX - Master Parameter
ComfyUI Node

XB-BOX - Master Parameter

One value box that snap-clamps itself to the mode you're in

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - Master Parameter
    • Integer (INT)
    • Float (FLOAT)
    modeFree Mode
    value1024.00

    A primitive value node that got opinionated. XB_MasterParameter takes one number, applies a clamp-and-round rule based on the mode you pick, and emits both an INT and a FLOAT version of the result. It's the "one box for all your parameter plumbing" node from XB_ToolBox's params family, aimed at people who keep wiring the same width into a sampler, a latent, and a filename.

    The reason it exists is the plumbing problem every beginner hits: ComfyUI's typed primitive nodes just pass numbers through, and then you feed a width of 1024.5 into something that wants multiples of 32 and the image comes out wrong or the node silently refuses. This node bakes the "is this number valid for this context?" check into the value node itself, so a single source of truth stays valid everywhere it fans out.

    The modes

    Two inputs, six behaviors:

    • mode - Free Mode, Model Mode, Encode Mode, Decode Mode, Ratio Mode, Other Mode
    • value - a FLOAT, default 1024, range 0–9999

    What each mode actually does to the number:

    • Free Mode / Other Mode - clamp to 0–9999, no rounding. Pure pass-through.
    • Model Mode - clamp to 0–50. Think model weights, CFG-ish, or anything with a tight sane range.
    • Encode Mode / Decode Mode - clamp to 64–3840 and round to the nearest multiple of 32. This is the useful one: VAE and latent dimensions want multiples of 32 (and often 64 for video), and this saves you from the "odd width" error class entirely.
    • Ratio Mode - clamp to 0–1.0. For denoise, strength, aspect-ratio fractions.

    Outputs are Integer (INT) and Float (FLOAT) - same number, both types, so you can wire whichever downstream input asks for.

    Where it fits

    A classic setup: one XB_MasterParameter in Encode Mode feeding width to your empty latent, a second for height, and both to a video params node. Change one number, everything downstream snaps to a valid 32-multiple and stays consistent. It's the "unified parameters" philosophy from the pack's core pitch - a single hub instead of six loose typed primitives that can drift apart.

    For digital-human and video workflows in this pack specifically, it pairs with the params buses (XB_DigitalHumanParams_*) - the MasterParameter is the low-level single value, the bus is the bundle.

    Install & gotchas

    cd ComfyUI/custom_nodes
    git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
    # or: ComfyUI Manager → "XB_ToolBox"
    

    The README's "no pip dependencies" claim holds for this node - it's pure Python, no model, no backend.

    The gotcha is the mode semantics, which are easy to misremember: Encode Mode rounds to multiples of 32, so if you want an odd value (some experiments deliberately use non-standard dims) it will quietly fight you. Pick Free Mode for that. And the rounding is round(val/32)*32, so 1024.6 becomes 1024, 1024.7 becomes 1056 - if you need exact control, do the math yourself rather than trusting the box to do what you meant.

    CategoryXB_ToolBox/Params_Control

    Inputs (2)

    NameTypeDefaultDescription
    modeCOMBOFree Mode6 options: Free Mode, Model Mode, Encode Mode, Decode Mode, Ratio Mode, Other Mode
    valueFLOAT1024.000–9999

    Outputs (2)

    NameTypeDescription
    Integer (INT)INT
    Float (FLOAT)FLOAT