Commit ·
189f51c
1
Parent(s): 9a602b5
Delete ComfyUI_Comfyroll_CustomNodes
Browse files- ComfyUI_Comfyroll_CustomNodes/Comfyroll_Nodes.py +0 -859
- ComfyUI_Comfyroll_CustomNodes/Comfyroll_Pipe_Nodes.py +0 -271
- ComfyUI_Comfyroll_CustomNodes/README.md +0 -82
- ComfyUI_Comfyroll_CustomNodes/__init__.py +0 -35
- ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image1.png +0 -3
- ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image2.jpg +0 -3
- ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image3.JPG +0 -3
- ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image4.JPG +0 -3
ComfyUI_Comfyroll_CustomNodes/Comfyroll_Nodes.py
DELETED
|
@@ -1,859 +0,0 @@
|
|
| 1 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 2 |
-
# Comfyroll Custom Nodes by RockOfFire and Akatsuzi https://github.com/RockOfFire/ComfyUI_Comfyroll_CustomNodes #
|
| 3 |
-
# for ComfyUI https://github.com/comfyanonymous/ComfyUI #
|
| 4 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 5 |
-
|
| 6 |
-
import torch
|
| 7 |
-
import numpy as np
|
| 8 |
-
from PIL import Image, ImageEnhance
|
| 9 |
-
from PIL.PngImagePlugin import PngInfo
|
| 10 |
-
import os
|
| 11 |
-
import sys
|
| 12 |
-
|
| 13 |
-
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
| 14 |
-
|
| 15 |
-
import comfy.sd
|
| 16 |
-
import comfy.utils
|
| 17 |
-
import comfy.model_management
|
| 18 |
-
|
| 19 |
-
import folder_paths
|
| 20 |
-
import json
|
| 21 |
-
from nodes import MAX_RESOLUTION
|
| 22 |
-
|
| 23 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 24 |
-
|
| 25 |
-
class ComfyRoll_InputImages:
|
| 26 |
-
def __init__(self):
|
| 27 |
-
pass
|
| 28 |
-
|
| 29 |
-
@classmethod
|
| 30 |
-
def INPUT_TYPES(cls):
|
| 31 |
-
return {
|
| 32 |
-
"required": {
|
| 33 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 34 |
-
"image1": ("IMAGE",),
|
| 35 |
-
"image2": ("IMAGE",)
|
| 36 |
-
}
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
RETURN_TYPES = ("IMAGE",)
|
| 40 |
-
OUTPUT_NODE = True
|
| 41 |
-
FUNCTION = "InputImages"
|
| 42 |
-
|
| 43 |
-
CATEGORY = "Comfyroll/Logic"
|
| 44 |
-
|
| 45 |
-
def InputImages(self, Input, image1, image2):
|
| 46 |
-
if Input == 1:
|
| 47 |
-
return (image1, )
|
| 48 |
-
else:
|
| 49 |
-
return (image2, )
|
| 50 |
-
|
| 51 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 52 |
-
|
| 53 |
-
class ComfyRoll_InputImages_4way:
|
| 54 |
-
def __init__(self):
|
| 55 |
-
pass
|
| 56 |
-
|
| 57 |
-
@classmethod
|
| 58 |
-
def INPUT_TYPES(cls):
|
| 59 |
-
return {
|
| 60 |
-
"required": {
|
| 61 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 4}),
|
| 62 |
-
"image1": ("IMAGE",),
|
| 63 |
-
},
|
| 64 |
-
"optional": {
|
| 65 |
-
"image2": ("IMAGE",),
|
| 66 |
-
"image3": ("IMAGE",),
|
| 67 |
-
"image4": ("IMAGE",),
|
| 68 |
-
}
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
RETURN_TYPES = ("IMAGE",)
|
| 72 |
-
OUTPUT_NODE = True
|
| 73 |
-
FUNCTION = "InputImages_4"
|
| 74 |
-
|
| 75 |
-
CATEGORY = "Comfyroll/Logic"
|
| 76 |
-
|
| 77 |
-
def InputImages_4(self, Input, image1, image2=None, image3=None, image4=None):
|
| 78 |
-
if Input == 1:
|
| 79 |
-
return (image1, )
|
| 80 |
-
elif Input == 2:
|
| 81 |
-
return (image2, )
|
| 82 |
-
elif Input == 3:
|
| 83 |
-
return (image3, )
|
| 84 |
-
else:
|
| 85 |
-
return (image4, )
|
| 86 |
-
|
| 87 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 88 |
-
|
| 89 |
-
class ComfyRoll_InputLatents:
|
| 90 |
-
def __init__(self):
|
| 91 |
-
pass
|
| 92 |
-
|
| 93 |
-
@classmethod
|
| 94 |
-
def INPUT_TYPES(cls):
|
| 95 |
-
return {
|
| 96 |
-
"required": {
|
| 97 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 98 |
-
"latent1": ("LATENT",),
|
| 99 |
-
"latent2": ("LATENT",)
|
| 100 |
-
}
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
RETURN_TYPES = ("LATENT",)
|
| 104 |
-
OUTPUT_NODE = True
|
| 105 |
-
FUNCTION = "InputLatents"
|
| 106 |
-
|
| 107 |
-
CATEGORY = "Comfyroll/Logic"
|
| 108 |
-
|
| 109 |
-
def InputLatents(self, Input, latent1, latent2):
|
| 110 |
-
if Input == 1:
|
| 111 |
-
return (latent1, )
|
| 112 |
-
else:
|
| 113 |
-
return (latent2, )
|
| 114 |
-
|
| 115 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 116 |
-
|
| 117 |
-
class ComfyRoll_InputConditioning:
|
| 118 |
-
def __init__(self):
|
| 119 |
-
pass
|
| 120 |
-
|
| 121 |
-
@classmethod
|
| 122 |
-
def INPUT_TYPES(cls):
|
| 123 |
-
return {
|
| 124 |
-
"required": {
|
| 125 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 126 |
-
"conditioning1": ("CONDITIONING",),
|
| 127 |
-
"conditioning2": ("CONDITIONING",)
|
| 128 |
-
}
|
| 129 |
-
}
|
| 130 |
-
|
| 131 |
-
RETURN_TYPES = ("CONDITIONING",)
|
| 132 |
-
OUTPUT_NODE = True
|
| 133 |
-
FUNCTION = "InputConditioning"
|
| 134 |
-
|
| 135 |
-
CATEGORY = "Comfyroll/Logic"
|
| 136 |
-
|
| 137 |
-
def InputConditioning(self, Input, conditioning1, conditioning2):
|
| 138 |
-
if Input == 1:
|
| 139 |
-
return (conditioning1, )
|
| 140 |
-
else:
|
| 141 |
-
return (conditioning2, )
|
| 142 |
-
|
| 143 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 144 |
-
|
| 145 |
-
class ComfyRoll_InputClip:
|
| 146 |
-
def __init__(self):
|
| 147 |
-
pass
|
| 148 |
-
|
| 149 |
-
@classmethod
|
| 150 |
-
def INPUT_TYPES(cls):
|
| 151 |
-
return {
|
| 152 |
-
"required": {
|
| 153 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 154 |
-
"clip1": ("CLIP",),
|
| 155 |
-
"clip2": ("CLIP",)
|
| 156 |
-
}
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
RETURN_TYPES = ("CLIP",)
|
| 160 |
-
OUTPUT_NODE = True
|
| 161 |
-
FUNCTION = "InputClip"
|
| 162 |
-
|
| 163 |
-
CATEGORY = "Comfyroll/Logic"
|
| 164 |
-
|
| 165 |
-
def InputClip(self, Input, clip1, clip2):
|
| 166 |
-
if Input == 1:
|
| 167 |
-
return (clip1, )
|
| 168 |
-
else:
|
| 169 |
-
return (clip2, )
|
| 170 |
-
|
| 171 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 172 |
-
|
| 173 |
-
class ComfyRoll_InputModel:
|
| 174 |
-
def __init__(self):
|
| 175 |
-
pass
|
| 176 |
-
|
| 177 |
-
@classmethod
|
| 178 |
-
def INPUT_TYPES(cls):
|
| 179 |
-
return {
|
| 180 |
-
"required": {
|
| 181 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 182 |
-
"model1": ("MODEL",),
|
| 183 |
-
"model2": ("MODEL",)
|
| 184 |
-
}
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
RETURN_TYPES = ("MODEL",)
|
| 188 |
-
OUTPUT_NODE = True
|
| 189 |
-
FUNCTION = "InputModel"
|
| 190 |
-
|
| 191 |
-
CATEGORY = "Comfyroll/Logic"
|
| 192 |
-
|
| 193 |
-
def InputModel(self, Input, model1, model2):
|
| 194 |
-
if Input == 1:
|
| 195 |
-
return (model1, )
|
| 196 |
-
else:
|
| 197 |
-
return (model2, )
|
| 198 |
-
|
| 199 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 200 |
-
|
| 201 |
-
class ComfyRoll_InputControlNet:
|
| 202 |
-
def __init__(self):
|
| 203 |
-
pass
|
| 204 |
-
|
| 205 |
-
@classmethod
|
| 206 |
-
def INPUT_TYPES(cls):
|
| 207 |
-
return {
|
| 208 |
-
"required": {
|
| 209 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 210 |
-
"control_net1": ("CONTROL_NET",),
|
| 211 |
-
"control_net2": ("CONTROL_NET",)
|
| 212 |
-
}
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
RETURN_TYPES = ("CONTROL_NET",)
|
| 216 |
-
OUTPUT_NODE = True
|
| 217 |
-
FUNCTION = "InputControlNet"
|
| 218 |
-
|
| 219 |
-
CATEGORY = "Comfyroll/Logic"
|
| 220 |
-
|
| 221 |
-
def InputControlNet(self, Input, control_net1, control_net2):
|
| 222 |
-
if Input == 1:
|
| 223 |
-
return (control_net1, )
|
| 224 |
-
else:
|
| 225 |
-
return (control_net2, )
|
| 226 |
-
|
| 227 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 228 |
-
|
| 229 |
-
class ComfyRoll_LoraLoader:
|
| 230 |
-
def __init__(self):
|
| 231 |
-
self.loaded_lora = None
|
| 232 |
-
|
| 233 |
-
@classmethod
|
| 234 |
-
def INPUT_TYPES(s):
|
| 235 |
-
file_list = folder_paths.get_filename_list("loras")
|
| 236 |
-
file_list.insert(0, "None")
|
| 237 |
-
return {"required": { "model": ("MODEL",),
|
| 238 |
-
"clip": ("CLIP", ),
|
| 239 |
-
"switch": ([
|
| 240 |
-
"On",
|
| 241 |
-
"Off"],),
|
| 242 |
-
"lora_name": (file_list, ),
|
| 243 |
-
"strength_model": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01}),
|
| 244 |
-
"strength_clip": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01}),
|
| 245 |
-
}}
|
| 246 |
-
RETURN_TYPES = ("MODEL", "CLIP")
|
| 247 |
-
FUNCTION = "load_lora"
|
| 248 |
-
|
| 249 |
-
CATEGORY = "Comfyroll/IO"
|
| 250 |
-
|
| 251 |
-
def load_lora(self, model, clip, switch, lora_name, strength_model, strength_clip):
|
| 252 |
-
if strength_model == 0 and strength_clip == 0:
|
| 253 |
-
return (model, clip)
|
| 254 |
-
|
| 255 |
-
if switch == "Off" or lora_name == "None":
|
| 256 |
-
return (model, clip)
|
| 257 |
-
|
| 258 |
-
lora_path = folder_paths.get_full_path("loras", lora_name)
|
| 259 |
-
lora = None
|
| 260 |
-
if self.loaded_lora is not None:
|
| 261 |
-
if self.loaded_lora[0] == lora_path:
|
| 262 |
-
lora = self.loaded_lora[1]
|
| 263 |
-
else:
|
| 264 |
-
del self.loaded_lora
|
| 265 |
-
|
| 266 |
-
if lora is None:
|
| 267 |
-
lora = comfy.utils.load_torch_file(lora_path, safe_load=True)
|
| 268 |
-
self.loaded_lora = (lora_path, lora)
|
| 269 |
-
|
| 270 |
-
model_lora, clip_lora = comfy.sd.load_lora_for_models(model, clip, lora, strength_model, strength_clip)
|
| 271 |
-
return (model_lora, clip_lora)
|
| 272 |
-
|
| 273 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 274 |
-
|
| 275 |
-
class ComfyRoll_ApplyControlNet:
|
| 276 |
-
@classmethod
|
| 277 |
-
def INPUT_TYPES(s):
|
| 278 |
-
return {"required": {"conditioning": ("CONDITIONING", ),
|
| 279 |
-
"control_net": ("CONTROL_NET", ),
|
| 280 |
-
"image": ("IMAGE", ),
|
| 281 |
-
"switch": ([
|
| 282 |
-
"On",
|
| 283 |
-
"Off"],),
|
| 284 |
-
"strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01})
|
| 285 |
-
}}
|
| 286 |
-
RETURN_TYPES = ("CONDITIONING",)
|
| 287 |
-
FUNCTION = "apply_controlnet"
|
| 288 |
-
|
| 289 |
-
CATEGORY = "Comfyroll/Conditioning"
|
| 290 |
-
|
| 291 |
-
def apply_controlnet(self, conditioning, control_net, image, switch, strength):
|
| 292 |
-
if strength == 0 or switch == "Off":
|
| 293 |
-
return (conditioning, )
|
| 294 |
-
|
| 295 |
-
c = []
|
| 296 |
-
control_hint = image.movedim(-1,1)
|
| 297 |
-
for t in conditioning:
|
| 298 |
-
n = [t[0], t[1].copy()]
|
| 299 |
-
c_net = control_net.copy().set_cond_hint(control_hint, strength)
|
| 300 |
-
if 'control' in t[1]:
|
| 301 |
-
c_net.set_previous_controlnet(t[1]['control'])
|
| 302 |
-
n[1]['control'] = c_net
|
| 303 |
-
c.append(n)
|
| 304 |
-
return (c, )
|
| 305 |
-
|
| 306 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 307 |
-
|
| 308 |
-
class ComfyRoll_ImageSize_Float:
|
| 309 |
-
def __init__(self):
|
| 310 |
-
pass
|
| 311 |
-
|
| 312 |
-
@classmethod
|
| 313 |
-
def INPUT_TYPES(s):
|
| 314 |
-
return {
|
| 315 |
-
"required": {
|
| 316 |
-
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 317 |
-
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 318 |
-
"upscale_factor": ("FLOAT", {"default": 1, "min": 1, "max": 2000})
|
| 319 |
-
}
|
| 320 |
-
}
|
| 321 |
-
RETURN_TYPES = ("INT", "INT", "FLOAT")
|
| 322 |
-
#RETURN_NAMES = ("Width", "Height")
|
| 323 |
-
FUNCTION = "ImageSize_Float"
|
| 324 |
-
|
| 325 |
-
CATEGORY = "Comfyroll/Image"
|
| 326 |
-
|
| 327 |
-
def ImageSize_Float(self, width, height, upscale_factor):
|
| 328 |
-
return(width, height, upscale_factor)
|
| 329 |
-
|
| 330 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 331 |
-
|
| 332 |
-
class ComfyRoll_ImageOutput:
|
| 333 |
-
def __init__(self):
|
| 334 |
-
self.output_dir = folder_paths.get_output_directory()
|
| 335 |
-
self.type = "output"
|
| 336 |
-
|
| 337 |
-
@classmethod
|
| 338 |
-
def INPUT_TYPES(s):
|
| 339 |
-
return {"required":
|
| 340 |
-
{"images": ("IMAGE", ),
|
| 341 |
-
"output_type": (["Preview", "Save"],),
|
| 342 |
-
"filename_prefix": ("STRING", {"default": "ComfyUI"})},
|
| 343 |
-
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
| 344 |
-
}
|
| 345 |
-
|
| 346 |
-
RETURN_TYPES = ()
|
| 347 |
-
FUNCTION = "save_images"
|
| 348 |
-
|
| 349 |
-
OUTPUT_NODE = True
|
| 350 |
-
|
| 351 |
-
CATEGORY = "Comfyroll/Test"
|
| 352 |
-
|
| 353 |
-
def save_images(self, images, filename_prefix="ComfyUI", output_type = "Preview", prompt=None, extra_pnginfo=None):
|
| 354 |
-
def map_filename(filename):
|
| 355 |
-
prefix_len = len(os.path.basename(filename_prefix))
|
| 356 |
-
prefix = filename[:prefix_len + 1]
|
| 357 |
-
try:
|
| 358 |
-
digits = int(filename[prefix_len + 1:].split('_')[0])
|
| 359 |
-
except:
|
| 360 |
-
digits = 0
|
| 361 |
-
return (digits, prefix)
|
| 362 |
-
|
| 363 |
-
def compute_vars(input):
|
| 364 |
-
input = input.replace("%width%", str(images[0].shape[1]))
|
| 365 |
-
input = input.replace("%height%", str(images[0].shape[0]))
|
| 366 |
-
return input
|
| 367 |
-
|
| 368 |
-
if output_type == "Save":
|
| 369 |
-
self.output_dir = folder_paths.get_output_directory()
|
| 370 |
-
self.type = "output"
|
| 371 |
-
elif output_type == "Preview":
|
| 372 |
-
self.output_dir = folder_paths.get_temp_directory()
|
| 373 |
-
self.type = "temp"
|
| 374 |
-
|
| 375 |
-
filename_prefix = compute_vars(filename_prefix)
|
| 376 |
-
|
| 377 |
-
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
|
| 378 |
-
filename = os.path.basename(os.path.normpath(filename_prefix))
|
| 379 |
-
|
| 380 |
-
full_output_folder = os.path.join(self.output_dir, subfolder)
|
| 381 |
-
|
| 382 |
-
if os.path.commonpath((self.output_dir, os.path.abspath(full_output_folder))) != self.output_dir:
|
| 383 |
-
print("Saving image outside the output folder is not allowed.")
|
| 384 |
-
return {}
|
| 385 |
-
|
| 386 |
-
try:
|
| 387 |
-
counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
|
| 388 |
-
except ValueError:
|
| 389 |
-
counter = 1
|
| 390 |
-
except FileNotFoundError:
|
| 391 |
-
os.makedirs(full_output_folder, exist_ok=True)
|
| 392 |
-
counter = 1
|
| 393 |
-
|
| 394 |
-
results = list()
|
| 395 |
-
for image in images:
|
| 396 |
-
i = 255. * image.cpu().numpy()
|
| 397 |
-
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
| 398 |
-
metadata = PngInfo()
|
| 399 |
-
if prompt is not None:
|
| 400 |
-
metadata.add_text("prompt", json.dumps(prompt))
|
| 401 |
-
if extra_pnginfo is not None:
|
| 402 |
-
for x in extra_pnginfo:
|
| 403 |
-
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
| 404 |
-
|
| 405 |
-
file = f"{filename}_{counter:05}_.png"
|
| 406 |
-
img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=4)
|
| 407 |
-
results.append({
|
| 408 |
-
"filename": file,
|
| 409 |
-
"subfolder": subfolder,
|
| 410 |
-
"type": self.type
|
| 411 |
-
})
|
| 412 |
-
counter += 1
|
| 413 |
-
|
| 414 |
-
return { "ui": { "images": results } }
|
| 415 |
-
|
| 416 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 417 |
-
|
| 418 |
-
class CR_Int_Multiple_Of:
|
| 419 |
-
def __init__(self):
|
| 420 |
-
pass
|
| 421 |
-
|
| 422 |
-
@classmethod
|
| 423 |
-
def INPUT_TYPES(cls):
|
| 424 |
-
return {
|
| 425 |
-
"required": {
|
| 426 |
-
"integer": ("INT", {"default": 1, "min": -18446744073709551615, "max": 18446744073709551615}),
|
| 427 |
-
"multiple": ("FLOAT", {"default": 8, "min": 1, "max": 18446744073709551615}),
|
| 428 |
-
}
|
| 429 |
-
}
|
| 430 |
-
|
| 431 |
-
RETURN_TYPES =("INT",)
|
| 432 |
-
FUNCTION = "int_multiple_of"
|
| 433 |
-
|
| 434 |
-
CATEGORY = "Comfyroll/Math"
|
| 435 |
-
|
| 436 |
-
def int_multiple_of(self, integer, multiple=8):
|
| 437 |
-
if multiple == 0:
|
| 438 |
-
return (int(integer), )
|
| 439 |
-
integer = integer * multiple
|
| 440 |
-
return (int(integer), )
|
| 441 |
-
|
| 442 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 443 |
-
|
| 444 |
-
class ComfyRoll_AspectRatio:
|
| 445 |
-
def __init__(self):
|
| 446 |
-
pass
|
| 447 |
-
|
| 448 |
-
@classmethod
|
| 449 |
-
def INPUT_TYPES(s):
|
| 450 |
-
return {
|
| 451 |
-
"required": {
|
| 452 |
-
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 453 |
-
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 454 |
-
"aspect_ratio": (["custom", "1:1 square 512x512", "1:1 square 1024x1024", "2:3 portrait 512x768", "3:4 portrait 512x682", "3:2 landscape 768x512", "4:3 landscape 682x512", "16:9 cinema 910x512", "2:1 cinema 1024x512"],),
|
| 455 |
-
"swap_dimensions": (["Off", "On"],),
|
| 456 |
-
"upscale_factor1": ("FLOAT", {"default": 1, "min": 1, "max": 2000}),
|
| 457 |
-
"upscale_factor2": ("FLOAT", {"default": 1, "min": 1, "max": 2000}),
|
| 458 |
-
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64})
|
| 459 |
-
}
|
| 460 |
-
}
|
| 461 |
-
RETURN_TYPES = ("INT", "INT", "FLOAT", "FLOAT", "INT")
|
| 462 |
-
#RETURN_NAMES = ("Width", "Height")
|
| 463 |
-
FUNCTION = "Aspect_Ratio"
|
| 464 |
-
|
| 465 |
-
CATEGORY = "Comfyroll/Image"
|
| 466 |
-
|
| 467 |
-
def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_factor1, upscale_factor2, batch_size):
|
| 468 |
-
if swap_dimensions == "Off":
|
| 469 |
-
if aspect_ratio == "2:3 portrait 512x768":
|
| 470 |
-
width, height = 512, 768
|
| 471 |
-
elif aspect_ratio == "3:2 landscape 768x512":
|
| 472 |
-
width, height = 768, 512
|
| 473 |
-
elif aspect_ratio == "1:1 square 512x512":
|
| 474 |
-
width, height = 512, 512
|
| 475 |
-
elif aspect_ratio == "1:1 square 1024x1024":
|
| 476 |
-
width, height = 1024, 1024
|
| 477 |
-
elif aspect_ratio == "16:9 cinema 910x512":
|
| 478 |
-
width, height = 910, 512
|
| 479 |
-
elif aspect_ratio == "3:4 portrait 512x682":
|
| 480 |
-
width, height = 512, 682
|
| 481 |
-
elif aspect_ratio == "4:3 landscape 682x512":
|
| 482 |
-
width, height = 682, 512
|
| 483 |
-
elif aspect_ratio == "2:1 cinema 1024x512":
|
| 484 |
-
width, height = 1024, 512
|
| 485 |
-
return(width, height, upscale_factor1, upscale_factor2, batch_size)
|
| 486 |
-
elif swap_dimensions == "On":
|
| 487 |
-
if aspect_ratio == "2:3 portrait 512x768":
|
| 488 |
-
width, height = 512, 768
|
| 489 |
-
elif aspect_ratio == "3:2 landscape 768x512":
|
| 490 |
-
width, height = 768, 512
|
| 491 |
-
elif aspect_ratio == "1:1 square 512x512":
|
| 492 |
-
width, height = 512, 512
|
| 493 |
-
elif aspect_ratio == "1:1 square 1024x1024":
|
| 494 |
-
width, height = 1024, 1024
|
| 495 |
-
elif aspect_ratio == "16:9 cinema 910x512":
|
| 496 |
-
width,height = 910, 512
|
| 497 |
-
elif aspect_ratio == "3:4 portrait 512x682":
|
| 498 |
-
width, height = 512, 682
|
| 499 |
-
elif aspect_ratio == "4:3 landscape 682x512":
|
| 500 |
-
width, height = 682, 512
|
| 501 |
-
elif aspect_ratio == "2:1 cinema 1024x512":
|
| 502 |
-
width, height = 1024, 512
|
| 503 |
-
return(height, width, upscale_factor1, upscale_factor2, batch_size)
|
| 504 |
-
|
| 505 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 506 |
-
|
| 507 |
-
class ComfyRoll_AspectRatio_SDXL:
|
| 508 |
-
def __init__(self):
|
| 509 |
-
pass
|
| 510 |
-
|
| 511 |
-
@classmethod
|
| 512 |
-
def INPUT_TYPES(s):
|
| 513 |
-
return {
|
| 514 |
-
"required": {
|
| 515 |
-
"width": ("INT", {"default": 1024, "min": 64, "max": 2048}),
|
| 516 |
-
"height": ("INT", {"default": 1024, "min": 64, "max": 2048}),
|
| 517 |
-
"aspect_ratio": (["custom", "square 1024x1024", "portrait 896x1152", "portrait 832x1216", "portrait 768x1344", "portrait 640 x 1536", "landscape 1152x896", "landscape 1216x832", "landscape 1344x768", "landscape 1536x640"],),
|
| 518 |
-
"swap_dimensions": (["Off", "On"],),
|
| 519 |
-
"upscale_factor1": ("FLOAT", {"default": 1, "min": 1, "max": 2000}),
|
| 520 |
-
"upscale_factor2": ("FLOAT", {"default": 1, "min": 1, "max": 2000}),
|
| 521 |
-
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64})
|
| 522 |
-
}
|
| 523 |
-
}
|
| 524 |
-
RETURN_TYPES = ("INT", "INT", "FLOAT", "FLOAT", "INT")
|
| 525 |
-
#RETURN_NAMES = ("Width", "Height")
|
| 526 |
-
FUNCTION = "Aspect_Ratio"
|
| 527 |
-
|
| 528 |
-
CATEGORY = "Comfyroll/SDXL"
|
| 529 |
-
|
| 530 |
-
def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_factor1, upscale_factor2, batch_size):
|
| 531 |
-
if aspect_ratio == "square 1024x1024":
|
| 532 |
-
width, height = 1024, 1024
|
| 533 |
-
elif aspect_ratio == "portrait 896x1152":
|
| 534 |
-
width, height = 896, 1152
|
| 535 |
-
elif aspect_ratio == "portrait 832x1216":
|
| 536 |
-
width, height = 822, 1216
|
| 537 |
-
elif aspect_ratio == "portrait 768x1344":
|
| 538 |
-
width, height = 768, 1344
|
| 539 |
-
elif aspect_ratio == "portrait 640 x 1536":
|
| 540 |
-
width, height = 640, 1536
|
| 541 |
-
elif aspect_ratio == "landscape 1152x896":
|
| 542 |
-
width, height = 1152, 896
|
| 543 |
-
elif aspect_ratio == "landscape 1152x896":
|
| 544 |
-
width, height = 682, 512
|
| 545 |
-
elif aspect_ratio == "landscape 1216x832":
|
| 546 |
-
width, height = 1216, 832
|
| 547 |
-
elif aspect_ratio == "landscape 1344x768":
|
| 548 |
-
width, height = 1152, 896
|
| 549 |
-
elif aspect_ratio == "landscape 1536x640":
|
| 550 |
-
width, height = 1536, 640
|
| 551 |
-
|
| 552 |
-
if swap_dimensions == "On":
|
| 553 |
-
return(height, width, upscale_factor1, upscale_factor2, batch_size,)
|
| 554 |
-
else:
|
| 555 |
-
return(width, height, upscale_factor1, upscale_factor2, batch_size,)
|
| 556 |
-
|
| 557 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 558 |
-
|
| 559 |
-
class ComfyRoll_SeedToInt:
|
| 560 |
-
def __init__(self):
|
| 561 |
-
pass
|
| 562 |
-
|
| 563 |
-
@classmethod
|
| 564 |
-
def INPUT_TYPES(cls):
|
| 565 |
-
return {
|
| 566 |
-
"required": {
|
| 567 |
-
"seed": ("SEED", ),
|
| 568 |
-
}
|
| 569 |
-
}
|
| 570 |
-
|
| 571 |
-
RETURN_TYPES = ("INT",)
|
| 572 |
-
FUNCTION = "seed_to_int"
|
| 573 |
-
|
| 574 |
-
CATEGORY = "Comfyroll/Number"
|
| 575 |
-
|
| 576 |
-
def seed_to_int(self, seed):
|
| 577 |
-
return (seed.get('seed'),)
|
| 578 |
-
|
| 579 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 580 |
-
|
| 581 |
-
class Comfyroll_Color_Tint:
|
| 582 |
-
def __init__(self):
|
| 583 |
-
pass
|
| 584 |
-
|
| 585 |
-
@classmethod
|
| 586 |
-
def INPUT_TYPES(s):
|
| 587 |
-
return {
|
| 588 |
-
"required": {
|
| 589 |
-
"image": ("IMAGE",),
|
| 590 |
-
"strength": ("FLOAT", {
|
| 591 |
-
"default": 1.0,
|
| 592 |
-
"min": 0.1,
|
| 593 |
-
"max": 1.0,
|
| 594 |
-
"step": 0.1
|
| 595 |
-
}),
|
| 596 |
-
"mode": (["white", "black", "sepia", "red", "green", "blue", "cyan", "magenta", "yellow", "purple", "orange", "warm", "cool", "lime", "navy", "vintage", "rose", "teal", "maroon", "peach", "lavender", "olive"],),
|
| 597 |
-
},
|
| 598 |
-
}
|
| 599 |
-
|
| 600 |
-
RETURN_TYPES = ("IMAGE",)
|
| 601 |
-
FUNCTION = "color_tint"
|
| 602 |
-
|
| 603 |
-
CATEGORY = "Comfyroll/Image"
|
| 604 |
-
|
| 605 |
-
def color_tint(self, image: torch.Tensor, strength: float, mode: str = "sepia"):
|
| 606 |
-
if strength == 0:
|
| 607 |
-
return (image,)
|
| 608 |
-
|
| 609 |
-
sepia_weights = torch.tensor([0.2989, 0.5870, 0.1140]).view(1, 1, 1, 3).to(image.device)
|
| 610 |
-
|
| 611 |
-
mode_filters = {
|
| 612 |
-
"white": torch.tensor([1.0, 1.0, 1.0]),
|
| 613 |
-
"black": torch.tensor([0, 0, 0]),
|
| 614 |
-
"sepia": torch.tensor([1.0, 0.8, 0.6]),
|
| 615 |
-
"red": torch.tensor([1.0, 0.6, 0.6]),
|
| 616 |
-
"green": torch.tensor([0.6, 1.0, 0.6]),
|
| 617 |
-
"blue": torch.tensor([0.6, 0.8, 1.0]),
|
| 618 |
-
"cyan": torch.tensor([0.6, 1.0, 1.0]),
|
| 619 |
-
"magenta": torch.tensor([1.0, 0.6, 1.0]),
|
| 620 |
-
"yellow": torch.tensor([1.0, 1.0, 0.6]),
|
| 621 |
-
"purple": torch.tensor([0.8, 0.6, 1.0]),
|
| 622 |
-
"orange": torch.tensor([1.0, 0.7, 0.3]),
|
| 623 |
-
"warm": torch.tensor([1.0, 0.9, 0.7]),
|
| 624 |
-
"cool": torch.tensor([0.7, 0.9, 1.0]),
|
| 625 |
-
"lime": torch.tensor([0.7, 1.0, 0.3]),
|
| 626 |
-
"navy": torch.tensor([0.3, 0.4, 0.7]),
|
| 627 |
-
"vintage": torch.tensor([0.9, 0.85, 0.7]),
|
| 628 |
-
"rose": torch.tensor([1.0, 0.8, 0.9]),
|
| 629 |
-
"teal": torch.tensor([0.3, 0.8, 0.8]),
|
| 630 |
-
"maroon": torch.tensor([0.7, 0.3, 0.5]),
|
| 631 |
-
"peach": torch.tensor([1.0, 0.8, 0.6]),
|
| 632 |
-
"lavender": torch.tensor([0.8, 0.6, 1.0]),
|
| 633 |
-
"olive": torch.tensor([0.6, 0.7, 0.4]),
|
| 634 |
-
}
|
| 635 |
-
|
| 636 |
-
scale_filter = mode_filters[mode].view(1, 1, 1, 3).to(image.device)
|
| 637 |
-
|
| 638 |
-
grayscale = torch.sum(image * sepia_weights, dim=-1, keepdim=True)
|
| 639 |
-
tinted = grayscale * scale_filter
|
| 640 |
-
|
| 641 |
-
result = tinted * strength + image * (1 - strength)
|
| 642 |
-
return (result,)
|
| 643 |
-
|
| 644 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 645 |
-
|
| 646 |
-
class ComfyRoll_prompt_mixer:
|
| 647 |
-
def __init__(self):
|
| 648 |
-
pass
|
| 649 |
-
|
| 650 |
-
@classmethod
|
| 651 |
-
def INPUT_TYPES(s):
|
| 652 |
-
return {
|
| 653 |
-
"required":{
|
| 654 |
-
},
|
| 655 |
-
"optional":{
|
| 656 |
-
"prompt_positive": ("STRING", {"multiline": True, "default": "BASE_POSITIVE"}),
|
| 657 |
-
"prompt_negative": ("STRING", {"multiline": True, "default": "BASE_NEGATIVE"}),
|
| 658 |
-
"style_positive": ("STRING", {"multiline": True, "default": "REFINER_POSTIVE"}),
|
| 659 |
-
"style_negative": ("STRING", {"multiline": True, "default": "REFINER_NEGATIVE"}),
|
| 660 |
-
"preset": (["preset 1", "preset 2", "preset 3", "preset 4", "preset 5"],),
|
| 661 |
-
},
|
| 662 |
-
}
|
| 663 |
-
|
| 664 |
-
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING", "STRING", )
|
| 665 |
-
RETURN_NAMES = ("pos_g", "pos_l", "pos_r", "neg_g", "neg_l", "neg_r", )
|
| 666 |
-
FUNCTION = "mixer"
|
| 667 |
-
|
| 668 |
-
CATEGORY = "Comfyroll/SDXL"
|
| 669 |
-
|
| 670 |
-
def mixer(self, prompt_positive, prompt_negative, style_positive, style_negative, preset):
|
| 671 |
-
if preset == "preset 1":
|
| 672 |
-
pos_g = prompt_positive
|
| 673 |
-
pos_l = prompt_positive
|
| 674 |
-
pos_r = prompt_positive
|
| 675 |
-
neg_g = prompt_negative
|
| 676 |
-
neg_l = prompt_negative
|
| 677 |
-
neg_r = prompt_negative
|
| 678 |
-
elif preset == "preset 2":
|
| 679 |
-
pos_g = prompt_positive
|
| 680 |
-
pos_l = style_positive
|
| 681 |
-
pos_r = prompt_positive
|
| 682 |
-
neg_g = prompt_negative
|
| 683 |
-
neg_l = style_negative
|
| 684 |
-
neg_r = prompt_negative
|
| 685 |
-
elif preset == "preset 3":
|
| 686 |
-
pos_g = style_positive
|
| 687 |
-
pos_l = prompt_positive
|
| 688 |
-
pos_r = style_positive
|
| 689 |
-
neg_g = style_negative
|
| 690 |
-
neg_l = prompt_negative
|
| 691 |
-
neg_r = style_negative
|
| 692 |
-
elif preset == "preset 4":
|
| 693 |
-
pos_g = prompt_positive + style_positive
|
| 694 |
-
pos_l = prompt_positive + style_positive
|
| 695 |
-
pos_r = prompt_positive + style_positive
|
| 696 |
-
neg_g = prompt_negative + style_negative
|
| 697 |
-
neg_l = prompt_negative + style_negative
|
| 698 |
-
neg_r = prompt_negative + style_negative
|
| 699 |
-
elif preset == "preset 5":
|
| 700 |
-
pos_g = prompt_positive
|
| 701 |
-
pos_l = prompt_positive
|
| 702 |
-
pos_r = style_positive
|
| 703 |
-
neg_g = prompt_negative
|
| 704 |
-
neg_l = prompt_negative
|
| 705 |
-
neg_r = style_negative
|
| 706 |
-
return (pos_g, pos_l, pos_r, neg_g, neg_l, neg_r, )
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
class Comfyroll_SDXLStyleText:
|
| 715 |
-
@classmethod
|
| 716 |
-
def INPUT_TYPES(s):
|
| 717 |
-
return {"required": {
|
| 718 |
-
"positive_style": ("STRING", {"default": "POS_STYLE", "multiline": True}),
|
| 719 |
-
"negative_style": ("STRING", {"default": "NEG_STYLE", "multiline": True}),
|
| 720 |
-
},
|
| 721 |
-
}
|
| 722 |
-
|
| 723 |
-
RETURN_TYPES = ("STRING", "STRING", )
|
| 724 |
-
RETURN_NAMES = ("positive_prompt_text_l", "negative_prompt_text_l" )
|
| 725 |
-
FUNCTION = "get_value"
|
| 726 |
-
|
| 727 |
-
CATEGORY = "Comfyroll/SDXL"
|
| 728 |
-
|
| 729 |
-
def get_value(self, positive_style, negative_style):
|
| 730 |
-
return (positive_style, negative_style,)
|
| 731 |
-
|
| 732 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 733 |
-
|
| 734 |
-
class Comfyroll_SDXLBasePromptEncoder:
|
| 735 |
-
@classmethod
|
| 736 |
-
def INPUT_TYPES(s):
|
| 737 |
-
return {"required": {
|
| 738 |
-
"base_clip": ("CLIP", ),
|
| 739 |
-
"pos_g": ("STRING", {"multiline": True, "default": "POS_G"}),
|
| 740 |
-
"pos_l": ("STRING", {"multiline": True, "default": "POS_L"}),
|
| 741 |
-
"neg_g": ("STRING", {"multiline": True, "default": "NEG_G"}),
|
| 742 |
-
"neg_l": ("STRING", {"multiline": True, "default": "NEG_L"}),
|
| 743 |
-
"preset": (["preset A", "preset B", "preset C"],),
|
| 744 |
-
"base_width": ("INT", {"default": 4096.0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 745 |
-
"base_height": ("INT", {"default": 4096.0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 746 |
-
"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 747 |
-
"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 748 |
-
"target_width": ("INT", {"default": 4096.0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 749 |
-
"target_height": ("INT", {"default": 4096.0, "min": 0, "max": MAX_RESOLUTION, "step": 64}),
|
| 750 |
-
},
|
| 751 |
-
}
|
| 752 |
-
|
| 753 |
-
RETURN_TYPES = ("CONDITIONING", "CONDITIONING", )
|
| 754 |
-
RETURN_NAMES = ("base_positive", "base_negative", )
|
| 755 |
-
FUNCTION = "encode"
|
| 756 |
-
|
| 757 |
-
CATEGORY = "Comfyroll/SDXL"
|
| 758 |
-
|
| 759 |
-
def encode(self, base_clip, pos_g, pos_l, neg_g, neg_l, base_width, base_height, crop_w, crop_h, target_width, target_height, preset,):
|
| 760 |
-
empty = base_clip.tokenize("")
|
| 761 |
-
|
| 762 |
-
# positive prompt
|
| 763 |
-
tokens1 = base_clip.tokenize(pos_g)
|
| 764 |
-
tokens1["l"] = base_clip.tokenize(pos_l)["l"]
|
| 765 |
-
|
| 766 |
-
if len(tokens1["l"]) != len(tokens1["g"]):
|
| 767 |
-
while len(tokens1["l"]) < len(tokens1["g"]):
|
| 768 |
-
tokens1["l"] += empty["l"]
|
| 769 |
-
while len(tokens1["l"]) > len(tokens1["g"]):
|
| 770 |
-
tokens1["g"] += empty["g"]
|
| 771 |
-
|
| 772 |
-
cond1, pooled1 = base_clip.encode_from_tokens(tokens1, return_pooled=True)
|
| 773 |
-
res1 = [[cond1, {"pooled_output": pooled1, "width": base_width, "height": base_height, "crop_w": crop_w, "crop_h": crop_h, "target_width": target_width, "target_height": target_height}]]
|
| 774 |
-
|
| 775 |
-
# negative prompt
|
| 776 |
-
tokens2 = base_clip.tokenize(neg_g)
|
| 777 |
-
tokens2["l"] = base_clip.tokenize(neg_l)["l"]
|
| 778 |
-
|
| 779 |
-
if len(tokens2["l"]) != len(tokens2["g"]):
|
| 780 |
-
while len(tokens2["l"]) < len(tokens2["g"]):
|
| 781 |
-
tokens2["l"] += empty["l"]
|
| 782 |
-
while len(tokens2["l"]) > len(tokens2["g"]):
|
| 783 |
-
tokens2["g"] += empty["g"]
|
| 784 |
-
|
| 785 |
-
cond2, pooled2 = base_clip.encode_from_tokens(tokens2, return_pooled=True)
|
| 786 |
-
res2 = [[cond2, {"pooled_output": pooled2, "width": base_width, "height": base_height, "crop_w": crop_w, "crop_h": crop_h, "target_width": target_width, "target_height": target_height}]]
|
| 787 |
-
|
| 788 |
-
# positive style
|
| 789 |
-
tokens2 = base_clip.tokenize(pos_l)
|
| 790 |
-
tokens2["l"] = base_clip.tokenize(neg_l)["l"]
|
| 791 |
-
|
| 792 |
-
if len(tokens2["l"]) != len(tokens2["g"]):
|
| 793 |
-
while len(tokens2["l"]) < len(tokens2["g"]):
|
| 794 |
-
tokens2["l"] += empty["l"]
|
| 795 |
-
while len(tokens2["l"]) > len(tokens2["g"]):
|
| 796 |
-
tokens2["g"] += empty["g"]
|
| 797 |
-
|
| 798 |
-
cond2, pooled2 = base_clip.encode_from_tokens(tokens2, return_pooled=True)
|
| 799 |
-
res3 = [[cond2, {"pooled_output": pooled2, "width": base_width, "height": base_height, "crop_w": crop_w, "crop_h": crop_h, "target_width": target_width, "target_height": target_height}]]
|
| 800 |
-
|
| 801 |
-
# negative style
|
| 802 |
-
tokens2 = base_clip.tokenize(neg_l)
|
| 803 |
-
tokens2["l"] = base_clip.tokenize(neg_l)["l"]
|
| 804 |
-
|
| 805 |
-
if len(tokens2["l"]) != len(tokens2["g"]):
|
| 806 |
-
while len(tokens2["l"]) < len(tokens2["g"]):
|
| 807 |
-
tokens2["l"] += empty["l"]
|
| 808 |
-
while len(tokens2["l"]) > len(tokens2["g"]):
|
| 809 |
-
tokens2["g"] += empty["g"]
|
| 810 |
-
|
| 811 |
-
cond2, pooled2 = base_clip.encode_from_tokens(tokens2, return_pooled=True)
|
| 812 |
-
res4 = [[cond2, {"pooled_output": pooled2, "width": base_width, "height": base_height, "crop_w": crop_w, "crop_h": crop_h, "target_width": target_width, "target_height": target_height}]]
|
| 813 |
-
|
| 814 |
-
if preset == "preset A":
|
| 815 |
-
base_positive = res1
|
| 816 |
-
base_negative = res2
|
| 817 |
-
elif preset == "preset B":
|
| 818 |
-
base_positive = res3
|
| 819 |
-
base_negative = res4
|
| 820 |
-
elif preset == "preset C":
|
| 821 |
-
base_positive = res1 + res3
|
| 822 |
-
base_negative = res2 + res4
|
| 823 |
-
|
| 824 |
-
return (base_positive, base_negative, )
|
| 825 |
-
|
| 826 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
'''
|
| 831 |
-
NODE_CLASS_MAPPINGS = {
|
| 832 |
-
"CR Image Input Switch": ComfyRoll_InputImages,
|
| 833 |
-
"CR Image Input Switch (4 way)": ComfyRoll_InputImages_4way,
|
| 834 |
-
"CR Latent Input Switch": ComfyRoll_InputLatents,
|
| 835 |
-
"CR Conditioning Input Switch": ComfyRoll_InputConditioning,
|
| 836 |
-
"CR Clip Input Switch": ComfyRoll_InputClip,
|
| 837 |
-
"CR Model Input Switch": ComfyRoll_InputModel,
|
| 838 |
-
"CR ControlNet Input Switch": ComfyRoll_InputControlNet,
|
| 839 |
-
"CR Load LoRA": ComfyRoll_LoraLoader,
|
| 840 |
-
"CR Apply ControlNet": ComfyRoll_ApplyControlNet,
|
| 841 |
-
"CR Image Size": ComfyRoll_ImageSize_Float,
|
| 842 |
-
"CR Image Output": ComfyRoll_ImageOutput,
|
| 843 |
-
"CR Integer Multiple": CR_Int_Multiple_Of,
|
| 844 |
-
"CR Aspect Ratio": ComfyRoll_AspectRatio,
|
| 845 |
-
"CR Aspect Ratio SDXL": ComfyRoll_AspectRatio_SDXL,
|
| 846 |
-
"CR Seed to Int": ComfyRoll_SeedToInt,
|
| 847 |
-
"CR Color Tint": Comfyroll_Color_Tint,
|
| 848 |
-
"CR SDXL Prompt Mixer": ComfyRoll_prompt_mixer,
|
| 849 |
-
"CR SDXL Style Text": Comfyroll_SDXLStyleText,
|
| 850 |
-
"CR SDXL Base Prompt Encoder": Comfyroll_SDXLBasePromptEncoder,
|
| 851 |
-
}
|
| 852 |
-
'''
|
| 853 |
-
|
| 854 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 855 |
-
# Credits #
|
| 856 |
-
# WASasquatch https://github.com/WASasquatch/was-node-suite-comfyui #
|
| 857 |
-
# hnmr293 https://github.com/hnmr293/ComfyUI-nodes-hnmr #
|
| 858 |
-
# SeargeDP https://github.com/SeargeDP/SeargeSDXL
|
| 859 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ComfyUI_Comfyroll_CustomNodes/Comfyroll_Pipe_Nodes.py
DELETED
|
@@ -1,271 +0,0 @@
|
|
| 1 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 2 |
-
# Comfyroll Pipe Nodes by Akatsuzi https://github.com/RockOfFire/ComfyUI_Comfyroll_CustomNodes #
|
| 3 |
-
# for ComfyUI https://github.com/comfyanonymous/ComfyUI #
|
| 4 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 5 |
-
|
| 6 |
-
import os
|
| 7 |
-
import sys
|
| 8 |
-
import json
|
| 9 |
-
import torch
|
| 10 |
-
import comfy.sd
|
| 11 |
-
import comfy.utils
|
| 12 |
-
import numpy as np
|
| 13 |
-
|
| 14 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 15 |
-
|
| 16 |
-
class module_pipe_loader:
|
| 17 |
-
def __init__(self):
|
| 18 |
-
pass
|
| 19 |
-
|
| 20 |
-
@classmethod
|
| 21 |
-
def INPUT_TYPES(s):
|
| 22 |
-
return {
|
| 23 |
-
"required": {
|
| 24 |
-
#"model": ("MODEL",),
|
| 25 |
-
},
|
| 26 |
-
"optional": {
|
| 27 |
-
"model": ("MODEL",),
|
| 28 |
-
"pos": ("CONDITIONING",),
|
| 29 |
-
"neg": ("CONDITIONING",),
|
| 30 |
-
"latent": ("LATENT",),
|
| 31 |
-
"vae": ("VAE",),
|
| 32 |
-
"clip": ("CLIP",),
|
| 33 |
-
"controlnet": ("CONTROL_NET",),
|
| 34 |
-
"image": ("IMAGE",),
|
| 35 |
-
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})
|
| 36 |
-
},
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
RETURN_TYPES = ("PIPE_LINE", )
|
| 40 |
-
RETURN_NAMES = ("pipe", )
|
| 41 |
-
FUNCTION = "flush"
|
| 42 |
-
|
| 43 |
-
CATEGORY = "Comfyroll/Module"
|
| 44 |
-
|
| 45 |
-
def flush(self, model=0, pos=0, neg=0, latent=0, vae=0, clip=0, controlnet=0, image=0, seed=0):
|
| 46 |
-
pipe_line = (model, pos, neg, latent, vae, clip, controlnet, image, seed)
|
| 47 |
-
return (pipe_line, )
|
| 48 |
-
|
| 49 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 50 |
-
|
| 51 |
-
class module_input:
|
| 52 |
-
def __init__(self):
|
| 53 |
-
pass
|
| 54 |
-
|
| 55 |
-
@classmethod
|
| 56 |
-
def INPUT_TYPES(s):
|
| 57 |
-
return {
|
| 58 |
-
"required": {"pipe": ("PIPE_LINE",)},
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
RETURN_TYPES = ("PIPE_LINE", "MODEL", "CONDITIONING", "CONDITIONING", "LATENT", "VAE", "CLIP", "CONTROL_NET", "IMAGE", "INT")
|
| 62 |
-
RETURN_NAMES = ("pipe", "model", "pos", "neg", "latent", "vae", "clip", "controlnet", "image", "seed")
|
| 63 |
-
FUNCTION = "flush"
|
| 64 |
-
|
| 65 |
-
CATEGORY = "Comfyroll/Module"
|
| 66 |
-
|
| 67 |
-
def flush(self, pipe):
|
| 68 |
-
model, pos, neg, latent, vae, clip, controlnet, image, seed = pipe
|
| 69 |
-
return pipe, model, pos, neg, latent, vae, clip, controlnet, image, seed
|
| 70 |
-
|
| 71 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 72 |
-
|
| 73 |
-
class module_output:
|
| 74 |
-
def __init__(self):
|
| 75 |
-
pass
|
| 76 |
-
|
| 77 |
-
@classmethod
|
| 78 |
-
def INPUT_TYPES(s):
|
| 79 |
-
return {"required": {"pipe": ("PIPE_LINE",)},
|
| 80 |
-
"optional": {
|
| 81 |
-
"model": ("MODEL",),
|
| 82 |
-
"pos": ("CONDITIONING",),
|
| 83 |
-
"neg": ("CONDITIONING",),
|
| 84 |
-
"latent": ("LATENT",),
|
| 85 |
-
"vae": ("VAE",),
|
| 86 |
-
"clip": ("CLIP",),
|
| 87 |
-
"controlnet": ("CONTROL_NET",),
|
| 88 |
-
"image": ("IMAGE",),
|
| 89 |
-
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})
|
| 90 |
-
},
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
RETURN_TYPES = ("PIPE_LINE", )
|
| 94 |
-
RETURN_NAMES = ("pipe", )
|
| 95 |
-
FUNCTION = "flush"
|
| 96 |
-
|
| 97 |
-
CATEGORY = "Comfyroll/Module"
|
| 98 |
-
|
| 99 |
-
def flush(self, pipe, model=None, pos=None, neg=None, latent=None, vae=None, clip=None, controlnet=None, image=None, seed=None):
|
| 100 |
-
new_model, new_pos, new_neg, new_latent, new_vae, new_clip, new_controlnet, new_image, new_seed = pipe
|
| 101 |
-
|
| 102 |
-
if model is not None:
|
| 103 |
-
new_model = model
|
| 104 |
-
|
| 105 |
-
if pos is not None:
|
| 106 |
-
new_pos = pos
|
| 107 |
-
|
| 108 |
-
if neg is not None:
|
| 109 |
-
new_neg = neg
|
| 110 |
-
|
| 111 |
-
if latent is not None:
|
| 112 |
-
new_latent = latent
|
| 113 |
-
|
| 114 |
-
if vae is not None:
|
| 115 |
-
new_vae = vae
|
| 116 |
-
|
| 117 |
-
if clip is not None:
|
| 118 |
-
new_clip = clip
|
| 119 |
-
|
| 120 |
-
if controlnet is not None:
|
| 121 |
-
new_controlnet = controlnet
|
| 122 |
-
|
| 123 |
-
if image is not None:
|
| 124 |
-
new_image = image
|
| 125 |
-
|
| 126 |
-
if seed is not None:
|
| 127 |
-
new_seed = seed
|
| 128 |
-
|
| 129 |
-
pipe = new_model, new_pos, new_neg, new_latent, new_vae, new_clip, new_controlnet, new_image, new_seed
|
| 130 |
-
return (pipe, )
|
| 131 |
-
|
| 132 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 133 |
-
|
| 134 |
-
class image_pipe_in:
|
| 135 |
-
def __init__(self):
|
| 136 |
-
pass
|
| 137 |
-
|
| 138 |
-
@classmethod
|
| 139 |
-
def INPUT_TYPES(s):
|
| 140 |
-
return {
|
| 141 |
-
"required": {
|
| 142 |
-
#"model": ("MODEL",),
|
| 143 |
-
},
|
| 144 |
-
"optional": {
|
| 145 |
-
"image": ("IMAGE",),
|
| 146 |
-
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 147 |
-
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 148 |
-
"upscale_factor": ("FLOAT", {"default": 1, "min": 1, "max": 2000})
|
| 149 |
-
},
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
RETURN_TYPES = ("PIPE_LINE", )
|
| 153 |
-
RETURN_NAMES = ("pipe", )
|
| 154 |
-
FUNCTION = "flush"
|
| 155 |
-
|
| 156 |
-
CATEGORY = "Comfyroll/Module"
|
| 157 |
-
|
| 158 |
-
def flush(self, image=0, width=0, height=0, upscale_factor=0):
|
| 159 |
-
pipe_line = (image, width, height, upscale_factor)
|
| 160 |
-
return (pipe_line, )
|
| 161 |
-
|
| 162 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 163 |
-
|
| 164 |
-
class image_pipe_edit:
|
| 165 |
-
def __init__(self):
|
| 166 |
-
pass
|
| 167 |
-
|
| 168 |
-
@classmethod
|
| 169 |
-
def INPUT_TYPES(s):
|
| 170 |
-
return {"required": {"pipe": ("PIPE_LINE",)},
|
| 171 |
-
"optional": {
|
| 172 |
-
"image": ("IMAGE",),
|
| 173 |
-
"width": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 174 |
-
"height": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
| 175 |
-
"upscale_factor": ("FLOAT", {"default": 1, "min": 1, "max": 2000})
|
| 176 |
-
},
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
RETURN_TYPES = ("PIPE_LINE", )
|
| 180 |
-
RETURN_NAMES = ("pipe", )
|
| 181 |
-
FUNCTION = "flush"
|
| 182 |
-
|
| 183 |
-
CATEGORY = "Comfyroll/Module"
|
| 184 |
-
|
| 185 |
-
def flush(self, pipe, image=None, width=None, height=None, upscale_factor=None):
|
| 186 |
-
new_image, new_width, new_height, new_upscale_factor = pipe
|
| 187 |
-
|
| 188 |
-
if image is not None:
|
| 189 |
-
new_image = image
|
| 190 |
-
|
| 191 |
-
if width is not None:
|
| 192 |
-
new_width = width
|
| 193 |
-
|
| 194 |
-
if height is not None:
|
| 195 |
-
new_height = height
|
| 196 |
-
|
| 197 |
-
if upscale_factor is not None:
|
| 198 |
-
new_upscale_factor = upscale_factor
|
| 199 |
-
|
| 200 |
-
pipe = new_image, new_width, new_height, new_upscale_factor
|
| 201 |
-
return (pipe, )
|
| 202 |
-
|
| 203 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 204 |
-
|
| 205 |
-
class image_pipe_out:
|
| 206 |
-
def __init__(self):
|
| 207 |
-
pass
|
| 208 |
-
|
| 209 |
-
@classmethod
|
| 210 |
-
def INPUT_TYPES(s):
|
| 211 |
-
return {
|
| 212 |
-
"required": {"pipe": ("PIPE_LINE",)},
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
RETURN_TYPES = ("PIPE_LINE", "IMAGE", "INT", "INT", "FLOAT",)
|
| 216 |
-
RETURN_NAMES = ("pipe", "image", "width", "height", "upscale_factor")
|
| 217 |
-
FUNCTION = "flush"
|
| 218 |
-
|
| 219 |
-
CATEGORY = "Comfyroll/Module"
|
| 220 |
-
|
| 221 |
-
def flush(self, pipe):
|
| 222 |
-
#if switch == "Off":
|
| 223 |
-
#return (pipe, )
|
| 224 |
-
#else:
|
| 225 |
-
image, width, height, upscale_factor = pipe
|
| 226 |
-
return pipe, image, width, height, upscale_factor
|
| 227 |
-
|
| 228 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 229 |
-
|
| 230 |
-
class input_switch_pipe:
|
| 231 |
-
def __init__(self):
|
| 232 |
-
pass
|
| 233 |
-
|
| 234 |
-
@classmethod
|
| 235 |
-
def INPUT_TYPES(cls):
|
| 236 |
-
return {
|
| 237 |
-
"required": {
|
| 238 |
-
"Input": ("INT", {"default": 1, "min": 1, "max": 2}),
|
| 239 |
-
"pipe1": ("PIPE_LINE",),
|
| 240 |
-
"pipe2": ("PIPE_LINE",)
|
| 241 |
-
}
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
RETURN_TYPES = ("PIPE_LINE",)
|
| 245 |
-
OUTPUT_NODE = True
|
| 246 |
-
FUNCTION = "InputSwitchPipe"
|
| 247 |
-
|
| 248 |
-
CATEGORY = "Comfyroll/Module"
|
| 249 |
-
|
| 250 |
-
def InputSwitchPipe(self, Input, pipe1, pipe2):
|
| 251 |
-
if Input == 1:
|
| 252 |
-
return (pipe1, )
|
| 253 |
-
else:
|
| 254 |
-
return (pipe2, )
|
| 255 |
-
|
| 256 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 257 |
-
'''
|
| 258 |
-
NODE_CLASS_MAPPINGS_2 = {
|
| 259 |
-
"CR Module Pipe Loader": module_pipe_loader,
|
| 260 |
-
"CR Module Input": module_input,
|
| 261 |
-
"CR Module Output": module_output,
|
| 262 |
-
"CR Image Pipe In": image_pipe_in,
|
| 263 |
-
"CR Image Pipe Edit": image_pipe_edit,
|
| 264 |
-
"CR Image Pipe Out": image_pipe_out,
|
| 265 |
-
"CR Pipe Switch": input_switch_pipe,
|
| 266 |
-
}
|
| 267 |
-
'''
|
| 268 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
| 269 |
-
# Credits
|
| 270 |
-
# TinyTerra https://github.com/TinyTerra/ComfyUI_tinyterraNodes #
|
| 271 |
-
#---------------------------------------------------------------------------------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ComfyUI_Comfyroll_CustomNodes/README.md
DELETED
|
@@ -1,82 +0,0 @@
|
|
| 1 |
-
# Comfyroll Custom Nodes
|
| 2 |
-
|
| 3 |
-
These nodes were originally made for use in the Comfyroll Template Workflows.
|
| 4 |
-
|
| 5 |
-
[ComfyUI Template Workflows](https://civitai.com/models/59806/comfyroll-template-workflows)
|
| 6 |
-
|
| 7 |
-
[Comfyroll Pro Templates](https://civitai.com/models/85619/comfyroll-pro-template)
|
| 8 |
-
|
| 9 |
-
The nodes can be used in any ComfyUI workflow.
|
| 10 |
-
|
| 11 |
-
# Installation
|
| 12 |
-
|
| 13 |
-
If you have a previous version of the Comfyroll nodes from the Comfyroll Worflow Templates download, please delete this before installing these nodes.
|
| 14 |
-
|
| 15 |
-
1. cd custom_nodes
|
| 16 |
-
2. git clone https://github.com/RockOfFire/ComfyUI_Comfyroll_CustomNodes.git
|
| 17 |
-
3. Restart ComfyUI
|
| 18 |
-
|
| 19 |
-
You can also install the nodes using the following methods:
|
| 20 |
-
* install using [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager)
|
| 21 |
-
* download from [CivitAI](https://civitai.com/models/87609/comfyroll-custom-nodes-for-comfyui)
|
| 22 |
-
|
| 23 |
-
# List of Custom Nodes
|
| 24 |
-
|
| 25 |
-
__Logic__
|
| 26 |
-
* CR Image Input Switch
|
| 27 |
-
* CR Image Input Switch (4 way)
|
| 28 |
-
* CR Latent Input Switch
|
| 29 |
-
* CR Conditioning Input Switch
|
| 30 |
-
* CR Clip Input Switch
|
| 31 |
-
* CR Model Input Switch
|
| 32 |
-
* CR ControlNet Input Switch
|
| 33 |
-
|
| 34 |
-
__IO__
|
| 35 |
-
* CR Load LoRA
|
| 36 |
-
|
| 37 |
-
__Maths__
|
| 38 |
-
* CR Integer Multiple
|
| 39 |
-
|
| 40 |
-
__Number__
|
| 41 |
-
* CR Seed to Int
|
| 42 |
-
|
| 43 |
-
__Image__
|
| 44 |
-
* CR Image Size
|
| 45 |
-
* CR Aspect Ratio
|
| 46 |
-
* CR Color Tint
|
| 47 |
-
|
| 48 |
-
__Conditioning__
|
| 49 |
-
* CR Apply ControlNet
|
| 50 |
-
|
| 51 |
-
__SDXL__
|
| 52 |
-
* CR Aspect Ratio SDXL
|
| 53 |
-
* CR SDXL Prompt Mixer
|
| 54 |
-
* CR SDXL Style Text
|
| 55 |
-
|
| 56 |
-
__Module__
|
| 57 |
-
* CR Module Pipe Loader
|
| 58 |
-
* CR Module Input
|
| 59 |
-
* CR Module Output
|
| 60 |
-
* CR Image Pipe In
|
| 61 |
-
* CR Image Pipe Edit
|
| 62 |
-
* CR Image Pipe Out
|
| 63 |
-
* CR Pipe Switch
|
| 64 |
-
|
| 65 |
-

|
| 66 |
-
|
| 67 |
-

|
| 68 |
-
|
| 69 |
-

|
| 70 |
-
|
| 71 |
-

|
| 72 |
-
|
| 73 |
-
# Credits
|
| 74 |
-
|
| 75 |
-
comfyanonymous/[ComfyUI](https://github.com/comfyanonymous/ComfyUI) - A powerful and modular stable diffusion GUI.
|
| 76 |
-
|
| 77 |
-
WASasquatch/[was-node-suite-comfyui](https://github.com/WASasquatch/was-node-suite-comfyui) - A powerful custom node extensions of ComfyUI.
|
| 78 |
-
|
| 79 |
-
TinyTerra/[ComfyUI_tinyterraNodes](https://github.com/TinyTerra/ComfyUI_tinyterraNodes) - A selection of nodes for Stable Diffusion ComfyUI
|
| 80 |
-
|
| 81 |
-
hnmr293/[ComfyUI-nodes-hnmr](https://github.com/hnmr293/ComfyUI-nodes-hnmr) - ComfyUI custom nodes - merge, grid (aka xyz-plot) and others
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ComfyUI_Comfyroll_CustomNodes/__init__.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
from .Comfyroll_Nodes import *
|
| 2 |
-
from .Comfyroll_Pipe_Nodes import *
|
| 3 |
-
|
| 4 |
-
NODE_CLASS_MAPPINGS = {
|
| 5 |
-
"CR Module Pipe Loader": module_pipe_loader,
|
| 6 |
-
"CR Module Input": module_input,
|
| 7 |
-
"CR Module Output": module_output,
|
| 8 |
-
"CR Image Pipe In": image_pipe_in,
|
| 9 |
-
"CR Image Pipe Edit": image_pipe_edit,
|
| 10 |
-
"CR Image Pipe Out": image_pipe_out,
|
| 11 |
-
"CR Pipe Switch": input_switch_pipe,
|
| 12 |
-
"CR Image Input Switch": ComfyRoll_InputImages,
|
| 13 |
-
"CR Image Input Switch (4 way)": ComfyRoll_InputImages_4way,
|
| 14 |
-
"CR Latent Input Switch": ComfyRoll_InputLatents,
|
| 15 |
-
"CR Conditioning Input Switch": ComfyRoll_InputConditioning,
|
| 16 |
-
"CR Clip Input Switch": ComfyRoll_InputClip,
|
| 17 |
-
"CR Model Input Switch": ComfyRoll_InputModel,
|
| 18 |
-
"CR ControlNet Input Switch": ComfyRoll_InputControlNet,
|
| 19 |
-
"CR Load LoRA": ComfyRoll_LoraLoader,
|
| 20 |
-
"CR Apply ControlNet": ComfyRoll_ApplyControlNet,
|
| 21 |
-
"CR Image Size": ComfyRoll_ImageSize_Float,
|
| 22 |
-
"CR Image Output": ComfyRoll_ImageOutput,
|
| 23 |
-
"CR Integer Multiple": CR_Int_Multiple_Of,
|
| 24 |
-
"CR Aspect Ratio": ComfyRoll_AspectRatio,
|
| 25 |
-
"CR Aspect Ratio SDXL": ComfyRoll_AspectRatio_SDXL,
|
| 26 |
-
"CR Seed to Int": ComfyRoll_SeedToInt,
|
| 27 |
-
"CR Color Tint": Comfyroll_Color_Tint,
|
| 28 |
-
"CR SDXL Prompt Mixer": ComfyRoll_prompt_mixer,
|
| 29 |
-
"CR SDXL Style Text": Comfyroll_SDXLStyleText,
|
| 30 |
-
"CR SDXL Base Prompt Encoder": Comfyroll_SDXLBasePromptEncoder,
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
__all__ = ['NODE_CLASS_MAPPINGS']
|
| 34 |
-
|
| 35 |
-
print("\033[34mComfyroll Custom Nodes: \033[92mLoaded\033[0m")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image1.png
DELETED
Git LFS Details
|
ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image2.jpg
DELETED
Git LFS Details
|
ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image3.JPG
DELETED
Git LFS Details
|
ComfyUI_Comfyroll_CustomNodes/images/custom_nodes_image4.JPG
DELETED
Git LFS Details
|