-
Notifications
You must be signed in to change notification settings - Fork 12k
Open
Description
Problem
The MathExpressionNode uses a single MatchType.Template for all inputs and the output. This means once the first input is connected as INT, all other inputs are locked to INT (and vice versa for FLOAT).
e.g. INT, FLOAT combination for MathExpressionNode is not possible today
In practice, many useful expressions require mixed types:
steps(INT) × denoise_ratio(FLOAT)width(INT) × scale_factor(FLOAT)frame_count(INT) / fps(FLOAT)
Currently users must work around this by converting everything to the same type (e.g., using percentage integers instead of float ratios).
Current implementation
template = io.MatchType.Template("num", allowed_types=[io.Float, io.Int])All inputs share this single template, so they must all resolve to the same type.
Possible approaches
- Remove MatchType, accept both INT/FLOAT freely, always output FLOAT — simplest, but loses INT output for integer-expecting nodes
- Accept both freely + add output type widget (INT/FLOAT/AUTO) — most flexible, adds complexity
- Keep MatchType but allow implicit INT→FLOAT promotion — if any input is FLOAT, all resolve to FLOAT
Context
- Related PR: feat: add Math Expression node with simpleeval evaluation #12687
- Node:
ComfyMathExpressionincomfy_extras/nodes_math.py
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels