From fbb9932d265421624870417d20e3c3e7b56d1477 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Wed, 4 Mar 2026 09:50:58 +0900 Subject: [PATCH] refactor: replace MatchType with MultiType inputs and dual FLOAT/INT outputs Allow mixing INT and FLOAT connections on the same node by switching from MatchType (which forces all inputs to the same type) to MultiType. Output both FLOAT and INT so users can pick the type they need. Co-Authored-By: Claude Opus 4.6 --- comfy_extras/nodes_math.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/comfy_extras/nodes_math.py b/comfy_extras/nodes_math.py index 525d7d6eb..270048d56 100644 --- a/comfy_extras/nodes_math.py +++ b/comfy_extras/nodes_math.py @@ -50,11 +50,8 @@ class MathExpressionNode(io.ComfyNode): @classmethod def define_schema(cls) -> io.Schema: - template = io.MatchType.Template( - "num", allowed_types=[io.Float, io.Int] - ) autogrow = io.Autogrow.TemplateNames( - input=io.MatchType.Input("value", template=template), + input=io.MultiType.Input("value", [io.Float, io.Int]), names=[_positional_alias(i) for i in range(26)], min=1, ) @@ -70,9 +67,8 @@ class MathExpressionNode(io.ComfyNode): io.Autogrow.Input("values", template=autogrow), ], outputs=[ - io.MatchType.Output( - template=template, display_name="result" - ), + io.Float.Output(display_name="FLOAT"), + io.Int.Output(display_name="INT"), ], ) @@ -89,7 +85,7 @@ class MathExpressionNode(io.ComfyNode): f"Math Expression '{expression}' must evaluate to a numeric result, " f"got {type(result).__name__}: {result!r}" ) - return io.NodeOutput(result) + return io.NodeOutput(float(result), int(result)) class MathExtension(ComfyExtension):