mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-12 17:27:26 +08:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
baf4dbe46c
commit
fbb9932d26
@ -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):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user