Add stack passing
This commit is contained in:
@@ -4,7 +4,7 @@ from antlr4 import InputStream, CommonTokenStream
|
||||
from .Parser.MathExprLexer import MathExprLexer
|
||||
from .Parser.MathExprParser import MathExprParser
|
||||
import re
|
||||
|
||||
from .Stack import MrmthStack
|
||||
|
||||
class ModelMathNode(io.ComfyNode):
|
||||
"""
|
||||
@@ -27,17 +27,20 @@ class ModelMathNode(io.ComfyNode):
|
||||
options=["tile", "error", "pad"],
|
||||
default="error",
|
||||
tooltip="How to handle mismatched layer counts. For models, this usually defaults to broadcast (zero for missing layers)."
|
||||
)
|
||||
),
|
||||
MrmthStack.Input(id="stack", tooltip="Access stack between nodes",optional=True)
|
||||
],
|
||||
outputs=[
|
||||
io.Model.Output(),
|
||||
MrmthStack.Output(),
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
tooltip = cleandoc(__doc__)
|
||||
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile"):
|
||||
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=[]):
|
||||
|
||||
input_stream = InputStream(Expression)
|
||||
lexer = MathExprLexer(input_stream)
|
||||
@@ -69,7 +72,7 @@ class ModelMathNode(io.ComfyNode):
|
||||
return needed1
|
||||
|
||||
@classmethod
|
||||
def execute(cls, V, F, Expression, length_mismatch="tile") -> io.NodeOutput:
|
||||
def execute(cls, V, F, Expression, length_mismatch="tile",stack=[]) -> io.NodeOutput:
|
||||
# Determine reference model for cloning
|
||||
a = V.get("V0")
|
||||
if a is None:
|
||||
@@ -86,9 +89,9 @@ class ModelMathNode(io.ComfyNode):
|
||||
|
||||
|
||||
aliases = {"a": "V0", "b": "V1", "c": "V2", "d": "V3", "w": "F0", "x": "F1", "y": "F2", "z": "F3"}
|
||||
patches = calculate_patches_autogrow(Expression, V=V, F=F, mapping=aliases)
|
||||
patches = calculate_patches_autogrow(Expression, V=V, F=F, mapping=aliases,stack=stack)
|
||||
|
||||
out_model = a.clone()
|
||||
if patches:
|
||||
out_model.add_patches(patches, 1.0, 1.0)
|
||||
return (out_model,)
|
||||
return (out_model,stack)
|
||||
|
||||
Reference in New Issue
Block a user