Files
2026-03-08 21:13:24 -05:00

59 lines
1.5 KiB
Python

# ComfyUI node
from .execute import MyExecuteClass
class MyComfyNode:
# runs on load only
def __init__(self):
self.execute_class = MyExecuteClass()
# node inputs, if any.
@classmethod
def INPUT_TYPES(cls):
return {"required": {
"prefix": ("STRING", {"default": "", "tooltip": "a prefix"}),
"slider_float": ("FLOAT", {"default": 20.0, "min": 1.0, "max": 99.0, "step": 0.5}),
"slider_int": ("INT", {"default": 5, "min": 1, "max": 20 }),
"toggle": ("BOOLEAN", {"default": False, "tooltip": "toggle me"}),
}}
#return {} #no inputs
# node title (visible title)
TITLE = "My ComfyUI Node"
# not a trailing comma, is tuple
# and must be returned as such.
# (see execute function)
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("output",)
# function to run on "execute"
FUNCTION = "execute"
# does node have an "output"
OUTPUT_NODE = True
# node metadata
CATEGORY = "category/MyComfyNode"
DESCRIPTION = "My ComfyUI Node"
# the node structure has changed
def IS_CHANGED():
return float("nan") #force cache refresh
# run the node execute method
def execute(self):
result = self.execute_class.run(self.toggle)
# return tuple
return (result,)
# node mappings (see also __init__.py)
NODE_CLASS_MAPPINGS = {
"MyComfyNode": MyComfyNode,
}
# name mappings
NODE_DISPLAY_NAME_MAPPINGS = {
"MyComfyNode": "My ComfyUI Node"
}