File size: 10,211 Bytes
baa8e90 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
#---------------------------------------------------------------------------------------------------------------------#
# Comfyroll Pipe Nodes by Akatsuzi https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes
# for ComfyUI https://github.com/comfyanonymous/ComfyUI
#---------------------------------------------------------------------------------------------------------------------#
# based on Tiny Terra nodes
#---------------------------------------------------------------------------------------------------------------------#
from ..categories import icons
#---------------------------------------------------------------------------------------------------------------------#
# MODULE NODES
#---------------------------------------------------------------------------------------------------------------------#
class CR_ModulePipeLoader:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
#"model": ("MODEL",),
},
"optional": {
"model": ("MODEL",),
"pos": ("CONDITIONING",),
"neg": ("CONDITIONING",),
"latent": ("LATENT",),
"vae": ("VAE",),
"clip": ("CLIP",),
"controlnet": ("CONTROL_NET",),
"image": ("IMAGE",),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})
},
}
RETURN_TYPES = ("PIPE_LINE", "STRING", )
RETURN_NAMES = ("pipe", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Module")
def flush(self, model=0, pos=0, neg=0, latent=0, vae=0, clip=0, controlnet=0, image=0, seed=0):
pipe_line = (model, pos, neg, latent, vae, clip, controlnet, image, seed)
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-module-pipe-loader"
return (pipe_line, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_ModuleInput:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {"pipe": ("PIPE_LINE",)},
}
RETURN_TYPES = ("PIPE_LINE", "MODEL", "CONDITIONING", "CONDITIONING", "LATENT", "VAE", "CLIP", "CONTROL_NET", "IMAGE", "INT", "STRING", )
RETURN_NAMES = ("pipe", "model", "pos", "neg", "latent", "vae", "clip", "controlnet", "image", "seed", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Module")
def flush(self, pipe):
model, pos, neg, latent, vae, clip, controlnet, image, seed = pipe
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-module-input"
return (pipe, model, pos, neg, latent, vae, clip, controlnet, image, seed, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_ModuleOutput:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {"required": {"pipe": ("PIPE_LINE",)},
"optional": {
"model": ("MODEL",),
"pos": ("CONDITIONING",),
"neg": ("CONDITIONING",),
"latent": ("LATENT",),
"vae": ("VAE",),
"clip": ("CLIP",),
"controlnet": ("CONTROL_NET",),
"image": ("IMAGE",),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})
},
}
RETURN_TYPES = ("PIPE_LINE", "STRING", )
RETURN_NAMES = ("pipe", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Module")
def flush(self, pipe, model=None, pos=None, neg=None, latent=None, vae=None, clip=None, controlnet=None, image=None, seed=None):
new_model, new_pos, new_neg, new_latent, new_vae, new_clip, new_controlnet, new_image, new_seed = pipe
if model is not None:
new_model = model
if pos is not None:
new_pos = pos
if neg is not None:
new_neg = neg
if latent is not None:
new_latent = latent
if vae is not None:
new_vae = vae
if clip is not None:
new_clip = clip
if controlnet is not None:
new_controlnet = controlnet
if image is not None:
new_image = image
if seed is not None:
new_seed = seed
pipe = new_model, new_pos, new_neg, new_latent, new_vae, new_clip, new_controlnet, new_image, new_seed
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-module-output"
return (pipe, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
# PIPE NODES
#---------------------------------------------------------------------------------------------------------------------#
class CR_ImagePipeIn:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
#"model": ("MODEL",),
},
"optional": {
"image": ("IMAGE",),
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
"upscale_factor": ("FLOAT", {"default": 1, "min": 1, "max": 2000})
},
}
RETURN_TYPES = ("PIPE_LINE", "STRING", )
RETURN_NAMES = ("pipe", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Image")
def flush(self, image=0, width=0, height=0, upscale_factor=0):
pipe_line = (image, width, height, upscale_factor)
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-image-pipe-in"
return (pipe_line, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_ImagePipeEdit:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {"required": {"pipe": ("PIPE_LINE",)},
"optional": {
"image": ("IMAGE",),
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
"upscale_factor": ("FLOAT", {"default": 1, "min": 1, "max": 2000})
},
}
RETURN_TYPES = ("PIPE_LINE", "STRING", )
RETURN_NAMES = ("pipe", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Image")
def flush(self, pipe, image=None, width=None, height=None, upscale_factor=None):
new_image, new_width, new_height, new_upscale_factor = pipe
if image is not None:
new_image = image
if width is not None:
new_width = width
if height is not None:
new_height = height
if upscale_factor is not None:
new_upscale_factor = upscale_factor
pipe = new_image, new_width, new_height, new_upscale_factor
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-image-pipe-edit"
return (pipe, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_ImagePipeOut:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {"pipe": ("PIPE_LINE",)},
}
RETURN_TYPES = ("PIPE_LINE", "IMAGE", "INT", "INT", "FLOAT", "STRING", )
RETURN_NAMES = ("pipe", "image", "width", "height", "upscale_factor", "show_help", )
FUNCTION = "flush"
CATEGORY = icons.get("Comfyroll/Pipe/Image")
def flush(self, pipe):
#if switch == "Off":
#return (pipe, )
#else:
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-image-pipe-out"
image, width, height, upscale_factor = pipe
return (pipe, image, width, height, upscale_factor, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
class CR_InputSwitchPipe:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
"pipe1": ("PIPE_LINE",),
"pipe2": ("PIPE_LINE",)
}
}
RETURN_TYPES = ("PIPE_LINE", "STRING", )
RETURN_NAMES = ("PIPE_LINE", "show_help", )
OUTPUT_NODE = True
FUNCTION = "InputSwitchPipe"
CATEGORY = icons.get("Comfyroll/Pipe")
def InputSwitchPipe(self, Input, pipe1, pipe2):
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Pipe-Nodes#cr-pipe-switch"
if Input == 1:
return (pipe1, show_help, )
else:
return (pipe2, show_help, )
#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
#---------------------------------------------------------------------------------------------------------------------#
# For reference only, actual mappings are in __init__.py
'''
NODE_CLASS_MAPPINGS_2 = {
"CR Module Pipe Loader":CR_ModulePipeLoader,
"CR Module Input":CR_ModuleInput,
"CR Module Output":CR_ModuleOutput,
"CR Image Pipe In":CR_ImagePipeIn,
"CR Image Pipe Edit":CR_ImagePipeEdit,
"CR Image Pipe Out":CR_ImagePipeOut,
"CR Pipe Switch":CR_InputSwitchPipe,
}
'''
|