Skip to content

Math Expression node: allow mixing INT and FLOAT inputs #12690

@dante01yoon

Description

@dante01yoon

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

Image

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

  1. Remove MatchType, accept both INT/FLOAT freely, always output FLOAT — simplest, but loses INT output for integer-expecting nodes
  2. Accept both freely + add output type widget (INT/FLOAT/AUTO) — most flexible, adds complexity
  3. Keep MatchType but allow implicit INT→FLOAT promotion — if any input is FLOAT, all resolve to FLOAT

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions