An open API service indexing awesome lists of open source software.

https://github.com/develephant/comfyui-node-template

A simple ComfyUI node development starter template.
https://github.com/develephant/comfyui-node-template

comfyui comfyui-custom-node comfyui-nodes

Last synced: 2 months ago
JSON representation

A simple ComfyUI node development starter template.

Awesome Lists containing this project

README

          

# comfyui-node-template

A simple ComfyUI node development starter template.

## Custom Node Class

Start by defining a node class.

```py
class MyComfyNode:

__init__(self):
pass

```

## Input Map

#### Required Inputs

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

#### Optional Inputs

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

#### No Inputs

```py
@classmethod
def INPUT_TYPES(cls):
return {}
```

## Entry Components

### STRING

Creates a string type entry.

```py
"strval": ("STRING", {"default": "a string", "tooltip": "a string entry"})
```

### FLOAT

Creates a float slider entry.

```py
"floatval": ("FLOAT", {"default": 20.0, "min" 0.5, "max": 150.0, "step": 0.5, "tooltip": "a float"})
```

### INT

Create a integer slider entry.

```py
"intval": ("INT", {"default": 2, "min": 1, "max": 10, "tootip": "an integer"})
```

### BOOLEAN

Create a boolean switch entry.

```py
"boolval": ("BOOLEAN", {"default": False, "tooltip": "a boolean toggle"})
```

### CLIP

Clip Input

```py
"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

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

## Class Methods

```py
@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.

```py
RETURN_TYPES = ("STRING", "STRING", "FLOAT",) #output type
RETURN_NAMES = ("model", "vae", "amount",) # display name
```

## Activation Function

```py
FUNCTION = "execute"

def execute(self):
pass #do work
```

## Metadata

```py
CATEGORY = "/MyComfyNode"
DESCRIPTION = "My handy ComfyUI node"
```

## Node Mappings

```py
NODE_CLASS_MAPPINGS = {
"MyComfyNode": MyComfyNode,
}

NODE_DISPLAY_NAME_MAPPINGS = {
"MyComfyNode": "My ComfyUI Node"
}
```

## Node placement

The custom node directory goes in `comfyui/custom_nodes/`