Merge 6bfe8ba1f826eba98e2d1c51bc8bb4fe0f306855 into d605677b33f165d9890e2c05ed5553e2734e9934

This commit is contained in:
Thomas Ward 2024-10-25 22:52:15 -04:00 committed by GitHub
commit 19b5a3c35e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,107 @@
class _CONSTANT_BASE:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s) -> dict:
raise NotImplementedError
RETURN_TYPES: tuple = ()
RETURN_NAMES: tuple = ()
CATEGORY: str = "constants"
FUNCTION: str = "process"
OUTPUT_NODE: bool = False
def process(self, value) -> tuple:
return (value,)
class ConstantFloat(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required": {
"value": ("FLOAT", {"default": 0.0})
}
}
RETURN_TYPES = ("FLOAT",)
RETURN_NAMES = ("float",)
class ConstantInteger(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required": {
"value": ("INT", {"default": 0})
}
}
RETURN_TYPES = ("INT",)
RETURN_NAMES = ("int",)
class ConstantString(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required" : {
"value": ("STRING", {"multiline": False, "dynamicPrompts": True})
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
class ConstantStringMultiline(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required": {
"value": ("STRING", {"multiline": True, "dynamicPrompts": True})
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
class ConstantNonDynamicString(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required" : {
"value": ("STRING", {"multiline": False, "dynamicPrompts": False})
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
class ConstantNonDynamicStringMultiline(_CONSTANT_BASE):
@classmethod
def INPUT_TYPES(s) -> dict:
return {
"required": {
"value": ("STRING", {"multiline": True, "dynamicPrompts": False})
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
NODE_CLASS_MAPPINGS = {
"ConstantFloat": ConstantFloat,
"ConstantInteger": ConstantInteger,
"ConstantString": ConstantString,
"ConstantStringMultiline": ConstantStringMultiline,
"ConstantNonDynamicString": ConstantNonDynamicString,
"ConstantNonDynamicStringMultiline": ConstantNonDynamicStringMultiline
}

View File

@ -2111,6 +2111,7 @@ def init_builtin_extra_nodes():
"nodes_flux.py", "nodes_flux.py",
"nodes_lora_extract.py", "nodes_lora_extract.py",
"nodes_torch_compile.py", "nodes_torch_compile.py",
"nodes_constant_values.py",
] ]
import_failed = [] import_failed = []