@@ -95,6 +95,31 @@ def IS_CHANGED(cls, should_change=False, *args, **kwargs):
9595 else :
9696 return False
9797
98+ class TestIsChangedWithConstants :
99+ @classmethod
100+ def INPUT_TYPES (cls ):
101+ return {
102+ "required" : {
103+ "image" : ("IMAGE" ,),
104+ "value" : ("FLOAT" , {"default" : 1.0 , "min" : 0.0 , "max" : 10.0 }),
105+ },
106+ }
107+
108+ RETURN_TYPES = ("IMAGE" ,)
109+ FUNCTION = "custom_is_changed"
110+
111+ CATEGORY = "Testing/Nodes"
112+
113+ def custom_is_changed (self , image , value ):
114+ return (image * value ,)
115+
116+ @classmethod
117+ def IS_CHANGED (cls , image , value ):
118+ if image is None :
119+ return value
120+ else :
121+ return image .mean ().item () * value
122+
98123class TestCustomValidation1 :
99124 @classmethod
100125 def INPUT_TYPES (cls ):
@@ -312,6 +337,7 @@ def mixed_expansion_returns(self, input1):
312337 "TestLazyMixImages" : TestLazyMixImages ,
313338 "TestVariadicAverage" : TestVariadicAverage ,
314339 "TestCustomIsChanged" : TestCustomIsChanged ,
340+ "TestIsChangedWithConstants" : TestIsChangedWithConstants ,
315341 "TestCustomValidation1" : TestCustomValidation1 ,
316342 "TestCustomValidation2" : TestCustomValidation2 ,
317343 "TestCustomValidation3" : TestCustomValidation3 ,
@@ -325,6 +351,7 @@ def mixed_expansion_returns(self, input1):
325351 "TestLazyMixImages" : "Lazy Mix Images" ,
326352 "TestVariadicAverage" : "Variadic Average" ,
327353 "TestCustomIsChanged" : "Custom IsChanged" ,
354+ "TestIsChangedWithConstants" : "IsChanged With Constants" ,
328355 "TestCustomValidation1" : "Custom Validation 1" ,
329356 "TestCustomValidation2" : "Custom Validation 2" ,
330357 "TestCustomValidation3" : "Custom Validation 3" ,
0 commit comments