Nodes/ymc-node-as-x-type/set it as int type
ComfyUI Node

set it as int type

Declaring an INT when an any-wire is carrying your seed, steps, or count

By YMC-GitHub·Created 2 years ago·Updated about a year ago· 0
set it as int type
  • a
  • Int

Numbers ride any-wires more than any other data type, because numbers are what people switch, shuffle, and feed from APIs: seeds, step counts, batch sizes. And numbers are exactly where ComfyUI's type strictness gets most annoying - an INT socket will not happily accept a value that has lost its type to an any-typed junction. "Set it as int type" is the narrow tool for that.

It works the way every node in ymc-node-as-x-type works: the value on a is returned untouched - exec(self, a=None): return (a,) - and RETURN_TYPES = ("INT",) stamps the output as an integer. Wire it into a seed input, a step counter, or any INT-typed widget, and the graph accepts the connection again. No rounding, no truncating, no conversion. A label, not a normalizer.

Which raises the one real trap with this variant: an INT label is a stricter promise than a FLOAT or NUMBER label. If the wire is actually carrying 3.7, this node will happily label it an integer and let a node down the line do integer math on a float - or fail when it doesn't. The pack's siblings (as float, as number) exist precisely so you can pick the promise that matches the reality. INT only when it's genuinely an integer.

When you'd reach for it

  • A seed or count comes in from a primitive, switch, or API as * and a typed INT input refuses it.
  • You're building a UE-style routing graph (the README's stated purpose: enhancing cg-use-everywhere) and want typed numeric sockets back.

A quick honest note: for most number-juggling, ComfyUI's built-in Convert Int / float-int conversion nodes are the safer, more standard route - they actually coerce values. This node only re-labels. Reach for it when you're already committed to the any-wire style, not as a replacement for real conversion.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type

or via ComfyUI Manager (search ymc-node-as-x-type), restart. No models; the four yors_* pip deps auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.

Gotchas

  • It doesn't truncate or round - label only. Feed it a float and the promise is a lie.
  • One-commit, single-maintainer pack (v0.1.2). Fine as a utility, light on maintenance.
CategoryYMC/LINK

Inputs (1)

NameTypeDefaultDescription
aopt*

Outputs (1)

NameTypeDescription
IntINT