Skip to content

develephant/comfyui-node-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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": {
        # required entry components go here,
    }}

Optional Inputs

@classmethod
def INPUT_TYPES(cls):
    return {
        "required": {
            # required entry components go here,
        },
        "optional": {
            # optional entries go here,
        }
    }

No 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"})

CLIP

Clip Input

"clip": ("CLIP", {"clip_name": "clip_name", "type":"stable_diffusion"})

MODEL

Model Input

VAE

VAE Input

CONDITIONING

Conditioning Input

IMAGE

Image Input

MASK

Mask Input

LATENT

Latent Input

CLIP_VISION

Clip Vision Input

CLIP_VISION_OUTPUT

Clip Vision Output

Drop Down Menu

"dropdown": (["opt_1", "opt_2", "opt_3"], "default": "opt_2")

Class Methods

@classmethod
def INPUT_TYPES(cls):
    res = s.do_something(cls)

@classmethod
def do_something(cls):
    #do work
    return res

Output (RETURN) Map

Uses 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>

About

A simple ComfyUI node development starter template.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages