参考
https://github.com/liubai-liubai/ComfyUI-ImgSeg-LB/tree/main
https://blog.styxhelix.life/?p=33
安装
不需要安装任何其他依赖文件,只需要把0x_erthor_node文件夹复制到custom_nodes文件夹下,就能安装成功。
a1:展示了代码结构,表明了每一块代码的作用是什么,哪里是输入,哪里是参数栏,哪里是输出。
a2:如何加入各种comfyui支持的数据类型,包括img,latent等。👇
a3:如何使用comfyui自带的库去索引参数,如ckpt,vae,clip等。👇
a4:一个最简的可以运行的节点,它创建一个空的torch.Tensor向量空间,也叫噪点图,并输出。只需要连接最基础的preview image节点就能展示出来。👇
模板
class MyNode:def __init__(self):pass@classmethoddef INPUT_TYPES(s):return {"required": {},}RETURN_TYPES = ()RETURN_NAMES = ()FUNCTION = "test"#OUTPUT_NODE = FalseCATEGORY = "image/mynode2"def test(self):return ()# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {"MyNode": MyNode
}# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {"FirstNode": "My First Node"
}