ComfyUI Node

1

One little integer, and a dozen ways to use it

By 2daadv·Created 6 months ago·Updated 21 days ago· 1
1
    • 1

    One. A node that outputs the integer 1 and nothing else. No inputs, no dropdowns, no surprises - the code is a class that returns a fixed INT and doesn't even bother to look at anything. It comes from ComfyUI-GadgetNodes (2daadv/ComfyUI-GadgetNodes), a small, MIT-licensed, one-developer utility pack that's fresh enough to have zero community reputation yet. Install via ComfyUI Manager (search "GadgetNodes") or git clone https://github.com/2daadv/ComfyUI-GadgetNodes into custom_nodes/, then pip install -r requirements.txt and restart. The constants live under Gadget/core/const.

    Why would you wire up a node just to get the number 1? Because in ComfyUI the source of a value matters more than the value. A hardwired constant can't be touched when you're mid-generation; it's the plumbing-layer answer to "same value in five places, changed in one." And 1 is the most load-bearing small integer in the graph:

    • Batch size. Feed it to a sampler's batch_size or a Latent/Empty Latent batch dimension and you get exactly one image, deterministically. This is the honest way to test a workflow change - one image, not a surprise batch of eight.
    • The other side of an index. Off-by-one fences are a classic beginner injury. If some node expects a count and another expects an index, the 1 node is your +1. Pair it with the ++1 node from this same pack when you need a dynamic counter instead.
    • steps: 1 for a Turbo/Lightning model. Distilled models genuinely sample in a single step, and a constant makes that intentional-looking rather than accidental. (See concepts.md - on distilled models, fewer steps isn't a compromise, it's the design.)
    • As boolean-ish true wherever a node decided to encode on/off as 0/1.

    The mechanism is worth knowing only so you trust it: BaseIntNode subclasses like this one declare an empty required-inputs dict and return (self.VAL,). There is no state, no caching, no list mode. It cannot change because there is nothing to change.

    A note on style: you don't need a dedicated node for 1 - you could type 1 into any widget - but the moment that 1 needs to reach three different inputs, the constant node is what keeps them in sync. Wire the 1 output into whatever integer inputs you need it on and move on.

    CategoryGadget/core/const

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    1INT