dcc47598887cc642cb583d67833849e53922a09c
comfyui-node-template
A simple ComfyUI node development starter template.
Custom Node Class
Start by defining a node class.
class MyComfyNode:
__init__(self):
pass
Input Map
Required Inputs
@classmethod
def INPUT_TYPES(cls):
return {"required": {
# entry components go here,
}}
If the node does not require any inputs:
@classmethod
def INPUT_TYPES(cls):
return {}
Entry Components
STRING
Creates a string type entry.
"strval": ("STRING", {"default": "a string", "tooltip": "a string entry"})
FLOAT
Creates a float slider entry.
"floatval": ("FLOAT", {"default": 20.0, "min" 0.5, "max": 150.0, "step": 0.5, "tooltip": "a float"})
INT
Create a integer slider entry.
"intval": ("INT", {"default": 2, "min": 1, "max": 10, "tootip": "an integer"})
BOOLEAN
Create a boolean switch entry.
"boolval": ("BOOLEAN", {"default": False, "tooltip": "a boolean toggle"})
Output (RETURN) Map
Use the same constants as inputs.
RETURN_TYPES = ("STRING", "STRING", "FLOAT",) #output type
RETURN_NAMES = ("model", "vae", "amount",) # display name
Activation Function
FUNCTION = "execute"
def execute(self):
pass #do work
Metadata
CATEGORY = "<category>/MyComfyNode"
DESCRIPTION = "My handy ComfyUI node"
Node Mappings
NODE_CLASS_MAPPINGS = {
"MyComfyNode": MyComfyNode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"MyComfyNode": "My ComfyUI Node"
}
Node placement
The custom node directory goes in comfyui/custom_nodes/<my-comfy-node>
Languages
Python
100%