Skip to content

Commit

Permalink
Add comfy_types for node development.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Dec 30, 2024
1 parent 3a3ebd3 commit 94dac21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# cookiecutter-comfy-extension

## A cookiecutter template for writing a ComfyUI custom node extension
## Get started writing custom nodes in one step without setting up a ton of Python project config.

An opinionated way to develop ComfyUI custom nodes. Uses cookiecutter to scaffold a python project.

This template helps you

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Example:
from comfy_types import IO, ComfyNodeABC, InputTypeDict
from inspect import cleandoc
class ExampleNode(ComfyNodeABC):
"""
A example node
Expand Down Expand Up @@ -31,7 +33,7 @@ def __init__(self):
pass

@classmethod
def INPUT_TYPES(s):
def INPUT_TYPES(s) -> InputTypeDict:
"""
Return a dictionary which contains config for all input fields.
Some types (string): "MODEL", "VAE", "CLIP", "CONDITIONING", "LATENT", "IMAGE", "INT", "STRING", "FLOAT".
Expand All @@ -48,32 +50,32 @@ def INPUT_TYPES(s):
"""
return {
"required": {
"image": ("IMAGE", { "tooltip": "This is an image"}),
"int_field": ("INT", {
"image": (IO.IMAGE, { "tooltip": "This is an image"}),
"int_field": (IO.INT, {
"default": 0,
"min": 0, #Minimum value
"max": 4096, #Maximum value
"step": 64, #Slider's step
"display": "number" # Cosmetic only: display as "number" or "slider"
}),
"float_field": ("FLOAT", {
"float_field": (IO.FLOAT, {
"default": 1.0,
"min": 0.0,
"max": 10.0,
"step": 0.01,
"round": 0.001, #The value represeting the precision to round to, will be set to the step value by default. Can be set to False to disable rounding.
"display": "number"}),
"print_to_screen": (["enable", "disable"],),
"string_field": ("STRING", {
"string_field": (IO.STRING, {
"multiline": False, #True if you want the field to look like the one on the ClipTextEncode node
"default": "Hello World!"
}),
},
}

RETURN_TYPES = ("IMAGE",)
RETURN_TYPES = (IO.IMAGE,)
#RETURN_NAMES = ("image_output_name",)
DESCRIPTION = "This is an example node"
DESCRIPTION = cleandoc(__doc__)
FUNCTION = "test"

#OUTPUT_NODE = False
Expand Down

0 comments on commit 94dac21

Please sign in to comment.