feat: add Float to Int conversion node
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
## Summary
Add a dedicated node that converts a FLOAT input to an INT output with a selectable rounding operation.
## Motivation
From @Kosinkadink's feedback on #12687 — when working with math expressions or other float-producing nodes, users often need to feed results into INT-expecting inputs (e.g. steps, dimensions, frame counts). Currently there is no built-in way to do this with control over rounding behavior.
## Proposed design
**Node name**: `FloatToInt` (or `ConvertFloatToInt`)
**Inputs**:
- `value` (FLOAT)
- `mode` (COMBO: round / truncate / floor / ceiling, default: round)
**Output**:
- `INT`
### Mode behavior
| Mode | Description | Example: `-2.5` | Example: `2.7` |
|---|---|---|---|
| round | Standard rounding | `-2` | `3` |
| truncate | `int()` — drop decimal, toward zero | `-2` | `2` |
| floor | `math.floor()` — toward -∞ | `-3` | `2` |
| ceiling | `math.ceil()` — toward +∞ | `-2` | `3` |
Note: truncate and floor differ for negative numbers. `int(-2.5) = -2` while `math.floor(-2.5) = -3`.
## Context
- Related: #12687 (Math Expression node PR)
- Related: #12690 (INT/FLOAT mixing in Math Expression)
Contributor guide
Assessment
This issue has not been assessed yet.