Shima Int (Math)
An integer primitive that actually does math
- a
- b
- c
- value
Shima Int is a value node with a bonus: besides holding an integer, it can evaluate a small math expression on that value plus up to three wired inputs. If you've ever wanted a single knob that emits batch_size * 2 or steps - 10 without chaining three separate math nodes, this is the node.
The core problem it solves is the boring one every workflow hits - a number that needs to feed several places, and occasionally needs to be derived from other numbers. The KB's node-plumbing doc calls this family "one source, many consumers," and Shima Int is that idea with an expression evaluator bolted on. You type a number into value, optionally feed a, b, and c from other nodes, write an expression using those letters, and the value output is the result.
The bits that matter
- value - the base integer. Range is a billion either way, so it'll hold any seed or dimension you throw at it. If you leave the expression as the default
aand don't wirea, the node just returnsvalue. That's the "plain primitive" mode. - expression - where the magic lives. It uses safe evaluation, so you get arithmetic (
a * 2,b + c - a,value % 100) without arbitrary code execution. The lettersa,b,cmap to their input sockets, andvalueis also in scope. - a / b / c - optional
INT,FLOATinputs, wired from other nodes. Unwired,afalls back tovalue, andb/cfall back to 0. Soa * 3with no wires is literallyvalue * 3.
One subtlety worth knowing: the output is always INT (it floors the float result), so don't use this for ratio math you need to keep precise - that's the float sibling's job. And allow_external_linking is the island-system toggle: on, and this node broadcasts outside its ComfyUI group, which is how you share one derived number across an island without dragging wires everywhere.
Install
Same pack install as always:
cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf
then restart ComfyUI, or grab it via ComfyUI Manager → search "Shima". No models needed.
Where people trip
The most common stumble is expecting a to be wired and the fallback to matter - it doesn't; wiring any of a/b/c overrides the fallback. Also, if your expression throws (bad syntax, divide by zero), the node fails at queue time with a safe_eval error, so keep expressions simple. Honestly, if you only need a plain integer source, ComfyUI's own primitive nodes are the lower-dependency option - Shima Int earns its slot when you want that math baked into the same node, or when you're already inside the Shima island system and want the broadcast behavior. For everything else it's a perfectly fine primitive with extra steps.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT | 1-1000000000–1000000000 | — |
| expression | STRING | a | — |
| aopt | INT,FLOAT | 0 | — |
| bopt | INT,FLOAT | 0 | — |
| copt | INT,FLOAT | 0 | — |
| allow_external_linkingopt | BOOLEAN | false | If ON, this node broadcasts/receives OUTSIDE the Island (ignores group regex) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | INT | — |