Consolidate boolean, casting, control flow, data list and dict nodes

This commit is contained in:
StableLlama
2025-05-11 16:18:45 +02:00
parent 22bb1569ba
commit 2e4dadaa80
5 changed files with 235 additions and 490 deletions
+24 -23
View File
@@ -1,6 +1,7 @@
from inspect import cleandoc
from comfy.comfy_types.node_typing import IO, ComfyNodeABC
class BooleanAnd:
class BooleanAnd(ComfyNodeABC):
"""
Returns the logical AND result of two boolean values.
@@ -10,12 +11,12 @@ class BooleanAnd:
def INPUT_TYPES(cls):
return {
"required": {
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "and_operation"
@@ -24,7 +25,7 @@ class BooleanAnd:
return (input1 and input2,)
class BooleanOr:
class BooleanOr(ComfyNodeABC):
"""
Returns the logical OR result of two boolean values.
@@ -34,12 +35,12 @@ class BooleanOr:
def INPUT_TYPES(cls):
return {
"required": {
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "or_operation"
@@ -48,7 +49,7 @@ class BooleanOr:
return (input1 or input2,)
class BooleanNot:
class BooleanNot(ComfyNodeABC):
"""
Returns the logical NOT result of a boolean value.
@@ -58,11 +59,11 @@ class BooleanNot:
def INPUT_TYPES(cls):
return {
"required": {
"input": ("BOOLEAN", {"default": False, "forceInput": True}),
"input": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "not_operation"
@@ -71,7 +72,7 @@ class BooleanNot:
return (not input,)
class BooleanXor:
class BooleanXor(ComfyNodeABC):
"""
Returns the logical XOR result of two boolean values.
@@ -81,12 +82,12 @@ class BooleanXor:
def INPUT_TYPES(cls):
return {
"required": {
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "xor_operation"
@@ -95,7 +96,7 @@ class BooleanXor:
return (input1 != input2,)
class BooleanNand:
class BooleanNand(ComfyNodeABC):
"""
Returns the logical NAND result of two boolean values.
@@ -105,12 +106,12 @@ class BooleanNand:
def INPUT_TYPES(cls):
return {
"required": {
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "nand_operation"
@@ -119,7 +120,7 @@ class BooleanNand:
return (not (input1 and input2),)
class BooleanNor:
class BooleanNor(ComfyNodeABC):
"""
Returns the logical NOR result of two boolean values.
@@ -129,12 +130,12 @@ class BooleanNor:
def INPUT_TYPES(cls):
return {
"required": {
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
}
}
RETURN_TYPES = ("BOOLEAN",)
RETURN_TYPES = (IO.BOOLEAN,)
CATEGORY = "Basic/BOOLEAN"
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "nor_operation"