22
33from antlr4 import CommonTokenStream , InputStream
44
5- from .helper_functions import ThrowingErrorListener
5+ from .helper_functions import ThrowingErrorListener , comonLazy
66
77from .Parser .MathExprParser import MathExprParser
88from .Parser .MathExprLexer import MathExprLexer
99from .Parser .FloatEvalVisitor import FloatEvalVisitor
10-
1110from comfy_api .latest import io
1211
1312class FloatMathNode (io .ComfyNode ):
@@ -27,7 +26,9 @@ class FloatMathNode(io.ComfyNode):
2726 """
2827 def __init__ (self ):
2928 pass
30-
29+ @classmethod
30+ def check_lazy_status (cls , Model , a , b = [], c = [], d = [],w = 0 ,x = 0 ,y = 0 ,z = 0 ):
31+ return comonLazy (Model , a , b , c , d )
3132 @classmethod
3233 def define_schema (cls ) -> io .Schema :
3334 """
@@ -38,13 +39,13 @@ def define_schema(cls) -> io.Schema:
3839 display_name = "Float math" ,
3940 inputs = [
4041 io .Float .Input (id = "a" , force_input = True ),
41- io .Float .Input (id = "b" , default = 0.0 ,optional = True , force_input = True ),
42- io .Float .Input (id = "c" , default = 0.0 ,optional = True , force_input = True ),
43- io .Float .Input (id = "d" , default = 0.0 ,optional = True , force_input = True ),
44- io .Float .Input (id = "w" , default = 0.0 ,optional = True , force_input = True ),
45- io .Float .Input (id = "x" , default = 0.0 ,optional = True , force_input = True ),
46- io .Float .Input (id = "y" , default = 0.0 ,optional = True , force_input = True ),
47- io .Float .Input (id = "z" , default = 0.0 ,optional = True , force_input = True ),
42+ io .Float .Input (id = "b" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
43+ io .Float .Input (id = "c" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
44+ io .Float .Input (id = "d" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
45+ io .Float .Input (id = "w" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
46+ io .Float .Input (id = "x" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
47+ io .Float .Input (id = "y" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
48+ io .Float .Input (id = "z" , default = 0.0 ,optional = True ,lazy = True , force_input = True ),
4849 io .String .Input (id = "FloatFunc" , default = "a*(1-w)+b*w" , tooltip = "Expression to use on inputs" ),
4950 ],
5051 outputs = [
@@ -58,10 +59,11 @@ def define_schema(cls) -> io.Schema:
5859 #OUTPUT_NODE = False
5960 #OUTPUT_TOOLTIPS = ("",) # Tooltips for the output node
6061 @classmethod
62+ def check_lazy_status (cls , FloatFunc , a , b = [], c = [], d = [],w = 0 ,x = 0 ,y = 0 ,z = 0 ):
63+ return comonLazy (FloatFunc , a , b , c , d )
64+ @classmethod
6165 def execute (cls , FloatFunc , a , b = 0.0 , c = 0.0 , d = 0.0 , w = 0.0 , x = 0.0 , y = 0.0 , z = 0.0 ):
6266
63-
64-
6567 variables = {'a' : a , 'b' : b , 'c' : c , 'd' : d , 'w' : w , 'x' : x , 'y' : y , 'z' : z }
6668 input_stream = InputStream (FloatFunc )
6769 lexer = MathExprLexer (input_stream )
0 commit comments