ComfyUI Node

-1

The reverse index and the clip-skip favorite

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

    The odd one out of the constant family. The rest of the pack's const nodes - 0, 1, 64, 256, 512, 1024 - are positive because that's what resolutions, steps, and counts want. -1 is negative because it's a direction, not a size. It's the one constant you'll wire into two completely different kinds of inputs, and that's exactly what makes it worth having.

    Mechanically it's the same as its siblings: no inputs, one fixed INT output (this time -1), zero state, works anywhere the other constants do. It ships in the same pack, ComfyUI-GadgetNodes by 2daadv (MIT, brand new, no community track record yet). Install: ComfyUI Manager → search "GadgetNodes", or git clone https://github.com/2daadv/ComfyUI-GadgetNodes into custom_nodes/, pip install -r requirements.txt, restart. It shows up under Gadget/core/const.

    The two jobs -1 does:

    • "Last item" indexing. ComfyUI's conventions borrow Python's: negative indices count from the end, so -1 is the last element of a list. If you're driving a Select Nth Items Of AnyList-style node (this same pack has one) or any index-based selector, wiring -1 in is how you say "give me the last one" without knowing how long the list is. Zero gives you the first item; -1 gives you the last. Memorize that pair and off-by-one errors mostly stop happening to you.
    • Clip skip. This is the one that surprises people. In SD 1.5/SDXL land, clip_skip: -2 is the meme setting for anime models - the negative sign is how ComfyUI expresses "skip the last two layers of the text encoder" rather than "use layer 2." -1 is the milder version, one layer skipped, and it's a common per-model preference. A constant makes sure every workflow using that model gets the same value. (Just remember clip skip is an SD-family concept - see concepts.md on why Flux and the LLM-encoder models don't do it.)

    The one thing to watch: don't assume -1 means "disabled." Some nodes use -1 as a sentinel for "default," others use it for "all" or "last." That's a property of the node you're feeding, not of this constant - check the receiving node's docs before trusting a -1.

    If you only ever type -1 by hand, fine. The moment it needs to reach two inputs - clip skip on one, last-item on another - drop this node in and it stays consistent.

    CategoryGadget/core/const

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    -1INT