.
diff --git a/docs/hel-892/tts-reference/core__comfy_api__latest___ui.py b/docs/hel-892/tts-reference/core__comfy_api__latest___ui.py
new file mode 100644
index 00000000..e238cdf3
--- /dev/null
+++ b/docs/hel-892/tts-reference/core__comfy_api__latest___ui.py
@@ -0,0 +1,475 @@
+from __future__ import annotations
+
+import json
+import os
+import random
+import uuid
+from io import BytesIO
+
+import av
+import numpy as np
+import torch
+try:
+ import torchaudio
+ TORCH_AUDIO_AVAILABLE = True
+except:
+ TORCH_AUDIO_AVAILABLE = False
+from PIL import Image as PILImage
+from PIL.PngImagePlugin import PngInfo
+
+import folder_paths
+
+# used for image preview
+from comfy.cli_args import args
+from ._io import ComfyNode, FolderType, Image, _UIOutput
+
+
+class SavedResult(dict):
+ def __init__(self, filename: str, subfolder: str, type: FolderType):
+ super().__init__(filename=filename, subfolder=subfolder,type=type.value)
+
+ @property
+ def filename(self) -> str:
+ return self["filename"]
+
+ @property
+ def subfolder(self) -> str:
+ return self["subfolder"]
+
+ @property
+ def type(self) -> FolderType:
+ return FolderType(self["type"])
+
+
+class SavedImages(_UIOutput):
+ """A UI output class to represent one or more saved images, potentially animated."""
+ def __init__(self, results: list[SavedResult], is_animated: bool = False):
+ super().__init__()
+ self.results = results
+ self.is_animated = is_animated
+
+ def as_dict(self) -> dict:
+ data = {"images": self.results}
+ if self.is_animated:
+ data["animated"] = (True,)
+ return data
+
+
+class SavedAudios(_UIOutput):
+ """UI wrapper around one or more audio files on disk (FLAC / MP3 / Opus)."""
+ def __init__(self, results: list[SavedResult]):
+ super().__init__()
+ self.results = results
+
+ def as_dict(self) -> dict:
+ return {"audio": self.results}
+
+
+def _get_directory_by_folder_type(folder_type: FolderType) -> str:
+ if folder_type == FolderType.input:
+ return folder_paths.get_input_directory()
+ if folder_type == FolderType.output:
+ return folder_paths.get_output_directory()
+ return folder_paths.get_temp_directory()
+
+
+class ImageSaveHelper:
+ """A helper class with static methods to handle image saving and metadata."""
+
+ @staticmethod
+ def _convert_tensor_to_pil(image_tensor: torch.Tensor) -> PILImage.Image:
+ """Converts a single torch tensor to a PIL Image."""
+ return PILImage.fromarray(np.clip(255.0 * image_tensor.cpu().numpy(), 0, 255).astype(np.uint8))
+
+ @staticmethod
+ def _create_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
+ """Creates a PngInfo object with prompt and extra_pnginfo."""
+ if args.disable_metadata or cls is None or not cls.hidden:
+ return None
+ metadata = PngInfo()
+ if cls.hidden.prompt:
+ metadata.add_text("prompt", json.dumps(cls.hidden.prompt))
+ if cls.hidden.extra_pnginfo:
+ for x in cls.hidden.extra_pnginfo:
+ metadata.add_text(x, json.dumps(cls.hidden.extra_pnginfo[x]))
+ return metadata
+
+ @staticmethod
+ def _create_animated_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
+ """Creates a PngInfo object with prompt and extra_pnginfo for animated PNGs (APNG)."""
+ if args.disable_metadata or cls is None or not cls.hidden:
+ return None
+ metadata = PngInfo()
+ if cls.hidden.prompt:
+ metadata.add(
+ b"comf",
+ "prompt".encode("latin-1", "strict")
+ + b"\0"
+ + json.dumps(cls.hidden.prompt).encode("latin-1", "strict"),
+ after_idat=True,
+ )
+ if cls.hidden.extra_pnginfo:
+ for x in cls.hidden.extra_pnginfo:
+ metadata.add(
+ b"comf",
+ x.encode("latin-1", "strict")
+ + b"\0"
+ + json.dumps(cls.hidden.extra_pnginfo[x]).encode("latin-1", "strict"),
+ after_idat=True,
+ )
+ return metadata
+
+ @staticmethod
+ def _create_webp_metadata(pil_image: PILImage.Image, cls: type[ComfyNode] | None) -> PILImage.Exif:
+ """Creates EXIF metadata bytes for WebP images."""
+ exif_data = pil_image.getexif()
+ if args.disable_metadata or cls is None or cls.hidden is None:
+ return exif_data
+ if cls.hidden.prompt is not None:
+ exif_data[0x0110] = "prompt:{}".format(json.dumps(cls.hidden.prompt)) # EXIF 0x0110 = Model
+ if cls.hidden.extra_pnginfo is not None:
+ inital_exif_tag = 0x010F # EXIF 0x010f = Make
+ for key, value in cls.hidden.extra_pnginfo.items():
+ exif_data[inital_exif_tag] = "{}:{}".format(key, json.dumps(value))
+ inital_exif_tag -= 1
+ return exif_data
+
+ @staticmethod
+ def save_images(
+ images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, compress_level = 4,
+ ) -> list[SavedResult]:
+ """Saves a batch of images as individual PNG files."""
+ full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
+ filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
+ )
+ results = []
+ metadata = ImageSaveHelper._create_png_metadata(cls)
+ for batch_number, image_tensor in enumerate(images):
+ img = ImageSaveHelper._convert_tensor_to_pil(image_tensor)
+ filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
+ file = f"{filename_with_batch_num}_{counter:05}_.png"
+ img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=compress_level)
+ results.append(SavedResult(file, subfolder, folder_type))
+ counter += 1
+ return results
+
+ @staticmethod
+ def get_save_images_ui(images, filename_prefix: str, cls: type[ComfyNode] | None, compress_level=4) -> SavedImages:
+ """Saves a batch of images and returns a UI object for the node output."""
+ return SavedImages(
+ ImageSaveHelper.save_images(
+ images,
+ filename_prefix=filename_prefix,
+ folder_type=FolderType.output,
+ cls=cls,
+ compress_level=compress_level,
+ )
+ )
+
+ @staticmethod
+ def save_animated_png(
+ images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, fps: float, compress_level: int
+ ) -> SavedResult:
+ """Saves a batch of images as a single animated PNG."""
+ full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
+ filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
+ )
+ pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
+ metadata = ImageSaveHelper._create_animated_png_metadata(cls)
+ file = f"{filename}_{counter:05}_.png"
+ save_path = os.path.join(full_output_folder, file)
+ pil_images[0].save(
+ save_path,
+ pnginfo=metadata,
+ compress_level=compress_level,
+ save_all=True,
+ duration=int(1000.0 / fps),
+ append_images=pil_images[1:],
+ )
+ return SavedResult(file, subfolder, folder_type)
+
+ @staticmethod
+ def get_save_animated_png_ui(
+ images, filename_prefix: str, cls: type[ComfyNode] | None, fps: float, compress_level: int
+ ) -> SavedImages:
+ """Saves an animated PNG and returns a UI object for the node output."""
+ result = ImageSaveHelper.save_animated_png(
+ images,
+ filename_prefix=filename_prefix,
+ folder_type=FolderType.output,
+ cls=cls,
+ fps=fps,
+ compress_level=compress_level,
+ )
+ return SavedImages([result], is_animated=len(images) > 1)
+
+ @staticmethod
+ def save_animated_webp(
+ images,
+ filename_prefix: str,
+ folder_type: FolderType,
+ cls: type[ComfyNode] | None,
+ fps: float,
+ lossless: bool,
+ quality: int,
+ method: int,
+ ) -> SavedResult:
+ """Saves a batch of images as a single animated WebP."""
+ full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
+ filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
+ )
+ pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
+ pil_exif = ImageSaveHelper._create_webp_metadata(pil_images[0], cls)
+ file = f"{filename}_{counter:05}_.webp"
+ pil_images[0].save(
+ os.path.join(full_output_folder, file),
+ save_all=True,
+ duration=int(1000.0 / fps),
+ append_images=pil_images[1:],
+ exif=pil_exif,
+ lossless=lossless,
+ quality=quality,
+ method=method,
+ )
+ return SavedResult(file, subfolder, folder_type)
+
+ @staticmethod
+ def get_save_animated_webp_ui(
+ images,
+ filename_prefix: str,
+ cls: type[ComfyNode] | None,
+ fps: float,
+ lossless: bool,
+ quality: int,
+ method: int,
+ ) -> SavedImages:
+ """Saves an animated WebP and returns a UI object for the node output."""
+ result = ImageSaveHelper.save_animated_webp(
+ images,
+ filename_prefix=filename_prefix,
+ folder_type=FolderType.output,
+ cls=cls,
+ fps=fps,
+ lossless=lossless,
+ quality=quality,
+ method=method,
+ )
+ return SavedImages([result], is_animated=len(images) > 1)
+
+
+class AudioSaveHelper:
+ """A helper class with static methods to handle audio saving and metadata."""
+ _OPUS_RATES = [8000, 12000, 16000, 24000, 48000]
+
+ @staticmethod
+ def save_audio(
+ audio: dict,
+ filename_prefix: str,
+ folder_type: FolderType,
+ cls: type[ComfyNode] | None,
+ format: str = "flac",
+ quality: str = "128k",
+ ) -> list[SavedResult]:
+ full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
+ filename_prefix, _get_directory_by_folder_type(folder_type)
+ )
+
+ metadata = {}
+ if not args.disable_metadata and cls is not None:
+ if cls.hidden.prompt is not None:
+ metadata["prompt"] = json.dumps(cls.hidden.prompt)
+ if cls.hidden.extra_pnginfo is not None:
+ for x in cls.hidden.extra_pnginfo:
+ metadata[x] = json.dumps(cls.hidden.extra_pnginfo[x])
+
+ results = []
+ for batch_number, waveform in enumerate(audio["waveform"].cpu()):
+ filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
+ file = f"{filename_with_batch_num}_{counter:05}_.{format}"
+ output_path = os.path.join(full_output_folder, file)
+
+ # Use original sample rate initially
+ sample_rate = audio["sample_rate"]
+
+ # Handle Opus sample rate requirements
+ if format == "opus":
+ if sample_rate > 48000:
+ sample_rate = 48000
+ elif sample_rate not in AudioSaveHelper._OPUS_RATES:
+ # Find the next highest supported rate
+ for rate in sorted(AudioSaveHelper._OPUS_RATES):
+ if rate > sample_rate:
+ sample_rate = rate
+ break
+ if sample_rate not in AudioSaveHelper._OPUS_RATES: # Fallback if still not supported
+ sample_rate = 48000
+
+ # Resample if necessary
+ if sample_rate != audio["sample_rate"]:
+ if not TORCH_AUDIO_AVAILABLE:
+ raise Exception("torchaudio is not available; cannot resample audio.")
+ waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)
+
+ # Create output with specified format
+ output_buffer = BytesIO()
+ output_container = av.open(output_buffer, mode="w", format=format)
+
+ # Set metadata on the container
+ for key, value in metadata.items():
+ output_container.metadata[key] = value
+
+ layout = "mono" if waveform.shape[0] == 1 else "stereo"
+ # Set up the output stream with appropriate properties
+ if format == "opus":
+ out_stream = output_container.add_stream("libopus", rate=sample_rate, layout=layout)
+ if quality == "64k":
+ out_stream.bit_rate = 64000
+ elif quality == "96k":
+ out_stream.bit_rate = 96000
+ elif quality == "128k":
+ out_stream.bit_rate = 128000
+ elif quality == "192k":
+ out_stream.bit_rate = 192000
+ elif quality == "320k":
+ out_stream.bit_rate = 320000
+ elif format == "mp3":
+ out_stream = output_container.add_stream("libmp3lame", rate=sample_rate, layout=layout)
+ if quality == "V0":
+ # TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool
+ out_stream.codec_context.qscale = 1
+ elif quality == "128k":
+ out_stream.bit_rate = 128000
+ elif quality == "320k":
+ out_stream.bit_rate = 320000
+ else: # format == "flac":
+ out_stream = output_container.add_stream("flac", rate=sample_rate, layout=layout)
+
+ frame = av.AudioFrame.from_ndarray(
+ waveform.movedim(0, 1).reshape(1, -1).float().numpy(),
+ format="flt",
+ layout=layout,
+ )
+ frame.sample_rate = sample_rate
+ frame.pts = 0
+ output_container.mux(out_stream.encode(frame))
+
+ # Flush encoder
+ output_container.mux(out_stream.encode(None))
+
+ # Close containers
+ output_container.close()
+
+ # Write the output to file
+ output_buffer.seek(0)
+ with open(output_path, "wb") as f:
+ f.write(output_buffer.getbuffer())
+
+ results.append(SavedResult(file, subfolder, folder_type))
+ counter += 1
+
+ return results
+
+ @staticmethod
+ def get_save_audio_ui(
+ audio, filename_prefix: str, cls: type[ComfyNode] | None, format: str = "flac", quality: str = "128k",
+ ) -> SavedAudios:
+ """Save and instantly wrap for UI."""
+ return SavedAudios(
+ AudioSaveHelper.save_audio(
+ audio,
+ filename_prefix=filename_prefix,
+ folder_type=FolderType.output,
+ cls=cls,
+ format=format,
+ quality=quality,
+ )
+ )
+
+
+class PreviewImage(_UIOutput):
+ def __init__(self, image: Image.Type, animated: bool = False, cls: type[ComfyNode] = None, **kwargs):
+ self.values = ImageSaveHelper.save_images(
+ image,
+ filename_prefix="ComfyUI_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for _ in range(5)),
+ folder_type=FolderType.temp,
+ cls=cls,
+ compress_level=1,
+ )
+ self.animated = animated
+
+ def as_dict(self):
+ return {
+ "images": self.values,
+ "animated": (self.animated,)
+ }
+
+
+class PreviewMask(PreviewImage):
+ def __init__(self, mask: PreviewMask.Type, animated: bool=False, cls: ComfyNode=None, **kwargs):
+ preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
+ super().__init__(preview, animated, cls, **kwargs)
+
+
+class PreviewAudio(_UIOutput):
+ def __init__(self, audio: dict, cls: type[ComfyNode] = None, **kwargs):
+ self.values = AudioSaveHelper.save_audio(
+ audio,
+ filename_prefix="ComfyUI_temp_" + "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for _ in range(5)),
+ folder_type=FolderType.temp,
+ cls=cls,
+ format="flac",
+ quality="128k",
+ )
+
+ def as_dict(self) -> dict:
+ return {"audio": self.values}
+
+
+class PreviewVideo(_UIOutput):
+ def __init__(self, values: list[SavedResult | dict], **kwargs):
+ self.values = values
+
+ def as_dict(self):
+ return {"images": self.values, "animated": (True,)}
+
+
+class PreviewUI3D(_UIOutput):
+ def __init__(self, model_file, camera_info, **kwargs):
+ self.model_file = model_file
+ self.camera_info = camera_info
+ self.bg_image_path = None
+ bg_image = kwargs.get("bg_image", None)
+ if bg_image is not None:
+ img_array = (bg_image[0].cpu().numpy() * 255).astype(np.uint8)
+ img = PILImage.fromarray(img_array)
+ temp_dir = folder_paths.get_temp_directory()
+ filename = f"bg_{uuid.uuid4().hex}.png"
+ bg_image_path = os.path.join(temp_dir, filename)
+ img.save(bg_image_path, compress_level=1)
+ self.bg_image_path = f"temp/{filename}"
+
+ def as_dict(self):
+ return {"result": [self.model_file, self.camera_info, self.bg_image_path]}
+
+
+class PreviewText(_UIOutput):
+ def __init__(self, value: str, **kwargs):
+ self.value = value
+
+ def as_dict(self):
+ return {"text": (self.value,)}
+
+
+__all__ = [
+ "SavedResult",
+ "SavedImages",
+ "SavedAudios",
+ "ImageSaveHelper",
+ "AudioSaveHelper",
+ "PreviewImage",
+ "PreviewMask",
+ "PreviewAudio",
+ "PreviewVideo",
+ "PreviewUI3D",
+ "PreviewText",
+]
diff --git a/docs/hel-892/tts-reference/core__comfy_extras__nodes_audio.py b/docs/hel-892/tts-reference/core__comfy_extras__nodes_audio.py
new file mode 100644
index 00000000..43df0512
--- /dev/null
+++ b/docs/hel-892/tts-reference/core__comfy_extras__nodes_audio.py
@@ -0,0 +1,792 @@
+from __future__ import annotations
+
+import av
+import torchaudio
+import torch
+import comfy.model_management
+import folder_paths
+import os
+import hashlib
+import node_helpers
+import logging
+from typing_extensions import override
+from comfy_api.latest import ComfyExtension, IO, UI
+
+class EmptyLatentAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="EmptyLatentAudio",
+ display_name="Empty Latent Audio",
+ category="latent/audio",
+ inputs=[
+ IO.Float.Input("seconds", default=47.6, min=1.0, max=1000.0, step=0.1),
+ IO.Int.Input(
+ "batch_size", default=1, min=1, max=4096, tooltip="The number of latent images in the batch.",
+ ),
+ ],
+ outputs=[IO.Latent.Output()],
+ )
+
+ @classmethod
+ def execute(cls, seconds, batch_size) -> IO.NodeOutput:
+ length = round((seconds * 44100 / 2048) / 2) * 2
+ latent = torch.zeros([batch_size, 64, length], device=comfy.model_management.intermediate_device())
+ return IO.NodeOutput({"samples":latent, "type": "audio"})
+
+ generate = execute # TODO: remove
+
+
+class ConditioningStableAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="ConditioningStableAudio",
+ category="conditioning",
+ inputs=[
+ IO.Conditioning.Input("positive"),
+ IO.Conditioning.Input("negative"),
+ IO.Float.Input("seconds_start", default=0.0, min=0.0, max=1000.0, step=0.1),
+ IO.Float.Input("seconds_total", default=47.0, min=0.0, max=1000.0, step=0.1),
+ ],
+ outputs=[
+ IO.Conditioning.Output(display_name="positive"),
+ IO.Conditioning.Output(display_name="negative"),
+ ],
+ )
+
+ @classmethod
+ def execute(cls, positive, negative, seconds_start, seconds_total) -> IO.NodeOutput:
+ positive = node_helpers.conditioning_set_values(positive, {"seconds_start": seconds_start, "seconds_total": seconds_total})
+ negative = node_helpers.conditioning_set_values(negative, {"seconds_start": seconds_start, "seconds_total": seconds_total})
+ return IO.NodeOutput(positive, negative)
+
+ append = execute # TODO: remove
+
+
+class VAEEncodeAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="VAEEncodeAudio",
+ search_aliases=["audio to latent"],
+ display_name="VAE Encode Audio",
+ category="latent/audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.Vae.Input("vae"),
+ ],
+ outputs=[IO.Latent.Output()],
+ )
+
+ @classmethod
+ def execute(cls, vae, audio) -> IO.NodeOutput:
+ sample_rate = audio["sample_rate"]
+ vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
+ if vae_sample_rate != sample_rate:
+ waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, vae_sample_rate)
+ else:
+ waveform = audio["waveform"]
+
+ t = vae.encode(waveform.movedim(1, -1))
+ return IO.NodeOutput({"samples": t})
+
+ encode = execute # TODO: remove
+
+
+def vae_decode_audio(vae, samples, tile=None, overlap=None):
+ if tile is not None:
+ audio = vae.decode_tiled(samples["samples"], tile_y=tile, overlap=overlap).movedim(-1, 1)
+ else:
+ audio = vae.decode(samples["samples"]).movedim(-1, 1)
+
+ std = torch.std(audio, dim=[1, 2], keepdim=True) * 5.0
+ std[std < 1.0] = 1.0
+ audio /= std
+ vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
+ return {"waveform": audio, "sample_rate": vae_sample_rate if "sample_rate" not in samples else samples["sample_rate"]}
+
+
+class VAEDecodeAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="VAEDecodeAudio",
+ search_aliases=["latent to audio"],
+ display_name="VAE Decode Audio",
+ category="latent/audio",
+ inputs=[
+ IO.Latent.Input("samples"),
+ IO.Vae.Input("vae"),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, vae, samples) -> IO.NodeOutput:
+ return IO.NodeOutput(vae_decode_audio(vae, samples))
+
+ decode = execute # TODO: remove
+
+
+class VAEDecodeAudioTiled(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="VAEDecodeAudioTiled",
+ search_aliases=["latent to audio"],
+ display_name="VAE Decode Audio (Tiled)",
+ category="latent/audio",
+ inputs=[
+ IO.Latent.Input("samples"),
+ IO.Vae.Input("vae"),
+ IO.Int.Input("tile_size", default=512, min=32, max=8192, step=8),
+ IO.Int.Input("overlap", default=64, min=0, max=1024, step=8),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, vae, samples, tile_size, overlap) -> IO.NodeOutput:
+ return IO.NodeOutput(vae_decode_audio(vae, samples, tile_size, overlap))
+
+
+class SaveAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="SaveAudio",
+ search_aliases=["export flac"],
+ display_name="Save Audio (FLAC)",
+ category="audio",
+ essentials_category="Audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.String.Input("filename_prefix", default="audio/ComfyUI"),
+ ],
+ hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
+ is_output_node=True,
+ )
+
+ @classmethod
+ def execute(cls, audio, filename_prefix="ComfyUI", format="flac") -> IO.NodeOutput:
+ return IO.NodeOutput(
+ ui=UI.AudioSaveHelper.get_save_audio_ui(audio, filename_prefix=filename_prefix, cls=cls, format=format)
+ )
+
+ save_flac = execute # TODO: remove
+
+
+class SaveAudioMP3(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="SaveAudioMP3",
+ search_aliases=["export mp3"],
+ display_name="Save Audio (MP3)",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.String.Input("filename_prefix", default="audio/ComfyUI"),
+ IO.Combo.Input("quality", options=["V0", "128k", "320k"], default="V0"),
+ ],
+ hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
+ is_output_node=True,
+ )
+
+ @classmethod
+ def execute(cls, audio, filename_prefix="ComfyUI", format="mp3", quality="128k") -> IO.NodeOutput:
+ return IO.NodeOutput(
+ ui=UI.AudioSaveHelper.get_save_audio_ui(
+ audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
+ )
+ )
+
+ save_mp3 = execute # TODO: remove
+
+
+class SaveAudioOpus(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="SaveAudioOpus",
+ search_aliases=["export opus"],
+ display_name="Save Audio (Opus)",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.String.Input("filename_prefix", default="audio/ComfyUI"),
+ IO.Combo.Input("quality", options=["64k", "96k", "128k", "192k", "320k"], default="128k"),
+ ],
+ hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
+ is_output_node=True,
+ )
+
+ @classmethod
+ def execute(cls, audio, filename_prefix="ComfyUI", format="opus", quality="V3") -> IO.NodeOutput:
+ return IO.NodeOutput(
+ ui=UI.AudioSaveHelper.get_save_audio_ui(
+ audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
+ )
+ )
+
+ save_opus = execute # TODO: remove
+
+
+class PreviewAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="PreviewAudio",
+ search_aliases=["play audio"],
+ display_name="Preview Audio",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ ],
+ hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
+ is_output_node=True,
+ )
+
+ @classmethod
+ def execute(cls, audio) -> IO.NodeOutput:
+ return IO.NodeOutput(ui=UI.PreviewAudio(audio, cls=cls))
+
+ save_flac = execute # TODO: remove
+
+
+def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
+ """Convert audio to float 32 bits PCM format."""
+ if wav.dtype.is_floating_point:
+ return wav
+ elif wav.dtype == torch.int16:
+ return wav.float() / (2 ** 15)
+ elif wav.dtype == torch.int32:
+ return wav.float() / (2 ** 31)
+ raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
+
+def load(filepath: str) -> tuple[torch.Tensor, int]:
+ with av.open(filepath) as af:
+ if not af.streams.audio:
+ raise ValueError("No audio stream found in the file.")
+
+ stream = af.streams.audio[0]
+ sr = stream.codec_context.sample_rate
+ n_channels = stream.channels
+
+ frames = []
+ length = 0
+ for frame in af.decode(streams=stream.index):
+ buf = torch.from_numpy(frame.to_ndarray())
+ if buf.shape[0] != n_channels:
+ buf = buf.view(-1, n_channels).t()
+
+ frames.append(buf)
+ length += buf.shape[1]
+
+ if not frames:
+ raise ValueError("No audio frames decoded.")
+
+ wav = torch.cat(frames, dim=1)
+ wav = f32_pcm(wav)
+ return wav, sr
+
+class LoadAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ input_dir = folder_paths.get_input_directory()
+ files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
+ return IO.Schema(
+ node_id="LoadAudio",
+ search_aliases=["import audio", "open audio", "audio file"],
+ display_name="Load Audio",
+ category="audio",
+ essentials_category="Audio",
+ inputs=[
+ IO.Combo.Input("audio", upload=IO.UploadType.audio, options=sorted(files)),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio) -> IO.NodeOutput:
+ audio_path = folder_paths.get_annotated_filepath(audio)
+ waveform, sample_rate = load(audio_path)
+ audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
+ return IO.NodeOutput(audio)
+
+ @classmethod
+ def fingerprint_inputs(cls, audio):
+ image_path = folder_paths.get_annotated_filepath(audio)
+ m = hashlib.sha256()
+ with open(image_path, 'rb') as f:
+ m.update(f.read())
+ return m.digest().hex()
+
+ @classmethod
+ def validate_inputs(cls, audio):
+ if not folder_paths.exists_annotated_filepath(audio):
+ return "Invalid audio file: {}".format(audio)
+ return True
+
+ load = execute # TODO: remove
+
+
+class RecordAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="RecordAudio",
+ search_aliases=["microphone input", "audio capture", "voice input"],
+ display_name="Record Audio",
+ category="audio",
+ inputs=[
+ IO.Custom("AUDIO_RECORD").Input("audio"),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio) -> IO.NodeOutput:
+ audio_path = folder_paths.get_annotated_filepath(audio)
+
+ waveform, sample_rate = load(audio_path)
+ audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
+ return IO.NodeOutput(audio)
+
+ load = execute # TODO: remove
+
+
+class TrimAudioDuration(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="TrimAudioDuration",
+ search_aliases=["cut audio", "audio clip", "shorten audio"],
+ display_name="Trim Audio Duration",
+ description="Trim audio tensor into chosen time range.",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.Float.Input(
+ "start_index",
+ default=0.0,
+ min=-0xffffffffffffffff,
+ max=0xffffffffffffffff,
+ step=0.01,
+ tooltip="Start time in seconds, can be negative to count from the end (supports sub-seconds).",
+ ),
+ IO.Float.Input(
+ "duration",
+ default=60.0,
+ min=0.0,
+ step=0.01,
+ tooltip="Duration in seconds",
+ ),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio, start_index, duration) -> IO.NodeOutput:
+ waveform = audio["waveform"]
+ sample_rate = audio["sample_rate"]
+ audio_length = waveform.shape[-1]
+
+ if start_index < 0:
+ start_frame = audio_length + int(round(start_index * sample_rate))
+ else:
+ start_frame = int(round(start_index * sample_rate))
+ start_frame = max(0, min(start_frame, audio_length - 1))
+
+ end_frame = start_frame + int(round(duration * sample_rate))
+ end_frame = max(0, min(end_frame, audio_length))
+
+ if start_frame >= end_frame:
+ raise ValueError("AudioTrim: Start time must be less than end time and be within the audio length.")
+
+ return IO.NodeOutput({"waveform": waveform[..., start_frame:end_frame], "sample_rate": sample_rate})
+
+ trim = execute # TODO: remove
+
+
+class SplitAudioChannels(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="SplitAudioChannels",
+ search_aliases=["stereo to mono"],
+ display_name="Split Audio Channels",
+ description="Separates the audio into left and right channels.",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ ],
+ outputs=[
+ IO.Audio.Output(display_name="left"),
+ IO.Audio.Output(display_name="right"),
+ ],
+ )
+
+ @classmethod
+ def execute(cls, audio) -> IO.NodeOutput:
+ waveform = audio["waveform"]
+ sample_rate = audio["sample_rate"]
+
+ if waveform.shape[1] != 2:
+ raise ValueError("AudioSplit: Input audio has only one channel.")
+
+ left_channel = waveform[..., 0:1, :]
+ right_channel = waveform[..., 1:2, :]
+
+ return IO.NodeOutput({"waveform": left_channel, "sample_rate": sample_rate}, {"waveform": right_channel, "sample_rate": sample_rate})
+
+ separate = execute # TODO: remove
+
+class JoinAudioChannels(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="JoinAudioChannels",
+ display_name="Join Audio Channels",
+ description="Joins left and right mono audio channels into a stereo audio.",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio_left"),
+ IO.Audio.Input("audio_right"),
+ ],
+ outputs=[
+ IO.Audio.Output(display_name="audio"),
+ ],
+ )
+
+ @classmethod
+ def execute(cls, audio_left, audio_right) -> IO.NodeOutput:
+ waveform_left = audio_left["waveform"]
+ sample_rate_left = audio_left["sample_rate"]
+ waveform_right = audio_right["waveform"]
+ sample_rate_right = audio_right["sample_rate"]
+
+ if waveform_left.shape[1] != 1 or waveform_right.shape[1] != 1:
+ raise ValueError("AudioJoin: Both input audios must be mono.")
+
+ # Handle different sample rates by resampling to the higher rate
+ waveform_left, waveform_right, output_sample_rate = match_audio_sample_rates(
+ waveform_left, sample_rate_left, waveform_right, sample_rate_right
+ )
+
+ # Handle different lengths by trimming to the shorter length
+ length_left = waveform_left.shape[-1]
+ length_right = waveform_right.shape[-1]
+
+ if length_left != length_right:
+ min_length = min(length_left, length_right)
+ if length_left > min_length:
+ logging.info(f"JoinAudioChannels: Trimming left channel from {length_left} to {min_length} samples.")
+ waveform_left = waveform_left[..., :min_length]
+ if length_right > min_length:
+ logging.info(f"JoinAudioChannels: Trimming right channel from {length_right} to {min_length} samples.")
+ waveform_right = waveform_right[..., :min_length]
+
+ # Join the channels into stereo
+ left_channel = waveform_left[..., 0:1, :]
+ right_channel = waveform_right[..., 0:1, :]
+ stereo_waveform = torch.cat([left_channel, right_channel], dim=1)
+
+ return IO.NodeOutput({"waveform": stereo_waveform, "sample_rate": output_sample_rate})
+
+
+def match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2):
+ if sample_rate_1 != sample_rate_2:
+ if sample_rate_1 > sample_rate_2:
+ waveform_2 = torchaudio.functional.resample(waveform_2, sample_rate_2, sample_rate_1)
+ output_sample_rate = sample_rate_1
+ logging.info(f"Resampling audio2 from {sample_rate_2}Hz to {sample_rate_1}Hz for merging.")
+ else:
+ waveform_1 = torchaudio.functional.resample(waveform_1, sample_rate_1, sample_rate_2)
+ output_sample_rate = sample_rate_2
+ logging.info(f"Resampling audio1 from {sample_rate_1}Hz to {sample_rate_2}Hz for merging.")
+ else:
+ output_sample_rate = sample_rate_1
+ return waveform_1, waveform_2, output_sample_rate
+
+
+class AudioConcat(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="AudioConcat",
+ search_aliases=["join audio", "combine audio", "append audio"],
+ display_name="Audio Concat",
+ description="Concatenates the audio1 to audio2 in the specified direction.",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio1"),
+ IO.Audio.Input("audio2"),
+ IO.Combo.Input(
+ "direction",
+ options=['after', 'before'],
+ default="after",
+ tooltip="Whether to append audio2 after or before audio1.",
+ )
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio1, audio2, direction) -> IO.NodeOutput:
+ waveform_1 = audio1["waveform"]
+ waveform_2 = audio2["waveform"]
+ sample_rate_1 = audio1["sample_rate"]
+ sample_rate_2 = audio2["sample_rate"]
+
+ if waveform_1.shape[1] == 1:
+ waveform_1 = waveform_1.repeat(1, 2, 1)
+ logging.info("AudioConcat: Converted mono audio1 to stereo by duplicating the channel.")
+ if waveform_2.shape[1] == 1:
+ waveform_2 = waveform_2.repeat(1, 2, 1)
+ logging.info("AudioConcat: Converted mono audio2 to stereo by duplicating the channel.")
+
+ waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
+
+ if direction == 'after':
+ concatenated_audio = torch.cat((waveform_1, waveform_2), dim=2)
+ elif direction == 'before':
+ concatenated_audio = torch.cat((waveform_2, waveform_1), dim=2)
+
+ return IO.NodeOutput({"waveform": concatenated_audio, "sample_rate": output_sample_rate})
+
+ concat = execute # TODO: remove
+
+
+class AudioMerge(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="AudioMerge",
+ search_aliases=["mix audio", "overlay audio", "layer audio"],
+ display_name="Audio Merge",
+ description="Combine two audio tracks by overlaying their waveforms.",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio1"),
+ IO.Audio.Input("audio2"),
+ IO.Combo.Input(
+ "merge_method",
+ options=["add", "mean", "subtract", "multiply"],
+ tooltip="The method used to combine the audio waveforms.",
+ )
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio1, audio2, merge_method) -> IO.NodeOutput:
+ waveform_1 = audio1["waveform"]
+ waveform_2 = audio2["waveform"]
+ sample_rate_1 = audio1["sample_rate"]
+ sample_rate_2 = audio2["sample_rate"]
+
+ waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
+
+ length_1 = waveform_1.shape[-1]
+ length_2 = waveform_2.shape[-1]
+
+ if length_2 > length_1:
+ logging.info(f"AudioMerge: Trimming audio2 from {length_2} to {length_1} samples to match audio1 length.")
+ waveform_2 = waveform_2[..., :length_1]
+ elif length_2 < length_1:
+ logging.info(f"AudioMerge: Padding audio2 from {length_2} to {length_1} samples to match audio1 length.")
+ pad_shape = list(waveform_2.shape)
+ pad_shape[-1] = length_1 - length_2
+ pad_tensor = torch.zeros(pad_shape, dtype=waveform_2.dtype, device=waveform_2.device)
+ waveform_2 = torch.cat((waveform_2, pad_tensor), dim=-1)
+
+ if merge_method == "add":
+ waveform = waveform_1 + waveform_2
+ elif merge_method == "subtract":
+ waveform = waveform_1 - waveform_2
+ elif merge_method == "multiply":
+ waveform = waveform_1 * waveform_2
+ elif merge_method == "mean":
+ waveform = (waveform_1 + waveform_2) / 2
+
+ max_val = waveform.abs().max()
+ if max_val > 1.0:
+ waveform = waveform / max_val
+
+ return IO.NodeOutput({"waveform": waveform, "sample_rate": output_sample_rate})
+
+ merge = execute # TODO: remove
+
+
+class AudioAdjustVolume(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="AudioAdjustVolume",
+ search_aliases=["audio gain", "loudness", "audio level"],
+ display_name="Audio Adjust Volume",
+ category="audio",
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.Int.Input(
+ "volume",
+ default=1,
+ min=-100,
+ max=100,
+ tooltip="Volume adjustment in decibels (dB). 0 = no change, +6 = double, -6 = half, etc",
+ )
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio, volume) -> IO.NodeOutput:
+ if volume == 0:
+ return IO.NodeOutput(audio)
+ waveform = audio["waveform"]
+ sample_rate = audio["sample_rate"]
+
+ gain = 10 ** (volume / 20)
+ waveform = waveform * gain
+
+ return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
+
+ adjust_volume = execute # TODO: remove
+
+
+class EmptyAudio(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="EmptyAudio",
+ search_aliases=["blank audio"],
+ display_name="Empty Audio",
+ category="audio",
+ inputs=[
+ IO.Float.Input(
+ "duration",
+ default=60.0,
+ min=0.0,
+ max=0xffffffffffffffff,
+ step=0.01,
+ tooltip="Duration of the empty audio clip in seconds",
+ ),
+ IO.Int.Input(
+ "sample_rate",
+ default=44100,
+ tooltip="Sample rate of the empty audio clip.",
+ min=1,
+ max=192000,
+ advanced=True,
+ ),
+ IO.Int.Input(
+ "channels",
+ default=2,
+ min=1,
+ max=2,
+ tooltip="Number of audio channels (1 for mono, 2 for stereo).",
+ advanced=True,
+ ),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, duration, sample_rate, channels) -> IO.NodeOutput:
+ num_samples = int(round(duration * sample_rate))
+ waveform = torch.zeros((1, channels, num_samples), dtype=torch.float32)
+ return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
+
+ create_empty_audio = execute # TODO: remove
+
+
+class AudioEqualizer3Band(IO.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return IO.Schema(
+ node_id="AudioEqualizer3Band",
+ search_aliases=["eq", "bass boost", "treble boost", "equalizer"],
+ display_name="Audio Equalizer (3-Band)",
+ category="audio",
+ is_experimental=True,
+ inputs=[
+ IO.Audio.Input("audio"),
+ IO.Float.Input("low_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Low frequencies (Bass)"),
+ IO.Int.Input("low_freq", default=100, min=20, max=500, tooltip="Cutoff frequency for Low shelf"),
+ IO.Float.Input("mid_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Mid frequencies"),
+ IO.Int.Input("mid_freq", default=1000, min=200, max=4000, tooltip="Center frequency for Mids"),
+ IO.Float.Input("mid_q", default=0.707, min=0.1, max=10.0, step=0.1, tooltip="Q factor (bandwidth) for Mids"),
+ IO.Float.Input("high_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for High frequencies (Treble)"),
+ IO.Int.Input("high_freq", default=5000, min=1000, max=15000, tooltip="Cutoff frequency for High shelf"),
+ ],
+ outputs=[IO.Audio.Output()],
+ )
+
+ @classmethod
+ def execute(cls, audio, low_gain_dB, low_freq, mid_gain_dB, mid_freq, mid_q, high_gain_dB, high_freq) -> IO.NodeOutput:
+ waveform = audio["waveform"]
+ sample_rate = audio["sample_rate"]
+ eq_waveform = waveform.clone()
+
+ # 1. Apply Low Shelf (Bass)
+ if low_gain_dB != 0:
+ eq_waveform = torchaudio.functional.bass_biquad(
+ eq_waveform,
+ sample_rate,
+ gain=low_gain_dB,
+ central_freq=float(low_freq),
+ Q=0.707
+ )
+
+ # 2. Apply Peaking EQ (Mids)
+ if mid_gain_dB != 0:
+ eq_waveform = torchaudio.functional.equalizer_biquad(
+ eq_waveform,
+ sample_rate,
+ center_freq=float(mid_freq),
+ gain=mid_gain_dB,
+ Q=mid_q
+ )
+
+ # 3. Apply High Shelf (Treble)
+ if high_gain_dB != 0:
+ eq_waveform = torchaudio.functional.treble_biquad(
+ eq_waveform,
+ sample_rate,
+ gain=high_gain_dB,
+ central_freq=float(high_freq),
+ Q=0.707
+ )
+
+ return IO.NodeOutput({"waveform": eq_waveform, "sample_rate": sample_rate})
+
+
+class AudioExtension(ComfyExtension):
+ @override
+ async def get_node_list(self) -> list[type[IO.ComfyNode]]:
+ return [
+ EmptyLatentAudio,
+ VAEEncodeAudio,
+ VAEDecodeAudio,
+ VAEDecodeAudioTiled,
+ SaveAudio,
+ SaveAudioMP3,
+ SaveAudioOpus,
+ LoadAudio,
+ PreviewAudio,
+ ConditioningStableAudio,
+ RecordAudio,
+ TrimAudioDuration,
+ SplitAudioChannels,
+ JoinAudioChannels,
+ AudioConcat,
+ AudioMerge,
+ AudioAdjustVolume,
+ EmptyAudio,
+ AudioEqualizer3Band,
+ ]
+
+async def comfy_entrypoint() -> AudioExtension:
+ return AudioExtension()
diff --git a/docs/hel-892/tts-reference/core__comfy_extras__nodes_preview_any.py b/docs/hel-892/tts-reference/core__comfy_extras__nodes_preview_any.py
new file mode 100644
index 00000000..b0a6f279
--- /dev/null
+++ b/docs/hel-892/tts-reference/core__comfy_extras__nodes_preview_any.py
@@ -0,0 +1,44 @@
+import json
+from comfy.comfy_types.node_typing import IO
+
+# Preview Any - original implement from
+# https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py
+# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
+class PreviewAny():
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {"source": (IO.ANY, {})},
+ }
+
+ RETURN_TYPES = ()
+ FUNCTION = "main"
+ OUTPUT_NODE = True
+
+ CATEGORY = "utils"
+ SEARCH_ALIASES = ["show output", "inspect", "debug", "print value", "show text"]
+
+ def main(self, source=None):
+ value = 'None'
+ if isinstance(source, str):
+ value = source
+ elif isinstance(source, (int, float, bool)):
+ value = str(source)
+ elif source is not None:
+ try:
+ value = json.dumps(source, indent=4)
+ except Exception:
+ try:
+ value = str(source)
+ except Exception:
+ value = 'source exists, but could not be serialized.'
+
+ return {"ui": {"text": (value,)}}
+
+NODE_CLASS_MAPPINGS = {
+ "PreviewAny": PreviewAny,
+}
+
+NODE_DISPLAY_NAME_MAPPINGS = {
+ "PreviewAny": "Preview as Text",
+}
diff --git a/docs/hel-892/tts-reference/core__folder_paths.py b/docs/hel-892/tts-reference/core__folder_paths.py
new file mode 100644
index 00000000..9c96540e
--- /dev/null
+++ b/docs/hel-892/tts-reference/core__folder_paths.py
@@ -0,0 +1,496 @@
+from __future__ import annotations
+
+import os
+import time
+import mimetypes
+import logging
+from typing import Literal, List
+from collections.abc import Collection
+
+from comfy.cli_args import args
+
+supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'}
+
+folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {}
+
+# --base-directory - Resets all default paths configured in folder_paths with a new base path
+if args.base_directory:
+ base_path = os.path.abspath(args.base_directory)
+else:
+ base_path = os.path.dirname(os.path.realpath(__file__))
+
+models_dir = os.path.join(base_path, "models")
+folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions)
+folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"])
+
+folder_names_and_paths["loras"] = ([os.path.join(models_dir, "loras")], supported_pt_extensions)
+folder_names_and_paths["vae"] = ([os.path.join(models_dir, "vae")], supported_pt_extensions)
+folder_names_and_paths["text_encoders"] = ([os.path.join(models_dir, "text_encoders"), os.path.join(models_dir, "clip")], supported_pt_extensions)
+folder_names_and_paths["diffusion_models"] = ([os.path.join(models_dir, "unet"), os.path.join(models_dir, "diffusion_models")], supported_pt_extensions)
+folder_names_and_paths["clip_vision"] = ([os.path.join(models_dir, "clip_vision")], supported_pt_extensions)
+folder_names_and_paths["style_models"] = ([os.path.join(models_dir, "style_models")], supported_pt_extensions)
+folder_names_and_paths["embeddings"] = ([os.path.join(models_dir, "embeddings")], supported_pt_extensions)
+folder_names_and_paths["diffusers"] = ([os.path.join(models_dir, "diffusers")], ["folder"])
+folder_names_and_paths["vae_approx"] = ([os.path.join(models_dir, "vae_approx")], supported_pt_extensions)
+
+folder_names_and_paths["controlnet"] = ([os.path.join(models_dir, "controlnet"), os.path.join(models_dir, "t2i_adapter")], supported_pt_extensions)
+folder_names_and_paths["gligen"] = ([os.path.join(models_dir, "gligen")], supported_pt_extensions)
+
+folder_names_and_paths["upscale_models"] = ([os.path.join(models_dir, "upscale_models")], supported_pt_extensions)
+
+folder_names_and_paths["latent_upscale_models"] = ([os.path.join(models_dir, "latent_upscale_models")], supported_pt_extensions)
+
+folder_names_and_paths["custom_nodes"] = ([os.path.join(base_path, "custom_nodes")], set())
+
+folder_names_and_paths["hypernetworks"] = ([os.path.join(models_dir, "hypernetworks")], supported_pt_extensions)
+
+folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")], supported_pt_extensions)
+
+folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""})
+
+folder_names_and_paths["model_patches"] = ([os.path.join(models_dir, "model_patches")], supported_pt_extensions)
+
+folder_names_and_paths["audio_encoders"] = ([os.path.join(models_dir, "audio_encoders")], supported_pt_extensions)
+
+output_directory = os.path.join(base_path, "output")
+temp_directory = os.path.join(base_path, "temp")
+input_directory = os.path.join(base_path, "input")
+user_directory = os.path.join(base_path, "user")
+
+filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
+
+class CacheHelper:
+ """
+ Helper class for managing file list cache data.
+ """
+ def __init__(self):
+ self.cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
+ self.active = False
+
+ def get(self, key: str, default=None) -> tuple[list[str], dict[str, float], float]:
+ if not self.active:
+ return default
+ return self.cache.get(key, default)
+
+ def set(self, key: str, value: tuple[list[str], dict[str, float], float]) -> None:
+ if self.active:
+ self.cache[key] = value
+
+ def clear(self):
+ self.cache.clear()
+
+ def __enter__(self):
+ self.active = True
+ return self
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.active = False
+ self.clear()
+
+cache_helper = CacheHelper()
+
+extension_mimetypes_cache = {
+ "webp" : "image",
+ "fbx" : "model",
+}
+
+def map_legacy(folder_name: str) -> str:
+ legacy = {"unet": "diffusion_models",
+ "clip": "text_encoders"}
+ return legacy.get(folder_name, folder_name)
+
+if not os.path.exists(input_directory):
+ try:
+ os.makedirs(input_directory)
+ except:
+ logging.error("Failed to create input directory")
+
+def set_output_directory(output_dir: str) -> None:
+ global output_directory
+ output_directory = output_dir
+
+def set_temp_directory(temp_dir: str) -> None:
+ global temp_directory
+ temp_directory = temp_dir
+
+def set_input_directory(input_dir: str) -> None:
+ global input_directory
+ input_directory = input_dir
+
+def get_output_directory() -> str:
+ global output_directory
+ return output_directory
+
+def get_temp_directory() -> str:
+ global temp_directory
+ return temp_directory
+
+def get_input_directory() -> str:
+ global input_directory
+ return input_directory
+
+def get_user_directory() -> str:
+ return user_directory
+
+def set_user_directory(user_dir: str) -> None:
+ global user_directory
+ user_directory = user_dir
+
+
+# System User Protection - Protects system directories from HTTP endpoint access
+# System Users are internal-only users that cannot be accessed via HTTP endpoints.
+# They use the '__' prefix convention (similar to Python's private member convention).
+SYSTEM_USER_PREFIX = "__"
+
+
+def get_system_user_directory(name: str = "system") -> str:
+ """
+ Get the path to a System User directory.
+
+ System User directories (prefixed with '__') are only accessible via internal API,
+ not through HTTP endpoints. Use this for storing system-internal data that
+ should not be exposed to users.
+
+ Args:
+ name: System user name (e.g., "system", "cache"). Must be alphanumeric
+ with underscores allowed, but cannot start with underscore.
+
+ Returns:
+ Absolute path to the system user directory.
+
+ Raises:
+ ValueError: If name is empty, invalid, or starts with underscore.
+
+ Example:
+ >>> get_system_user_directory("cache")
+ '/path/to/user/__cache'
+ """
+ if not name or not isinstance(name, str):
+ raise ValueError("System user name cannot be empty")
+ if not name.replace("_", "").isalnum():
+ raise ValueError(f"Invalid system user name: '{name}'")
+ if name.startswith("_"):
+ raise ValueError("System user name should not start with underscore")
+ return os.path.join(get_user_directory(), f"{SYSTEM_USER_PREFIX}{name}")
+
+
+def get_public_user_directory(user_id: str) -> str | None:
+ """
+ Get the path to a Public User directory for HTTP endpoint access.
+
+ This function provides structural security by returning None for any
+ System User (prefixed with '__'). All HTTP endpoints should use this
+ function instead of directly constructing user paths.
+
+ Args:
+ user_id: User identifier from HTTP request.
+
+ Returns:
+ Absolute path to the user directory, or None if user_id is invalid
+ or refers to a System User.
+
+ Example:
+ >>> get_public_user_directory("default")
+ '/path/to/user/default'
+ >>> get_public_user_directory("__system")
+ None
+ """
+ if not user_id or not isinstance(user_id, str):
+ return None
+ if user_id.startswith(SYSTEM_USER_PREFIX):
+ return None
+ return os.path.join(get_user_directory(), user_id)
+
+
+#NOTE: used in http server so don't put folders that should not be accessed remotely
+def get_directory_by_type(type_name: str) -> str | None:
+ if type_name == "output":
+ return get_output_directory()
+ if type_name == "temp":
+ return get_temp_directory()
+ if type_name == "input":
+ return get_input_directory()
+ return None
+
+def filter_files_content_types(files: list[str], content_types: List[Literal["image", "video", "audio", "model"]]) -> list[str]:
+ """
+ Example:
+ files = os.listdir(folder_paths.get_input_directory())
+ videos = filter_files_content_types(files, ["video"])
+
+ Note:
+ - 'model' in MIME context refers to 3D models, not files containing trained weights and parameters
+ """
+ global extension_mimetypes_cache
+ result = []
+ for file in files:
+ extension = file.split('.')[-1]
+ if extension not in extension_mimetypes_cache:
+ mime_type, _ = mimetypes.guess_type(file, strict=False)
+ if not mime_type:
+ continue
+ content_type = mime_type.split('/')[0]
+ extension_mimetypes_cache[extension] = content_type
+ else:
+ content_type = extension_mimetypes_cache[extension]
+
+ if content_type in content_types:
+ result.append(file)
+ return result
+
+# determine base_dir rely on annotation if name is 'filename.ext [annotation]' format
+# otherwise use default_path as base_dir
+def annotated_filepath(name: str) -> tuple[str, str | None]:
+ if name.endswith("[output]"):
+ base_dir = get_output_directory()
+ name = name[:-9]
+ elif name.endswith("[input]"):
+ base_dir = get_input_directory()
+ name = name[:-8]
+ elif name.endswith("[temp]"):
+ base_dir = get_temp_directory()
+ name = name[:-7]
+ else:
+ return name, None
+
+ return name, base_dir
+
+
+def get_annotated_filepath(name: str, default_dir: str | None=None) -> str:
+ name, base_dir = annotated_filepath(name)
+
+ if base_dir is None:
+ if default_dir is not None:
+ base_dir = default_dir
+ else:
+ base_dir = get_input_directory() # fallback path
+
+ return os.path.join(base_dir, name)
+
+
+def exists_annotated_filepath(name) -> bool:
+ name, base_dir = annotated_filepath(name)
+
+ if base_dir is None:
+ base_dir = get_input_directory() # fallback path
+
+ filepath = os.path.join(base_dir, name)
+ return os.path.exists(filepath)
+
+
+def add_model_folder_path(folder_name: str, full_folder_path: str, is_default: bool = False) -> None:
+ global folder_names_and_paths
+ folder_name = map_legacy(folder_name)
+ if folder_name in folder_names_and_paths:
+ paths, _exts = folder_names_and_paths[folder_name]
+ if full_folder_path in paths:
+ if is_default and paths[0] != full_folder_path:
+ # If the path to the folder is not the first in the list, move it to the beginning.
+ paths.remove(full_folder_path)
+ paths.insert(0, full_folder_path)
+ else:
+ if is_default:
+ paths.insert(0, full_folder_path)
+ else:
+ paths.append(full_folder_path)
+ else:
+ folder_names_and_paths[folder_name] = ([full_folder_path], set())
+
+def get_folder_paths(folder_name: str) -> list[str]:
+ folder_name = map_legacy(folder_name)
+ return folder_names_and_paths[folder_name][0][:]
+
+def recursive_search(directory: str, excluded_dir_names: list[str] | None=None) -> tuple[list[str], dict[str, float]]:
+ if not os.path.isdir(directory):
+ return [], {}
+
+ if excluded_dir_names is None:
+ excluded_dir_names = []
+
+ result = []
+ dirs = {}
+
+ # Attempt to add the initial directory to dirs with error handling
+ try:
+ dirs[directory] = os.path.getmtime(directory)
+ except FileNotFoundError:
+ logging.warning(f"Warning: Unable to access {directory}. Skipping this path.")
+
+ logging.debug("recursive file list on directory {}".format(directory))
+ dirpath: str
+ subdirs: list[str]
+ filenames: list[str]
+
+ for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
+ subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
+ for file_name in filenames:
+ try:
+ relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
+ result.append(relative_path)
+ except:
+ logging.warning(f"Warning: Unable to access {file_name}. Skipping this file.")
+ continue
+
+ for d in subdirs:
+ path: str = os.path.join(dirpath, d)
+ try:
+ dirs[path] = os.path.getmtime(path)
+ except FileNotFoundError:
+ logging.warning(f"Warning: Unable to access {path}. Skipping this path.")
+ continue
+ logging.debug("found {} files".format(len(result)))
+ return result, dirs
+
+def filter_files_extensions(files: Collection[str], extensions: Collection[str]) -> list[str]:
+ return sorted(list(filter(lambda a: os.path.splitext(a)[-1].lower() in extensions or len(extensions) == 0, files)))
+
+
+
+def get_full_path(folder_name: str, filename: str) -> str | None:
+ """
+ Get the full path of a file in a folder, has to be a file
+ """
+ global folder_names_and_paths
+ folder_name = map_legacy(folder_name)
+ if folder_name not in folder_names_and_paths:
+ return None
+ folders = folder_names_and_paths[folder_name]
+ filename = os.path.relpath(os.path.join("/", filename), "/")
+ for x in folders[0]:
+ full_path = os.path.join(x, filename)
+ if os.path.isfile(full_path):
+ return full_path
+ elif os.path.islink(full_path):
+ logging.warning("WARNING path {} exists but doesn't link anywhere, skipping.".format(full_path))
+
+ return None
+
+
+def get_full_path_or_raise(folder_name: str, filename: str) -> str:
+ """
+ Get the full path of a file in a folder, has to be a file
+ """
+ full_path = get_full_path(folder_name, filename)
+ if full_path is None:
+ raise FileNotFoundError(f"Model in folder '{folder_name}' with filename '{filename}' not found.")
+ return full_path
+
+
+def get_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float]:
+ folder_name = map_legacy(folder_name)
+ global folder_names_and_paths
+ output_list = set()
+ folders = folder_names_and_paths[folder_name]
+ output_folders = {}
+ for x in folders[0]:
+ files, folders_all = recursive_search(x, excluded_dir_names=[".git"])
+ output_list.update(filter_files_extensions(files, folders[1]))
+ output_folders = {**output_folders, **folders_all}
+
+ return sorted(list(output_list)), output_folders, time.perf_counter()
+
+def cached_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float] | None:
+ strong_cache = cache_helper.get(folder_name)
+ if strong_cache is not None:
+ return strong_cache
+
+ global filename_list_cache
+ global folder_names_and_paths
+ folder_name = map_legacy(folder_name)
+ if folder_name not in filename_list_cache:
+ return None
+ out = filename_list_cache[folder_name]
+
+ for x in out[1]:
+ time_modified = out[1][x]
+ folder = x
+ if os.path.getmtime(folder) != time_modified:
+ return None
+
+ folders = folder_names_and_paths[folder_name]
+ for x in folders[0]:
+ if os.path.isdir(x):
+ if x not in out[1]:
+ return None
+
+ return out
+
+def get_filename_list(folder_name: str) -> list[str]:
+ folder_name = map_legacy(folder_name)
+ out = cached_filename_list_(folder_name)
+ if out is None:
+ out = get_filename_list_(folder_name)
+ global filename_list_cache
+ filename_list_cache[folder_name] = out
+ cache_helper.set(folder_name, out)
+ return list(out[0])
+
+def get_save_image_path(filename_prefix: str, output_dir: str, image_width=0, image_height=0) -> tuple[str, str, int, str, str]:
+ def map_filename(filename: str) -> tuple[int, str]:
+ prefix_len = len(os.path.basename(filename_prefix))
+ prefix = filename[:prefix_len + 1]
+ try:
+ digits = int(filename[prefix_len + 1:].split('_')[0])
+ except:
+ digits = 0
+ return digits, prefix
+
+ def compute_vars(input: str, image_width: int, image_height: int) -> str:
+ input = input.replace("%width%", str(image_width))
+ input = input.replace("%height%", str(image_height))
+ now = time.localtime()
+ input = input.replace("%year%", str(now.tm_year))
+ input = input.replace("%month%", str(now.tm_mon).zfill(2))
+ input = input.replace("%day%", str(now.tm_mday).zfill(2))
+ input = input.replace("%hour%", str(now.tm_hour).zfill(2))
+ input = input.replace("%minute%", str(now.tm_min).zfill(2))
+ input = input.replace("%second%", str(now.tm_sec).zfill(2))
+ return input
+
+ if "%" in filename_prefix:
+ filename_prefix = compute_vars(filename_prefix, image_width, image_height)
+
+ subfolder = os.path.dirname(os.path.normpath(filename_prefix))
+ filename = os.path.basename(os.path.normpath(filename_prefix))
+
+ full_output_folder = os.path.join(output_dir, subfolder)
+
+ if os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) != output_dir:
+ err = "**** ERROR: Saving image outside the output folder is not allowed." + \
+ "\n full_output_folder: " + os.path.abspath(full_output_folder) + \
+ "\n output_dir: " + output_dir + \
+ "\n commonpath: " + os.path.commonpath((output_dir, os.path.abspath(full_output_folder)))
+ logging.error(err)
+ raise Exception(err)
+
+ try:
+ counter = max(filter(lambda a: os.path.normcase(a[1][:-1]) == os.path.normcase(filename) and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
+ except ValueError:
+ counter = 1
+ except FileNotFoundError:
+ os.makedirs(full_output_folder, exist_ok=True)
+ counter = 1
+ return full_output_folder, filename, counter, subfolder, filename_prefix
+
+def get_input_subfolders() -> list[str]:
+ """Returns a list of all subfolder paths in the input directory, recursively.
+
+ Returns:
+ List of folder paths relative to the input directory, excluding the root directory
+ """
+ input_dir = get_input_directory()
+ folders = []
+
+ try:
+ if not os.path.exists(input_dir):
+ return []
+
+ for root, dirs, _ in os.walk(input_dir):
+ rel_path = os.path.relpath(root, input_dir)
+ if rel_path != ".": # Only include non-root directories
+ # Normalize path separators to forward slashes
+ folders.append(rel_path.replace(os.sep, '/'))
+
+ return sorted(folders)
+ except FileNotFoundError:
+ return []
diff --git a/docs/hel-892/tts-reference/cr-commit.json b/docs/hel-892/tts-reference/cr-commit.json
new file mode 100644
index 00000000..4a29a88d
--- /dev/null
+++ b/docs/hel-892/tts-reference/cr-commit.json
@@ -0,0 +1 @@
+{"sha":"d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","node_id":"C_kwDOJtwj39oAKGQ3OGI3ODBhZTQzZmNmOGM2YjdjNjUwNWU2ZmZiNDU4NDI4MWNlY2E","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/commits/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","html_url":"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/commit/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","author":{"name":"Suzie1","email":"7.lyssa@gmail.com","date":"2024-01-24T22:44:09Z"},"committer":{"name":"Suzie1","email":"7.lyssa@gmail.com","date":"2024-01-24T22:44:09Z"},"tree":{"sha":"12c141b4c99138cd6beb2d5197574b9fe264bc74","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/12c141b4c99138cd6beb2d5197574b9fe264bc74"},"message":"version 1.76","parents":[{"sha":"efcdf631d1be8a6cdf7246698ea13eefb7dff7ea","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/commits/efcdf631d1be8a6cdf7246698ea13eefb7dff7ea","html_url":"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/commit/efcdf631d1be8a6cdf7246698ea13eefb7dff7ea"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
\ No newline at end of file
diff --git a/docs/hel-892/tts-reference/cr-tree.json b/docs/hel-892/tts-reference/cr-tree.json
new file mode 100644
index 00000000..40a3778b
--- /dev/null
+++ b/docs/hel-892/tts-reference/cr-tree.json
@@ -0,0 +1 @@
+{"sha":"d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/d78b780ae43fcf8c6b7c6505e6ffb4584281ceca","tree":[{"path":"Patch_Notes.md","mode":"100644","type":"blob","sha":"b5f3012c31e6c6a6d54f6655db2d8a7570690e12","size":6173,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b5f3012c31e6c6a6d54f6655db2d8a7570690e12"},{"path":"README.md","mode":"100644","type":"blob","sha":"38ef95ca4ea4cd87c2289f078aec1a98093e328c","size":8745,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/38ef95ca4ea4cd87c2289f078aec1a98093e328c"},{"path":"__init__.py","mode":"100644","type":"blob","sha":"e5af18356e8765423954ea7c7d22b4f32fcdd9c0","size":1781,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/e5af18356e8765423954ea7c7d22b4f32fcdd9c0"},{"path":"categories.py","mode":"100644","type":"blob","sha":"db903be91ab290045d221884d90559c420c74bb4","size":3484,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/db903be91ab290045d221884d90559c420c74bb4"},{"path":"config.py","mode":"100644","type":"blob","sha":"bd6eebacecfa67ebf7ebbf955e3d2f7c3a58a9de","size":2576,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/bd6eebacecfa67ebf7ebbf955e3d2f7c3a58a9de"},{"path":"fonts","mode":"040000","type":"tree","sha":"489f6dbac8ac2fd77bd8bea4af8034fcf206b650","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/489f6dbac8ac2fd77bd8bea4af8034fcf206b650"},{"path":"fonts/AlumniSansCollegiateOne-Regular.ttf","mode":"100644","type":"blob","sha":"047451fa81fd6faaa8365ef45ddab3459b7ad655","size":156292,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/047451fa81fd6faaa8365ef45ddab3459b7ad655"},{"path":"fonts/Caveat-VariableFont_wght.ttf","mode":"100644","type":"blob","sha":"0ae4d99195f586f5e73365d85beb68cfcfa050a4","size":393092,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/0ae4d99195f586f5e73365d85beb68cfcfa050a4"},{"path":"fonts/NotoSansArabic-Regular.ttf","mode":"100644","type":"blob","sha":"79359c460b13e94945a8700227dabdc790091c0e","size":177004,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/79359c460b13e94945a8700227dabdc790091c0e"},{"path":"fonts/Oswald-Bold.ttf","mode":"100644","type":"blob","sha":"b9c6e3767357f4bf5016a21dc0b6015d08be3c99","size":87604,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b9c6e3767357f4bf5016a21dc0b6015d08be3c99"},{"path":"fonts/PixelifySans-Bold.ttf","mode":"100644","type":"blob","sha":"4d8aeb670dc228fe48a6e90366bae9f0d6930f4c","size":50876,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4d8aeb670dc228fe48a6e90366bae9f0d6930f4c"},{"path":"fonts/Quicksand-Bold.ttf","mode":"100644","type":"blob","sha":"07d5127c04b17a9a62121d12aeb00b701e920500","size":78596,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/07d5127c04b17a9a62121d12aeb00b701e920500"},{"path":"fonts/Roboto-Regular.ttf","mode":"100644","type":"blob","sha":"3033308a695ab4efa60441c23f2c18aaa94c568f","size":129584,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/3033308a695ab4efa60441c23f2c18aaa94c568f"},{"path":"fonts/YoungSerif-Regular.ttf","mode":"100644","type":"blob","sha":"f454fbedd4c8b00833d17fffa1f89acb5149b02c","size":105136,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/f454fbedd4c8b00833d17fffa1f89acb5149b02c"},{"path":"fonts/comic.ttf","mode":"100644","type":"blob","sha":"2d8e9ca9ce1216331f7d665090eb5678bacdd614","size":245600,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2d8e9ca9ce1216331f7d665090eb5678bacdd614"},{"path":"fonts/impact.ttf","mode":"100644","type":"blob","sha":"2675688cd0e23bec6295d5d218b8be276705468c","size":206784,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2675688cd0e23bec6295d5d218b8be276705468c"},{"path":"node_mappings.py","mode":"100644","type":"blob","sha":"a4a1bc4ff001961a64e24bcfa59de528fbc8a6ea","size":24479,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/a4a1bc4ff001961a64e24bcfa59de528fbc8a6ea"},{"path":"nodes","mode":"040000","type":"tree","sha":"77faaf7ce140b0a762dcabd2dfc7e3c5f5a7240c","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/77faaf7ce140b0a762dcabd2dfc7e3c5f5a7240c"},{"path":"nodes/functions.py","mode":"100644","type":"blob","sha":"68e9d2af7f029b6acbd75f051ce0a43dae98b420","size":666,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/68e9d2af7f029b6acbd75f051ce0a43dae98b420"},{"path":"nodes/functions_animation.py","mode":"100644","type":"blob","sha":"890fb851fc0dcbd29e043c273dd518ade8164905","size":4173,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/890fb851fc0dcbd29e043c273dd518ade8164905"},{"path":"nodes/functions_graphics.py","mode":"100644","type":"blob","sha":"afb0c13cc8b759ef4bd33ed0f65e5253097dfe20","size":18153,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/afb0c13cc8b759ef4bd33ed0f65e5253097dfe20"},{"path":"nodes/functions_json.py","mode":"100644","type":"blob","sha":"b607c90f7836876b5a0a0e31a22f7c6953cf2453","size":2684,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b607c90f7836876b5a0a0e31a22f7c6953cf2453"},{"path":"nodes/functions_upscale.py","mode":"100644","type":"blob","sha":"2c25f0354fa53f4863aefd396963c917b320901f","size":3891,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2c25f0354fa53f4863aefd396963c917b320901f"},{"path":"nodes/functions_xygrid.py","mode":"100644","type":"blob","sha":"100514ef43ded252d47cefb7c3f042152e199a06","size":6143,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/100514ef43ded252d47cefb7c3f042152e199a06"},{"path":"nodes/nodes_animation_cyclers.py","mode":"100644","type":"blob","sha":"58a584830a74d9acad0fe5b094ca401225e098a6","size":16706,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/58a584830a74d9acad0fe5b094ca401225e098a6"},{"path":"nodes/nodes_animation_interpolation.py","mode":"100644","type":"blob","sha":"f328e4c014a18868ee3fa70ac00ab9dd4105036d","size":10095,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/f328e4c014a18868ee3fa70ac00ab9dd4105036d"},{"path":"nodes/nodes_animation_io.py","mode":"100644","type":"blob","sha":"8dfba06cf16ec4500ba3ac90aafa39a0cbbf2101","size":12175,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/8dfba06cf16ec4500ba3ac90aafa39a0cbbf2101"},{"path":"nodes/nodes_animation_lists.py","mode":"100644","type":"blob","sha":"45b1c02e3558a213fdc505f0cf99bed9aee0f27c","size":17217,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/45b1c02e3558a213fdc505f0cf99bed9aee0f27c"},{"path":"nodes/nodes_animation_prompt.py","mode":"100644","type":"blob","sha":"974017f3ecb68ec437655a04cb29530af42b0366","size":18282,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/974017f3ecb68ec437655a04cb29530af42b0366"},{"path":"nodes/nodes_animation_schedulers.py","mode":"100644","type":"blob","sha":"b3bd459fc472397dab5b9bb2f00f9f7c92ce7609","size":25041,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b3bd459fc472397dab5b9bb2f00f9f7c92ce7609"},{"path":"nodes/nodes_animation_schedules.py","mode":"100644","type":"blob","sha":"2fab92eabf18a2091b52437587c9de7667883d97","size":14436,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2fab92eabf18a2091b52437587c9de7667883d97"},{"path":"nodes/nodes_animation_utils.py","mode":"100644","type":"blob","sha":"694066b43a09f8c6c0f0c10aeddcd304cbbcc91a","size":2247,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/694066b43a09f8c6c0f0c10aeddcd304cbbcc91a"},{"path":"nodes/nodes_aspect_ratio.py","mode":"100644","type":"blob","sha":"f276f3103df1eddc789ea4001596b853932fd8c2","size":22975,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/f276f3103df1eddc789ea4001596b853932fd8c2"},{"path":"nodes/nodes_controlnet.py","mode":"100644","type":"blob","sha":"00a262dded05e01825625a0d2fed27605149e3bc","size":9054,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/00a262dded05e01825625a0d2fed27605149e3bc"},{"path":"nodes/nodes_core.py","mode":"100644","type":"blob","sha":"02af795eace2b04226fcecd2df0c85db544caa37","size":17213,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/02af795eace2b04226fcecd2df0c85db544caa37"},{"path":"nodes/nodes_graphics_filter.py","mode":"100644","type":"blob","sha":"bcc929e9cbed5980f336bcb503d0cda72c0bbe43","size":19563,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/bcc929e9cbed5980f336bcb503d0cda72c0bbe43"},{"path":"nodes/nodes_graphics_layout.py","mode":"100644","type":"blob","sha":"82fa36bf39dcb885dc058c7fee418251870ec5fe","size":34324,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/82fa36bf39dcb885dc058c7fee418251870ec5fe"},{"path":"nodes/nodes_graphics_matplot.py","mode":"100644","type":"blob","sha":"8464b063c7ddd12db0b4ddb1a04daf943c957947","size":35782,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/8464b063c7ddd12db0b4ddb1a04daf943c957947"},{"path":"nodes/nodes_graphics_pattern.py","mode":"100644","type":"blob","sha":"dc8cd728cb44a4e3327fec891742aeb9aebda52a","size":21181,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/dc8cd728cb44a4e3327fec891742aeb9aebda52a"},{"path":"nodes/nodes_graphics_template.py","mode":"100644","type":"blob","sha":"676d535cf9488848392b33ae8fb86362ba960b35","size":29588,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/676d535cf9488848392b33ae8fb86362ba960b35"},{"path":"nodes/nodes_graphics_text.py","mode":"100644","type":"blob","sha":"0ce1f5a742132c50c00be37829de45151fb31582","size":23279,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/0ce1f5a742132c50c00be37829de45151fb31582"},{"path":"nodes/nodes_legacy.py","mode":"100644","type":"blob","sha":"4f4b98d81549b3576dbbb249326dbcb7990c9815","size":8132,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4f4b98d81549b3576dbbb249326dbcb7990c9815"},{"path":"nodes/nodes_list.py","mode":"100644","type":"blob","sha":"7eb02ad9cca34aaeeda120f505c9e99f83b3d02e","size":34806,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/7eb02ad9cca34aaeeda120f505c9e99f83b3d02e"},{"path":"nodes/nodes_lora.py","mode":"100644","type":"blob","sha":"9bb233ed6858e5f3c04f166c44d122c0f19974dc","size":19861,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/9bb233ed6858e5f3c04f166c44d122c0f19974dc"},{"path":"nodes/nodes_model_merge.py","mode":"100644","type":"blob","sha":"1293dd52a235c7d666e85edda27aa6f173f1032a","size":9113,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/1293dd52a235c7d666e85edda27aa6f173f1032a"},{"path":"nodes/nodes_pipe.py","mode":"100644","type":"blob","sha":"a22a00f7b96bf5653382d2bb8633b7de68a6adbc","size":15585,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/a22a00f7b96bf5653382d2bb8633b7de68a6adbc"},{"path":"nodes/nodes_sdxl.py","mode":"100644","type":"blob","sha":"4bd4bea38651216c2bd8c6ab28f142c850f3dbe3","size":10082,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4bd4bea38651216c2bd8c6ab28f142c850f3dbe3"},{"path":"nodes/nodes_upscale.py","mode":"100644","type":"blob","sha":"a94ee4813bc96b7d399d975a6afca6096c25575e","size":8770,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/a94ee4813bc96b7d399d975a6afca6096c25575e"},{"path":"nodes/nodes_utils_conversion.py","mode":"100644","type":"blob","sha":"27a8ea7e58e84e24466a0cccc1d234c4deff2b73","size":7167,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/27a8ea7e58e84e24466a0cccc1d234c4deff2b73"},{"path":"nodes/nodes_utils_index.py","mode":"100644","type":"blob","sha":"c89392a1f5b1b7212dea121211a58ef1b7cdf4e6","size":5248,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/c89392a1f5b1b7212dea121211a58ef1b7cdf4e6"},{"path":"nodes/nodes_utils_logic.py","mode":"100644","type":"blob","sha":"a82a05fa85ceebda81d16e301fea27316afab455","size":16583,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/a82a05fa85ceebda81d16e301fea27316afab455"},{"path":"nodes/nodes_utils_other.py","mode":"100644","type":"blob","sha":"be415bebc13303b2f491744d42878326d1f21e23","size":15096,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/be415bebc13303b2f491744d42878326d1f21e23"},{"path":"nodes/nodes_utils_random.py","mode":"100644","type":"blob","sha":"4661c91bca72c3c3a4fdbb935cacc84b51a22014","size":10584,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4661c91bca72c3c3a4fdbb935cacc84b51a22014"},{"path":"nodes/nodes_utils_text.py","mode":"100644","type":"blob","sha":"0d8995f482b4316f1cc2a529366c6bec297b301b","size":14919,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/0d8995f482b4316f1cc2a529366c6bec297b301b"},{"path":"nodes/nodes_xygrid.py","mode":"100644","type":"blob","sha":"7012f10998d1bbc3b74d75f02706c6396581c9d6","size":16414,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/7012f10998d1bbc3b74d75f02706c6396581c9d6"},{"path":"nodes/shapes.py","mode":"100644","type":"blob","sha":"ee622446a47c9da1f1311393c57125b5e2ba9ebb","size":5228,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/ee622446a47c9da1f1311393c57125b5e2ba9ebb"},{"path":"workflows","mode":"040000","type":"tree","sha":"434a350932473cc25c537a5a7b6fee860c18e81e","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/434a350932473cc25c537a5a7b6fee860c18e81e"},{"path":"workflows/Animation","mode":"040000","type":"tree","sha":"2d395f5ba4136ee13ea09f9f4d5809f27614df82","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/2d395f5ba4136ee13ea09f9f4d5809f27614df82"},{"path":"workflows/Animation/Iterative Demos","mode":"040000","type":"tree","sha":"3cba4cbdb07432aea84c25428e1ce71348aa1bbf","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/3cba4cbdb07432aea84c25428e1ce71348aa1bbf"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_A3_SimplePromptScheduling_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"0f0e8642224cf6d4396cadc200a1495bcf1da662","size":26600,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/0f0e8642224cf6d4396cadc200a1495bcf1da662"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_A4_PromptScheduling_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"7a114ab8d2470b4c7438f157c3109549ca717289","size":26900,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/7a114ab8d2470b4c7438f157c3109549ca717289"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_A5_CentralPromptScheduling_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"453e3e843a3c0e35980d85a213d7a712a7bb499e","size":28255,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/453e3e843a3c0e35980d85a213d7a712a7bb499e"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_B1_CentralSchedule_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"2b69311422dfbb1de01743d85fb7b10fd3fbdb31","size":15487,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2b69311422dfbb1de01743d85fb7b10fd3fbdb31"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_B2_LoadScheduleFromFile_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"f10768be74e69c65ae1edc0911866cb1c56b96f3","size":12550,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/f10768be74e69c65ae1edc0911866cb1c56b96f3"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_B3_OutputScheduleToFile_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"2987eda2bef941cdede696e2cc4bdf7875540cbb","size":3375,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2987eda2bef941cdede696e2cc4bdf7875540cbb"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_B4_CombineSchedules_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"371a29308f8e69022bfbfe1012d9ac3e3450c643","size":20097,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/371a29308f8e69022bfbfe1012d9ac3e3450c643"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_C1_SimpleValueScheduler_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"5c722e888873aee17dcc4b3309459297cb5d28b9","size":21727,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5c722e888873aee17dcc4b3309459297cb5d28b9"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_C3_SimpleTextScheduler_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"1ba4bee895b265e38dd6facf057d4645840ba547","size":14166,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/1ba4bee895b265e38dd6facf057d4645840ba547"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_E2_IncrementNodes_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"3e45389b1aca5242882117b07fdaefdadbd449a8","size":19682,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/3e45389b1aca5242882117b07fdaefdadbd449a8"},{"path":"workflows/Animation/Iterative Demos/CR_Animation_F1_IONodes_IterativeDemo_v01.json","mode":"100644","type":"blob","sha":"b246a0221231706f9968aeae8825f9756053252e","size":7924,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b246a0221231706f9968aeae8825f9756053252e"},{"path":"workflows/Animation/Iterative Demos/Legacy","mode":"040000","type":"tree","sha":"a29dd5bd81d5b18134f646c8fec54c1a2386f755","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/a29dd5bd81d5b18134f646c8fec54c1a2386f755"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_A1_PromptKeyframeScheduling_IterativeDemo_v01.json","mode":"100644","type":"blob","sha":"304bf5c0035d19c2c303390cbff3c5081fa38e8a","size":30448,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/304bf5c0035d19c2c303390cbff3c5081fa38e8a"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_A2_PromptKeyframeNodes_IterativeDemo_v02b.json","mode":"100644","type":"blob","sha":"2e8996247076f5987ed79e0cda8a248c2701e7cc","size":30747,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2e8996247076f5987ed79e0cda8a248c2701e7cc"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_C2_ValueScheduler_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"2ccfa8a732d5d3bb83cd41d13463562fec9a11c7","size":23473,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2ccfa8a732d5d3bb83cd41d13463562fec9a11c7"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_C4_TextScheduler_IterativeDemo_v01c.json","mode":"100644","type":"blob","sha":"ce8c326304ac075cedf8ecd40ba9f4190971f281","size":158566,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/ce8c326304ac075cedf8ecd40ba9f4190971f281"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_C5_SimpleLoadScheduledModels_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"07c5dbc518176b05a310c5b2b8daa854fe9cdfb8","size":11103,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/07c5dbc518176b05a310c5b2b8daa854fe9cdfb8"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_C6_LoadScheduledModelsLoRAs_IterativeDemo_v0.1a.json","mode":"100644","type":"blob","sha":"5020c834903f36e82fc68e7b8542a90d09283471","size":14762,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5020c834903f36e82fc68e7b8542a90d09283471"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_D1_CyclerNodes_IterativeDemo_v01b.json","mode":"100644","type":"blob","sha":"17ff2d7aca664328200b991d130427be96f80654","size":22291,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/17ff2d7aca664328200b991d130427be96f80654"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_D2_TextCycler_IterativeDemo_v01.json","mode":"100644","type":"blob","sha":"29e9205029c4a3f616948c4fb1c1c2322c07a3fc","size":25982,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/29e9205029c4a3f616948c4fb1c1c2322c07a3fc"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_D3_ImageCycler_IterativeDemo_v01.json","mode":"100644","type":"blob","sha":"8ce69def1965b2d09216fb6c14a3706549426ab2","size":9745,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/8ce69def1965b2d09216fb6c14a3706549426ab2"},{"path":"workflows/Animation/Iterative Demos/Legacy/CR_Animation_E1_GradientNodes_IterativeDemo_v01a.json","mode":"100644","type":"blob","sha":"d57cc9469ebdbbccc88921e722306207da07f35d","size":16842,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/d57cc9469ebdbbccc88921e722306207da07f35d"},{"path":"workflows/Animation/List Demos","mode":"040000","type":"tree","sha":"7054d08e462448710bd55b2e6a02e6636202bd9e","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/7054d08e462448710bd55b2e6a02e6636202bd9e"},{"path":"workflows/Animation/List Demos/CR_Animation_A3_SimplePromptScheduling_BatchDemo_v01.json","mode":"100644","type":"blob","sha":"109b1ec98c860260c1927c1d91a047a42410ff76","size":23755,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/109b1ec98c860260c1927c1d91a047a42410ff76"},{"path":"workflows/Animation/List Demos/CR_Bit_Schedule_demo1.json","mode":"100644","type":"blob","sha":"ad46a8f4c145c25abce3dcef03bbbcf8ab52e351","size":5783,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/ad46a8f4c145c25abce3dcef03bbbcf8ab52e351"},{"path":"workflows/Aspect Ratio","mode":"040000","type":"tree","sha":"65da92277ace9b24ee2b39237ca60a9c57a39edd","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/65da92277ace9b24ee2b39237ca60a9c57a39edd"},{"path":"workflows/Aspect Ratio/CR_Aspect_Ratio_demo1.json","mode":"100644","type":"blob","sha":"43ed3bed9c2d5fe309feb6111b2583eeaae522b6","size":6248,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/43ed3bed9c2d5fe309feb6111b2583eeaae522b6"},{"path":"workflows/Graphics","mode":"040000","type":"tree","sha":"a9524b1ca0c1643c07c7f40d22bdb08b76efd326","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/a9524b1ca0c1643c07c7f40d22bdb08b76efd326"},{"path":"workflows/Graphics/CR_graphics_nodes_demo1.json","mode":"100644","type":"blob","sha":"5593933f3fd49af7933def06d38f1660b339fe82","size":12868,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5593933f3fd49af7933def06d38f1660b339fe82"},{"path":"workflows/Graphics/Filter","mode":"040000","type":"tree","sha":"973bc86f8a0b6dcd7860e844c961978596371789","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/973bc86f8a0b6dcd7860e844c961978596371789"},{"path":"workflows/Graphics/Filter/CR_Vignette_Filter_demo1.json","mode":"100644","type":"blob","sha":"80f4815281d39b100211706542b6ca2511e38548","size":16525,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/80f4815281d39b100211706542b6ca2511e38548"},{"path":"workflows/Graphics/Filter/CR_Vignette_Filter_demo2.json","mode":"100644","type":"blob","sha":"ad67c52f5cf83695ec50b44f8d8482708b43933e","size":16529,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/ad67c52f5cf83695ec50b44f8d8482708b43933e"},{"path":"workflows/Graphics/Layout","mode":"040000","type":"tree","sha":"c5ecec50daeea6d4ee4331fc40f9e9e5dd611ac8","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/c5ecec50daeea6d4ee4331fc40f9e9e5dd611ac8"},{"path":"workflows/Graphics/Layout/CR_Feathered_Border_demo1.json","mode":"100644","type":"blob","sha":"0c38c63594a2cc4854cd1f35780453dfc1207e59","size":4848,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/0c38c63594a2cc4854cd1f35780453dfc1207e59"},{"path":"workflows/Graphics/Layout/CR_Image_Grid_Panel_demo1.json","mode":"100644","type":"blob","sha":"6de5301796792eb2c151b33a177234140973e449","size":5828,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/6de5301796792eb2c151b33a177234140973e449"},{"path":"workflows/Graphics/Layout/CR_Image_Grid_Panel_demo2.json","mode":"100644","type":"blob","sha":"21ca16870a54e84df405e611afbec18599605fe2","size":3118,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/21ca16870a54e84df405e611afbec18599605fe2"},{"path":"workflows/Graphics/Layout/CR_Overlay_Transparent_Image_demo1.json","mode":"100644","type":"blob","sha":"2ebd8f647fbde8f0458cc3d7c619d44caaaef827","size":7046,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2ebd8f647fbde8f0458cc3d7c619d44caaaef827"},{"path":"workflows/Graphics/Pattern","mode":"040000","type":"tree","sha":"c0fc9ebcfbf0af1b3dd7ae3b12d26a3c8fcbd5ab","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/c0fc9ebcfbf0af1b3dd7ae3b12d26a3c8fcbd5ab"},{"path":"workflows/Graphics/Pattern/CR_Starburst_Lines_demo1.json","mode":"100644","type":"blob","sha":"508d5de0c255c6baa31a8fd54df81e4eb1d96823","size":3100,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/508d5de0c255c6baa31a8fd54df81e4eb1d96823"},{"path":"workflows/Graphics/Pattern/CR_Style_Bars_demo1.json","mode":"100644","type":"blob","sha":"55df25be24a4febd570e2c70e752c0c25e58c5d0","size":15482,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/55df25be24a4febd570e2c70e752c0c25e58c5d0"},{"path":"workflows/Graphics/Pattern/CR_gradient_nodes_demo1.json","mode":"100644","type":"blob","sha":"805c7848db6fc3bea987beceacbc6fd053a65840","size":28463,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/805c7848db6fc3bea987beceacbc6fd053a65840"},{"path":"workflows/Graphics/Template","mode":"040000","type":"tree","sha":"b54affadd97308356b5f27d8aa7efacb4eb1e602","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/b54affadd97308356b5f27d8aa7efacb4eb1e602"},{"path":"workflows/Graphics/Template/CR_Seamless_Checker_demo1.json","mode":"100644","type":"blob","sha":"31139521e4e3440d3acaea652563e9020cc51b53","size":1765,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/31139521e4e3440d3acaea652563e9020cc51b53"},{"path":"workflows/Graphics/Template/CR_Simple_Banner_demo1.json","mode":"100644","type":"blob","sha":"e4c4390b56753fb9fa5771b9cf445a3b4c12658f","size":6134,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/e4c4390b56753fb9fa5771b9cf445a3b4c12658f"},{"path":"workflows/Graphics/Template/CR_Simple_Banner_demo2.json","mode":"100644","type":"blob","sha":"12a5b0b420c37ae1fcf0f4a9fce349d2b8261234","size":4660,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/12a5b0b420c37ae1fcf0f4a9fce349d2b8261234"},{"path":"workflows/Graphics/Template/CR_Simple_Image_Compare_demo1.json","mode":"100644","type":"blob","sha":"7df5e6f5038b323f184f1ff9fcf80a713074575b","size":4103,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/7df5e6f5038b323f184f1ff9fcf80a713074575b"},{"path":"workflows/Graphics/Template/CR_Simple_Meme_Template_demo1.json","mode":"100644","type":"blob","sha":"2a6e64d26c2a8b3b3a50561e7382b37522890186","size":2431,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2a6e64d26c2a8b3b3a50561e7382b37522890186"},{"path":"workflows/Graphics/Template/CR_Simple_Meme_Template_demo2.json","mode":"100644","type":"blob","sha":"8f539d00beba16dedfabb81f7227558ff893ff0f","size":10712,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/8f539d00beba16dedfabb81f7227558ff893ff0f"},{"path":"workflows/Graphics/Template/CR_Simple_Meme_Template_demo3.json","mode":"100644","type":"blob","sha":"1f25343283e84eb494ef7745ccfb4b1269c7930a","size":4986,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/1f25343283e84eb494ef7745ccfb4b1269c7930a"},{"path":"workflows/Graphics/Template/CR_Thumbnail_Preview_demo1.json","mode":"100644","type":"blob","sha":"87221d7c5fcfad6d1b31238776f1fb454f27398e","size":10033,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/87221d7c5fcfad6d1b31238776f1fb454f27398e"},{"path":"workflows/Graphics/Text","mode":"040000","type":"tree","sha":"6c78391947553d4b3e270cf4d6c5d9e4887d5c42","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/6c78391947553d4b3e270cf4d6c5d9e4887d5c42"},{"path":"workflows/Graphics/Text/CR_Select_Font_demo1.json","mode":"100644","type":"blob","sha":"bef540b615ccc3faeb3343a6b5320365047d2b01","size":3007,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/bef540b615ccc3faeb3343a6b5320365047d2b01"},{"path":"workflows/Graphics/Text/CR_Simple_Text_Watermark_demo1.json","mode":"100644","type":"blob","sha":"40a700b75d1988a13410ac9e537f199b117fc58e","size":5000,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/40a700b75d1988a13410ac9e537f199b117fc58e"},{"path":"workflows/List","mode":"040000","type":"tree","sha":"ecf630497b923e3fe7921451d4536760f07fec9a","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/ecf630497b923e3fe7921451d4536760f07fec9a"},{"path":"workflows/List/CR_Font_File_List_demo1.json","mode":"100644","type":"blob","sha":"397df65f5ac3682a09b5aec7323f4571428b4b8c","size":4005,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/397df65f5ac3682a09b5aec7323f4571428b4b8c"},{"path":"workflows/List/CR_Intertwine_Lists_demo1.json","mode":"100644","type":"blob","sha":"a4dd6d058cb361fefb029c8a1bbe94c753384be6","size":4450,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/a4dd6d058cb361fefb029c8a1bbe94c753384be6"},{"path":"workflows/List/CR_Load_Text_List_demo1.json","mode":"100644","type":"blob","sha":"2a9d4e485431f013cc6fc7e2b54ca19b6418e3f4","size":3130,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2a9d4e485431f013cc6fc7e2b54ca19b6418e3f4"},{"path":"workflows/List/CR_Text_List_demo1.json","mode":"100644","type":"blob","sha":"ff8c84cab8e71abc1d7eb47098c63e8b52b79eee","size":5897,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/ff8c84cab8e71abc1d7eb47098c63e8b52b79eee"},{"path":"workflows/List/CR_Text_List_demo2.json","mode":"100644","type":"blob","sha":"7172f55cabb48099042c072b15970e6e433d1a2f","size":5028,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/7172f55cabb48099042c072b15970e6e433d1a2f"},{"path":"workflows/List/CR_XY_Product_demo1.json","mode":"100644","type":"blob","sha":"6a976ea3ed1e60aa631881382bbf0331b1394fe4","size":8458,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/6a976ea3ed1e60aa631881382bbf0331b1394fe4"},{"path":"workflows/Model Merge","mode":"040000","type":"tree","sha":"d8fb42254b41b707bc49306d46c96fc2bb58c19a","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/d8fb42254b41b707bc49306d46c96fc2bb58c19a"},{"path":"workflows/Model Merge/CR_SDXL_MultiModelGradientMerge_demo1.json","mode":"100644","type":"blob","sha":"2cb756e80f834242825c1e40760001738b9729d1","size":52459,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/2cb756e80f834242825c1e40760001738b9729d1"},{"path":"workflows/Model Merge/CR_SDXL_MultiModelMerge_demo1.json","mode":"100644","type":"blob","sha":"3638d84001200cbeef39e5c9e1cd1e270fd65a56","size":37454,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/3638d84001200cbeef39e5c9e1cd1e270fd65a56"},{"path":"workflows/Model Merge/CR_SimpleMultiModelMerge_demo1.json","mode":"100644","type":"blob","sha":"4114228c4541f8a4575b51cbdf92c1a2cd7ecc4a","size":9656,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4114228c4541f8a4575b51cbdf92c1a2cd7ecc4a"},{"path":"workflows/Model Merge/CR_UltraSimpleMultiModelMerge_demo1.json","mode":"100644","type":"blob","sha":"5b673b5b6b9b4c30a3d78f7630fce0bc1b39c521","size":4101,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5b673b5b6b9b4c30a3d78f7630fce0bc1b39c521"},{"path":"workflows/Other","mode":"040000","type":"tree","sha":"b43da2641e4461bbee51f45e108d666891a02d84","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/b43da2641e4461bbee51f45e108d666891a02d84"},{"path":"workflows/Other/CR_Load_Image_Plus_demo1.json","mode":"100644","type":"blob","sha":"b26f179844c4783664611f983c8fde268e6a57d0","size":7386,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b26f179844c4783664611f983c8fde268e6a57d0"},{"path":"workflows/Other/CR_Multiline_Text_demo1.json","mode":"100644","type":"blob","sha":"6d01a2be637de78108e058279bb89947ff667123","size":20177,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/6d01a2be637de78108e058279bb89947ff667123"},{"path":"workflows/Other/CR_Save_Text_To_file_demo1.json","mode":"100644","type":"blob","sha":"67f596d91579070321f4de8bde935f7584412736","size":3273,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/67f596d91579070321f4de8bde935f7584412736"},{"path":"workflows/Other/CR_Split_String_demo1.json","mode":"100644","type":"blob","sha":"b289847e4334016da863994a49e0ec743b89f78a","size":5533,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/b289847e4334016da863994a49e0ec743b89f78a"},{"path":"workflows/Pipe","mode":"040000","type":"tree","sha":"633f6abffcd8f4efe908bfe1368013837e0aa3e1","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/633f6abffcd8f4efe908bfe1368013837e0aa3e1"},{"path":"workflows/Pipe/CR_Data_Bus_demo1.json","mode":"100644","type":"blob","sha":"8e346ff511d033feba8ad80955c5695b31a63248","size":8862,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/8e346ff511d033feba8ad80955c5695b31a63248"},{"path":"workflows/Upscale","mode":"040000","type":"tree","sha":"81c90abf871dd99b2779b9145532badd47d8967b","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/81c90abf871dd99b2779b9145532badd47d8967b"},{"path":"workflows/Upscale/CR_Multi_Upscale_Stack_demo1.json","mode":"100644","type":"blob","sha":"3a481466784047d054c9d82709026d831418d072","size":3319,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/3a481466784047d054c9d82709026d831418d072"},{"path":"workflows/Upscale/CR_Upscale_Image_demo1.json","mode":"100644","type":"blob","sha":"732808ab9a670c33c4e847cd463e7b54bd48b878","size":3188,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/732808ab9a670c33c4e847cd463e7b54bd48b878"},{"path":"workflows/Utils","mode":"040000","type":"tree","sha":"9940904d4ccff503a26695d8879248ac81576c2c","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/9940904d4ccff503a26695d8879248ac81576c2c"},{"path":"workflows/Utils/Conversion","mode":"040000","type":"tree","sha":"5df18d47c673217798d8e49b632468f7b930be76","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/5df18d47c673217798d8e49b632468f7b930be76"},{"path":"workflows/Utils/Conversion/CR_String_To_Number_demo1.json","mode":"100644","type":"blob","sha":"fe2407d8ff2d60d75f94b28e84f296ecad411375","size":10401,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/fe2407d8ff2d60d75f94b28e84f296ecad411375"},{"path":"workflows/Utils/Logic","mode":"040000","type":"tree","sha":"9ab67cdd6e36fac13dd93e4a8c5d42cd6fcd875b","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/9ab67cdd6e36fac13dd93e4a8c5d42cd6fcd875b"},{"path":"workflows/Utils/Logic/CR_Text_Input_Switch_demo1.json","mode":"100644","type":"blob","sha":"5ca8d6726f14ffc7c0ff57362c7016dc5ab90e21","size":8012,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5ca8d6726f14ffc7c0ff57362c7016dc5ab90e21"},{"path":"workflows/Utils/Other","mode":"040000","type":"tree","sha":"c04e7a3712b3e2794fb200d635a7ad2b68abee79","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/c04e7a3712b3e2794fb200d635a7ad2b68abee79"},{"path":"workflows/Utils/Other/CR_Get_Parameter_From_Folder_demo1.json","mode":"100644","type":"blob","sha":"72376fddad065534d37a0c8894d9c043b6a1cc03","size":13262,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/72376fddad065534d37a0c8894d9c043b6a1cc03"},{"path":"workflows/Utils/Other/CR_Set_Switch_From_String_demo1.json","mode":"100644","type":"blob","sha":"4f678364ffc91526d0a2914fd7f7c6876e032d26","size":6063,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/4f678364ffc91526d0a2914fd7f7c6876e032d26"},{"path":"workflows/Utils/Other/CR_Set_Value_On_Binary_demo1.json","mode":"100644","type":"blob","sha":"e1222ae9efd147f2141fc10873037c3af8a34fa8","size":7938,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/e1222ae9efd147f2141fc10873037c3af8a34fa8"},{"path":"workflows/Utils/Random","mode":"040000","type":"tree","sha":"7e85a4c04f2ac7de8a41f02412e5fd5358c919ab","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/7e85a4c04f2ac7de8a41f02412e5fd5358c919ab"},{"path":"workflows/Utils/Random/CR_Random_Multiline_Colors_demo1.json","mode":"100644","type":"blob","sha":"96bb21d5ebbb191f4b96757f83f26f1169a59dac","size":4037,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/96bb21d5ebbb191f4b96757f83f26f1169a59dac"},{"path":"workflows/Utils/Random/CR_Random_Multiline_Values_demo1.json","mode":"100644","type":"blob","sha":"565b508b95550ddb33b64958bfd45e02ba994064","size":11736,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/565b508b95550ddb33b64958bfd45e02ba994064"},{"path":"workflows/Utils/Random/CR_Random_Panel_Codes_demo1.json","mode":"100644","type":"blob","sha":"5a36ee91475021ba8590b871cb8bd205756a5547","size":5515,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5a36ee91475021ba8590b871cb8bd205756a5547"},{"path":"workflows/Utils/Random/CR_Random_RGB_Gradient_demo1.json","mode":"100644","type":"blob","sha":"bf9f0d0a20e283b819868d31bad13cb22ec52010","size":3045,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/bf9f0d0a20e283b819868d31bad13cb22ec52010"},{"path":"workflows/Utils/Text","mode":"040000","type":"tree","sha":"62757c2ff1b1bcd34b4d81c5fc1aa12c7d11d8be","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/62757c2ff1b1bcd34b4d81c5fc1aa12c7d11d8be"},{"path":"workflows/Utils/Text/CR_Text_Operation_demo1.json","mode":"100644","type":"blob","sha":"5fae9ccb5b3cb3bc87d5d6f0f0a8b232249675f2","size":16454,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/5fae9ccb5b3cb3bc87d5d6f0f0a8b232249675f2"},{"path":"workflows/XY Grid","mode":"040000","type":"tree","sha":"70aa35cdcd265d52bdc75f6dd2b442a716d7248e","url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/trees/70aa35cdcd265d52bdc75f6dd2b442a716d7248e"},{"path":"workflows/XY Grid/CR_XY_Revised_FreeU_demo1.json","mode":"100644","type":"blob","sha":"11d0b459b9aae04283458422277873ea43a0fbd6","size":19571,"url":"https://api.github.com/repos/Suzie1/ComfyUI_Comfyroll_CustomNodes/git/blobs/11d0b459b9aae04283458422277873ea43a0fbd6"}],"truncated":false}
\ No newline at end of file
diff --git a/docs/hel-892/tts-reference/cr____init__.py b/docs/hel-892/tts-reference/cr____init__.py
new file mode 100644
index 00000000..e5af1835
--- /dev/null
+++ b/docs/hel-892/tts-reference/cr____init__.py
@@ -0,0 +1,30 @@
+# By Suzie1 and RockOfFire
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to
+# deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+"""
+@author: Suzie1
+@title: Comfyroll Studio
+@nickname: Comfyroll Studio
+@description: 175 custom nodes for artists, designers and animators.
+"""
+
+from .node_mappings import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
+
+print("------------------------------------------")
+print("\033[34mComfyroll Studio v1.76 : \033[92m 175 Nodes Loaded\033[0m")
+print("------------------------------------------")
+print("** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md")
+print("** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki")
+print("------------------------------------------")
+
+
diff --git a/docs/hel-892/tts-reference/cr__node_mappings.py b/docs/hel-892/tts-reference/cr__node_mappings.py
new file mode 100644
index 00000000..a4a1bc4f
--- /dev/null
+++ b/docs/hel-892/tts-reference/cr__node_mappings.py
@@ -0,0 +1,532 @@
+try:
+ from .nodes.nodes_core import *
+ from .nodes.nodes_aspect_ratio import *
+ from .nodes.nodes_list import *
+ from .nodes.nodes_lora import *
+ from .nodes.nodes_controlnet import *
+ from .nodes.nodes_pipe import *
+ from .nodes.nodes_sdxl import *
+ from .nodes.nodes_model_merge import *
+ from .nodes.nodes_upscale import *
+ from .nodes.nodes_xygrid import *
+ from .nodes.nodes_legacy import *
+except ImportError:
+ print("\033[34mComfyroll Studio: \033[92mFailed to load Essential nodes\033[0m")
+
+try:
+ from .nodes.nodes_graphics_matplot import *
+ from .nodes.nodes_graphics_text import *
+ from .nodes.nodes_graphics_layout import *
+ from .nodes.nodes_graphics_filter import *
+ from .nodes.nodes_graphics_template import *
+ from .nodes.nodes_graphics_pattern import *
+except ImportError:
+ print("\033[34mComfyroll Studio: \033[92mFailed to load Graphics nodes\033[0m")
+
+try:
+ from .nodes.nodes_animation_interpolation import *
+ from .nodes.nodes_animation_io import *
+ from .nodes.nodes_animation_prompt import *
+ from .nodes.nodes_animation_schedulers import *
+ from .nodes.nodes_animation_schedules import *
+ from .nodes.nodes_animation_lists import *
+ from .nodes.nodes_animation_utils import *
+ from .nodes.nodes_animation_cyclers import *
+except ImportError:
+ print("\033[34mComfyroll Studio: \033[92mFailed to load Animation nodes\033[0m")
+
+try:
+ from .nodes.nodes_utils_logic import *
+ from .nodes.nodes_utils_index import *
+ from .nodes.nodes_utils_conversion import *
+ from .nodes.nodes_utils_random import *
+ from .nodes.nodes_utils_text import *
+ from .nodes.nodes_utils_other import *
+except ImportError:
+ print("\033[34mComfyroll Studio: \033[92mFailed to load Utility nodes\033[0m")
+
+NODE_CLASS_MAPPINGS = {
+ ### Core Nodes
+ "CR Image Output": CR_ImageOutput,
+ "CR Latent Batch Size": CR_LatentBatchSize,
+ "CR Conditioning Mixer": CR_ConditioningMixer,
+ "CR Select Model": CR_SelectModel,
+ "CR Seed": CR_Seed,
+ "CR Prompt Text": CR_PromptText,
+ "CR Combine Prompt": CR_CombinePrompt,
+ "CR VAE Decode": CR_VAEDecode,
+ ### List Nodes
+ "CR Text List": CR_TextList,
+ "CR Prompt List": CR_PromptList,
+ "CR Simple List": CR_SimpleList,
+ "CR Float Range List": CR_FloatRangeList,
+ "CR Integer Range List": CR_IntegerRangeList,
+ "CR Load Text List": CR_LoadTextList,
+ "CR Binary To Bit List": CR_BinaryToBitList,
+ "CR Text Cycler": CR_TextCycler,
+ "CR Value Cycler": CR_ValueCycler,
+ ### List IO
+ "CR Load Image List": CR_LoadImageList,
+ "CR Load Image List Plus": CR_LoadImageListPlus,
+ "CR Load GIF As List": CR_LoadGIFAsList,
+ "CR Font File List": CR_FontFileList,
+ ### List Utils
+ "CR Batch Images From List": CR_MakeBatchFromImageList,
+ "CR Intertwine Lists" : CR_IntertwineLists,
+ "CR Repeater": CR_Repeater,
+ "CR XY Product": CR_XYProduct,
+ "CR Text List To String": CR_TextListToString,
+ ### Aspect Ratio Nodes
+ "CR SD1.5 Aspect Ratio": CR_AspectRatioSD15,
+ "CR SDXL Aspect Ratio": CR_SDXLAspectRatio,
+ "CR Aspect Ratio": CR_AspectRatio,
+ "CR Aspect Ratio Banners": CR_AspectRatioBanners,
+ "CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
+ "CR_Aspect Ratio For Print": CR_AspectRatioForPrint,
+ ### Legacy Nodes
+ "CR Image Size": CR_ImageSize,
+ "CR Aspect Ratio SDXL": CR_AspectRatio_SDXL,
+ "CR SDXL Prompt Mixer": CR_PromptMixer,
+ "CR Seed to Int": CR_SeedToInt,
+ ### ControlNet Nodes
+ "CR Apply ControlNet": CR_ApplyControlNet,
+ "CR Multi-ControlNet Stack": CR_ControlNetStack,
+ "CR Apply Multi-ControlNet": CR_ApplyControlNetStack,
+ ### LoRA Nodes
+ "CR Load LoRA": CR_LoraLoader,
+ "CR LoRA Stack": CR_LoRAStack,
+ "CR Random LoRA Stack": CR_RandomLoRAStack,
+ "CR Random Weight LoRA": CR_RandomWeightLoRA,
+ "CR Apply LoRA Stack": CR_ApplyLoRAStack,
+ ### Model Merge Nodes
+ "CR Apply Model Merge": CR_ApplyModelMerge,
+ "CR Model Merge Stack": CR_ModelMergeStack,
+ ### Pipe Nodes
+ "CR Data Bus In":CR_DataBusIn,
+ "CR Data Bus Out":CR_DataBusOut,
+ "CR 8 Channel In":CR_8ChannelIn,
+ "CR 8 Channel Out":CR_8ChannelOut,
+ "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,
+ ### SDXL Nodes
+ "CR SDXL Prompt Mix Presets": CR_PromptMixPresets,
+ "CR SDXL Style Text": CR_SDXLStyleText,
+ "CR SDXL Base Prompt Encoder": CR_SDXLBasePromptEncoder,
+ ### Upscale Nodes
+ "CR Multi Upscale Stack": CR_MultiUpscaleStack,
+ "CR Upscale Image": CR_UpscaleImage,
+ "CR Apply Multi Upscale": CR_ApplyMultiUpscale,
+ ### XY Grid Nodes
+ "CR XY List": CR_XYList,
+ "CR XY Interpolate": CR_XYInterpolate,
+ "CR XY From Folder": CR_XYFromFolder,
+ "CR XY Save Grid Image": CR_XYSaveGridImage,
+ "CR XY Index": CR_XYIndex,
+ #"CR XYZ Index": CR_XYZIndex,
+ ### Graphics Pattern
+ "CR Halftone Grid": CR_HalftoneGrid,
+ "CR Color Bars": CR_ColorBars,
+ "CR Style Bars": CR_StyleBars,
+ "CR Checker Pattern": CR_CheckerPattern,
+ "CR Polygons": CR_Polygons,
+ "CR Color Gradient": CR_ColorGradient,
+ "CR Radial Gradient": CR_RadialGradient,
+ "CR Starburst Lines": CR_StarburstLines,
+ "CR Starburst Colors": CR_StarburstColors,
+ "CR Simple Binary Pattern": CR_BinaryPatternSimple,
+ "CR Binary Pattern": CR_BinaryPattern,
+ ### Graphics Shape
+ "CR Draw Shape": CR_DrawShape,
+ "CR Draw Pie": CR_DrawPie,
+ "CR Random Shape Pattern": CR_RandomShapePattern,
+ ### Graphics Text
+ "CR Overlay Text": CR_OverlayText,
+ "CR Draw Text": CR_DrawText,
+ "CR Mask Text": CR_MaskText,
+ "CR Composite Text": CR_CompositeText,
+ #"CR Arabic Text RTL": CR_ArabicTextRTL,
+ "CR Simple Text Watermark": CR_SimpleTextWatermark,
+ "CR Select Font": CR_SelectFont,
+ ### Graphics Filter
+ "CR Halftone Filter": CR_HalftoneFilter,
+ "CR Color Tint": CR_ColorTint,
+ "CR Vignette Filter": CR_VignetteFilter,
+ ### Graphics Layout
+ "CR Page Layout": CR_PageLayout,
+ "CR Image Panel": CR_ImagePanel,
+ "CR Image Grid Panel": CR_ImageGridPanel,
+ "CR Image Border": CR_ImageBorder,
+ "CR Feathered Border": CR_FeatheredBorder,
+ "CR Simple Text Panel": CR_SimpleTextPanel,
+ "CR Color Panel": CR_ColorPanel,
+ "CR Overlay Transparent Image": CR_OverlayTransparentImage,
+ "CR Half Drop Panel": CR_HalfDropPanel,
+ "CR Diamond Panel": CR_DiamondPanel,
+ #"CR Simple Titles": CR_SimpleTitles,
+ ### Graphics Template
+ "CR Simple Meme Template": CR_SimpleMemeTemplate,
+ "CR Simple Banner": CR_SimpleBanner,
+ "CR Comic Panel Templates": CR_ComicPanelTemplates,
+ "CR Simple Image Compare": CR_SimpleImageCompare,
+ "CR Thumbnail Preview": CR_ThumbnailPreview,
+ "CR Seamless Checker": CR_SeamlessChecker,
+ ### Utils Logic
+ "CR Image Input Switch": CR_ImageInputSwitch,
+ "CR Image Input Switch (4 way)": CR_ImageInputSwitch4way,
+ "CR Latent Input Switch": CR_LatentInputSwitch,
+ "CR Conditioning Input Switch": CR_ConditioningInputSwitch,
+ "CR Clip Input Switch": CR_ClipInputSwitch,
+ "CR Model Input Switch": CR_ModelInputSwitch,
+ "CR ControlNet Input Switch": CR_ControlNetInputSwitch,
+ "CR VAE Input Switch": CR_VAEInputSwitch,
+ "CR Text Input Switch": CR_TextInputSwitch,
+ "CR Text Input Switch (4 way)": CR_TextInputSwitch4way,
+ "CR Switch Model and CLIP": CR_ModelAndCLIPInputSwitch,
+ ### Utils Process
+ "CR Batch Process Switch": CR_BatchProcessSwitch,
+ "CR Img2Img Process Switch": CR_Img2ImgProcessSwitch,
+ "CR Hires Fix Process Switch": CR_HiResFixProcessSwitch,
+ ### Utils Index
+ "CR Index": CR_Index,
+ "CR Index Increment": CR_IncrementIndex,
+ "CR Index Multiply": CR_MultiplyIndex,
+ "CR Index Reset": CR_IndexReset,
+ "CR Trigger": CR_Trigger,
+ ### Utils Conversion
+ "CR String To Number": CR_StringToNumber,
+ "CR String To Combo": CR_StringToCombo,
+ "CR Float To String": CR_FloatToString,
+ "CR Float To Integer": CR_FloatToInteger,
+ "CR Integer To String": CR_IntegerToString,
+ "CR String To Boolean": CR_StringToBoolean,
+ ### Utils Random
+ "CR Random Hex Color": CR_RandomHexColor,
+ "CR Random RGB": CR_RandomRGB,
+ "CR Random Multiline Values": CR_RandomMultilineValues,
+ "CR Random Multiline Colors": CR_RandomMultilineColors,
+ "CR Random RGB Gradient": CR_RandomRGBGradient,
+ "CR Random Panel Codes": CR_RandomPanelCodes,
+ ### Utils Text
+ "CR Text": CR_Text,
+ "CR Multiline Text": CR_MultilineText,
+ "CR Split String": CR_SplitString,
+ "CR Text Concatenate": CR_TextConcatenate,
+ "CR Text Replace": CR_TextReplace,
+ "CR Text Length": CR_TextLength,
+ "CR Text Operation": CR_TextOperation,
+ "CR Text Blacklist": CR_TextBlacklist,
+ "CR Save Text To File": CR_SaveTextToFile,
+ ### Utils Conditional
+ "CR Set Value On Boolean": CR_SetValueOnBoolean,
+ "CR Set Value On Binary": CR_SetValueOnBinary,
+ "CR Set Value on String": CR_SetValueOnString,
+ "CR Set Switch From String": CR_SetSwitchFromString,
+ ### Utils Other
+ "CR Value": CR_Value,
+ "CR Integer Multiple": CR_IntegerMultipleOf,
+ "CR Clamp Value": CR_ClampValue,
+ "CR Math Operation": CR_MathOperation,
+ "CR Get Parameter From Prompt": CR_GetParameterFromPrompt,
+ "CR Select Resize Method": CR_SelectResizeMethod,
+ "CR Select ISO Size": CR_SelectISOSize,
+ ### Animation Nodes
+ # Schedules
+ "CR Simple Schedule": CR_SimpleSchedule,
+ "CR Central Schedule": CR_CentralSchedule,
+ "CR Combine Schedules": CR_CombineSchedules,
+ "CR Output Schedule To File": CR_OutputScheduleToFile,
+ "CR Load Schedule From File": CR_LoadScheduleFromFile,
+ "CR Schedule Input Switch": Comfyroll_ScheduleInputSwitch,
+ "CR Bit Schedule": CR_BitSchedule,
+ # Schedulers
+ "CR Simple Value Scheduler": CR_SimpleValueScheduler,
+ "CR Simple Text Scheduler": CR_SimpleTextScheduler,
+ "CR Value Scheduler": CR_ValueScheduler,
+ "CR Text Scheduler": CR_TextScheduler,
+ "CR Load Scheduled Models": CR_LoadScheduledModels,
+ "CR Load Scheduled LoRAs": CR_LoadScheduledLoRAs,
+ "CR Prompt Scheduler": CR_PromptScheduler,
+ "CR Simple Prompt Scheduler": CR_SimplePromptScheduler,
+ # Prompt
+ "CR Keyframe List": CR_KeyframeList,
+ #"CR Load Prompt Style": CR_LoadPromptStyle,
+ "CR Encode Scheduled Prompts": CR_EncodeScheduledPrompts,
+ # Interpolation
+ "CR Gradient Float": CR_GradientFloat,
+ "CR Gradient Integer": CR_GradientInteger,
+ "CR Increment Float": CR_IncrementFloat,
+ "CR Increment Integer": CR_IncrementInteger,
+ "CR Interpolate Latents": CR_InterpolateLatents,
+ # Utils
+ "CR Debatch Frames": CR_DebatchFrames,
+ "CR Current Frame": CR_CurrentFrame,
+ #"CR Input Text List": CR_InputTextList,
+ # IO
+ "CR Load Animation Frames": CR_LoadAnimationFrames,
+ "CR Load Flow Frames": CR_LoadFlowFrames,
+ "CR Output Flow Frames": CR_OutputFlowFrames,
+ ### Legacy
+ # Note: CR Prompt List and CR Text List names have been reused,
+ # so the old versions of these nodes are no longer available
+ "CR Prompt List Keyframes": CR_PromptListKeyframes,
+ "CR Simple Prompt List": CR_SimplePromptList,
+ "CR Simple Prompt List Keyframes": CR_SimplePromptListKeyframes,
+ "CR Cycle Models": CR_CycleModels,
+ "CR Cycle LoRAs": CR_CycleLoRAs,
+ "CR Cycle Text": CR_CycleText,
+ "CR Cycle Text Simple": CR_CycleTextSimple,
+ "CR Cycle Images": CR_CycleImages,
+ "CR Cycle Images Simple": CR_CycleImagesSimple,
+ "CR Model List": CR_ModelList,
+ "CR LoRA List": CR_LoRAList,
+ "CR Text List Simple": CR_TextListSimple,
+ "CR Image List": CR_ImageList,
+ "CR Image List Simple": CR_ImageListSimple,
+}
+
+NODE_DISPLAY_NAME_MAPPINGS = {
+ ### Core Nodes
+ "CR Image Output": "💾 CR Image Output",
+ "CR Integer Multiple": "⚙️ CR Integer Multiple",
+ "CR Latent Batch Size": "⚙️ CR Latent Batch Size",
+ "CR Seed": "🌱 CR Seed",
+ "CR Value": "⚙️ CR Value",
+ "CR Conditioning Mixer": "⚙️ CR Conditioning Mixer",
+ "CR Select Model": "🔮 CR Select Model",
+ "CR Prompt Text": "⚙️ CR Prompt Text",
+ "CR Combine Prompt": "⚙️ CR Combine Prompt",
+ "CR VAE Decode": "⚙️ CR VAE Decode",
+ ### List Nodes
+ "CR Text List": "📜 CR Text List",
+ "CR Prompt List": "📜 CR Prompt List",
+ "CR Simple List": "📜 CR Simple List",
+ "CR Float Range List": "📜 CR Float Range List",
+ "CR Integer Range List": "📜 CR Integer Range List",
+ "CR Load Value List": "📜 CR Load Value List",
+ "CR Load Text List": "📜 CR Load Text List",
+ "CR Binary To Bit List": "📜 CR Binary To Bit List",
+ "CR Text Cycler": "📜 CR Text Cycler",
+ "CR Value Cycler": "📜 CR Value Cycler",
+ ### List IO
+ "CR Load Image List": "⌨️ CR Load Image List",
+ "CR Load Image List Plus": "⌨️ CR Load Image List Plus",
+ "CR Load GIF As List": "⌨️ CR Load GIF As List",
+ "CR Font File List": "⌨️ CR Font File List",
+ ### List Utils
+ "CR Batch Images From List": "🛠️ CR Batch Images From List",
+ "CR Intertwine Lists" : "🛠️ CR Intertwine Lists",
+ "CR Repeater": "🛠️ CR Repeater",
+ "CR XY Product": "🛠️ CR XY Product",
+ "CR Text List To String": "🛠️ CR Text List To String",
+ ### Aspect Ratio Nodes
+ "CR SD1.5 Aspect Ratio": "🔳 CR SD1.5 Aspect Ratio",
+ "CR SDXL Aspect Ratio": "🔳 CR SDXL Aspect Ratio",
+ "CR Aspect Ratio": "🔳 CR Aspect Ratio",
+ "CR Aspect Ratio Banners": "🔳 CR Aspect Ratio Banners",
+ "CR Aspect Ratio Social Media": "🔳 CR Aspect Ratio Social Media",
+ "CR_Aspect Ratio For Print": "🔳 CR_Aspect Ratio For Print",
+ ### Legacy Nodes
+ "CR Image Size": "CR Image Size (Legacy)",
+ "CR Aspect Ratio SDXL": "CR Aspect Ratio SDXL (Legacy)",
+ "CR SDXL Prompt Mixer": "CR SDXL Prompt Mixer (Legacy)",
+ "CR Seed to Int": "CR Seed to Int (Legacy)",
+ ### ControlNet Nodes
+ "CR Apply ControlNet": "🕹️ CR Apply ControlNet",
+ "CR Multi-ControlNet Stack": "🕹️ CR Multi-ControlNet Stack",
+ "CR Apply Multi-ControlNet": "🕹️ CR Apply Multi-ControlNet",
+ ### LoRA Nodes
+ "CR Load LoRA": "💊 CR Load LoRA",
+ "CR LoRA Stack": "💊 CR LoRA Stack",
+ "CR Random LoRA Stack": "💊 CR Random LoRA Stack",
+ "CR Random Weight LoRA": "💊 CR Random Weight LoRA",
+ "CR Apply LoRA Stack": "💊 CR Apply LoRA Stack",
+ ### Model Merge Nodes
+ "CR Apply Model Merge": "⛏️ CR Apply Model Merge",
+ "CR Model Merge Stack": "⛏️ CR Model Merge Stack",
+ ### Pipe Nodes
+ "CR Data Bus In": "🚌 CR Data Bus In",
+ "CR Data Bus Out": "🚌 CR Data Bus Out",
+ "CR 8 Channel In": "🚌 CR 8 Channel In",
+ "CR 8 Channel Out": "🚌 CR 8 Channel Out",
+ "CR Module Pipe Loader": "✈️ CR Module Pipe Loader",
+ "CR Module Input": "✈️ CR Module Input",
+ "CR Module Output": "✈️ CR Module Output",
+ "CR Image Pipe In": "🛩 CR Image Pipe In",
+ "CR Image Pipe Edit": "🛩️ CR Image Pipe Edit",
+ "CR Image Pipe Out": "🛩️ CR Image Pipe Out",
+ "CR Pipe Switch": "🔀️ CR Pipe Switch",
+ ### SDXL Nodes
+ "CR SDXL Prompt Mix Presets": "🌟 CR SDXL Prompt Mix Presets",
+ "CR SDXL Style Text": "🌟 CR SDXL Style Text",
+ "CR SDXL Base Prompt Encoder": "🌟 CR SDXL Base Prompt Encoder",
+ ### Upscale Nodes
+ "CR Multi Upscale Stack": "🔍 CR Multi Upscale Stack",
+ "CR Upscale Image": "🔍 CR Upscale Image",
+ "CR Apply Multi Upscale": "🔍 CR Apply Multi Upscale",
+ ### XY Grid Nodes
+ "CR XY List": "📉 CR XY List",
+ "CR XY Interpolate": "📉 CR XY Interpolate",
+ "CR XY Index": "📉 CR XY Index",
+ "CR XY From Folder": "📉 CR XY From Folder",
+ "CR XY Save Grid Image": "📉 CR XY Save Grid Image",
+ ### Graphics Pattern
+ "CR Halftone Grid" : "🟫 CR Halftone Grid",
+ "CR Color Bars" : "🟫 CR Color Bars",
+ "CR Style Bars" : "🟪 CR Style Bars",
+ "CR Checker Pattern": "🟦 CR Checker Pattern",
+ "CR Polygons": "🟩 CR Polygons",
+ "CR Color Gradient": "🟨 CR Color Gradient",
+ "CR Radial Gradient": "🟨 CR Radial Gradient",
+ "CR Starburst Lines": "🟧 CR Starburst Lines",
+ "CR Starburst Colors": "🟧 CR Starburst Colors",
+ "CR Simple Binary Pattern": "🟥 CR Simple Binary Pattern",
+ "CR Binary Pattern": "🟥 CR Binary Pattern",
+ ### Graphics Shape
+ "CR Draw Shape": "🟡 CR Draw Shape",
+ "CR Draw Pie": "🟢 CR Draw Pie",
+ "CR Random Shape Pattern": "🔵 CR Random Shape Pattern",
+ ### Graphics Text
+ "CR Overlay Text": "🔤 CR Overlay Text",
+ "CR Draw Text": "🔤️ CR Draw Text",
+ "CR Mask Text": "🔤️ CR Mask Text",
+ "CR Composite Text": "🔤️ CR Composite Text",
+ "CR Simple Text Watermark": "🔤️ CR Simple Text Watermark",
+ "CR Select Font": "🔤️ CR Select Font",
+ ### Graphics Filter
+ "CR Halftone Filter": "🎨 Halftone Filter",
+ "CR Color Tint": "🎨 CR Color Tint",
+ "CR Vignette Filter": "🎨 CR Vignette Filter",
+ ### Graphics Layout
+ "CR Image Panel": "🌁 CR Image Panel",
+ "CR Image Grid Panel": "🌁 CR Image Grid Panel",
+ "CR Simple Text Panel": "🌁 CR Simple Text Panel",
+ "CR Color Panel": "🌁 CR Color Panel",
+ "CR Half Drop Panel": "🌁 CR Half Drop Panel",
+ "CR Diamond Panel": "🌁 CR Diamond Panel",
+ "CR Page Layout": "🌁 CR Page Layout",
+ "CR Image Border": "🌁 CR Image Border",
+ "CR Feathered Border": "🌁 CR Feathered Border",
+ "CR Overlay Transparent Image": "🌁 CR Overlay Transparent Image",
+ ### Graphics Template
+ "CR Simple Meme Template": "📱 CR Simple Meme Template",
+ "CR Simple Banner": "📱 CR Simple Banner",
+ "CR Comic Panel Templates": "📱 CR Comic Panel Templates",
+ "CR Simple Image Compare": "📱 CR Simple Image Compare",
+ "CR Thumbnail Preview": "📱 CR Thumbnail Preview",
+ "CR Seamless Checker": "📱 CR Seamless Checker",
+ ### Utils Logic
+ "CR Image Input Switch": "🔀 CR Image Input Switch",
+ "CR Image Input Switch (4 way)": "🔀 CR Image Input Switch (4 way)",
+ "CR Latent Input Switch": "🔀 CR Latent Input Switch",
+ "CR Conditioning Input Switch": "🔀 CR Conditioning Input Switch",
+ "CR Clip Input Switch": "🔀 CR Clip Input Switch",
+ "CR Model Input Switch": "🔀 CR Model Input Switch",
+ "CR ControlNet Input Switch": "🔀 CR ControlNet Input Switch",
+ "CR VAE Input Switch": "🔀 CR VAE Input Switch",
+ "CR Text Input Switch": "🔀 CR Text Input Switch",
+ "CR Text Input Switch (4 way)": "🔀 CR Text Input Switch (4 way)",
+ "CR Switch Model and CLIP": "🔀 CR Switch Model and CLIP",
+ ### Utils Process
+ "CR Batch Process Switch": "🔂 CR Batch Process Switch",
+ "CR Img2Img Process Switch": "🔂 CR Img2Img Process Switch",
+ "CR Hires Fix Process Switch": "🔂 CR Hires Fix Process Switch",
+ ### Utils Index
+ "CR Index":"🔢 CR Index",
+ "CR Index Increment": "🔢 CR Index Increment",
+ "CR Index Multiply": "🔢 CR Index Multiply",
+ "CR Index Reset": "🔢 CR Index Reset",
+ "CR Trigger": "🔢 CR Trigger",
+ ### Utils Conversion
+ "CR String To Number": "🔧 CR String To Number",
+ "CR String To Combo": "🔧 CR String To Combo",
+ "CR Float To String": "🔧 CR Float To String",
+ "CR Float To Integer": "🔧 CR Float To Integer",
+ "CR Integer To String": "🔧 CR Integer To String",
+ "CR String To Boolean": "🔧 CR String To Boolean",
+ ### Utils Random
+ "CR Random Hex Color": "🎲 CR Random Hex Color",
+ "CR Random RGB": "🎲 CR Random RGB",
+ "CR Random Multiline Values": "🎲 CR Random Multiline Values",
+ "CR Random Multiline Colors": "🎲 CR Random Multiline Colors",
+ "CR Random RGB Gradient": "🎲 CR Random RGB Gradient",
+ "CR Random Panel Codes": "🎲 CR Random Panel Codes",
+ ### Utils Text
+ "CR Text": "🔤 CR Text",
+ "CR Multiline Text": "🔤 CR Multiline Text",
+ "CR Split String": "🔤 CR Split String",
+ "CR Text Concatenate": "🔤 CR Text Concatenate",
+ "CR Text Replace": "🔤 CR Text Replace",
+ "CR Text Blacklist": "🔤 Text Blacklist",
+ "CR Text Length": "🔤 CR Text Length",
+ "CR Text Operation": "🔤 CR Text Operation",
+ "CR Save Text To File": "🔤 CR Save Text To File",
+ ### Utils Conditional
+ "CR Set Value On Boolean": "⚙️ CR Set Value On Boolean",
+ "CR Set Value On Binary": "⚙️ CR Set Value On Binary",
+ "CR Set Value on String": "⚙️ CR Set Value on String",
+ "CR Set Switch From String": "⚙️ CR Set Switch From String",
+ ### Utils Other
+ "CR Integer Multiple": "⚙️ CR Integer Multiple",
+ "CR Value": "⚙️ CR Value",
+ "CR Clamp Value": "⚙️ CR Clamp Value",
+ "CR Math Operation": "⚙️ CR Math Operation",
+ "CR Get Parameter From Prompt": "⚙️ CR Get Parameter From Prompt",
+ "CR Select Resize Method": "⚙️ CR Select Resize Method",
+ "CR Select ISO Size": "⚙️ CR Select ISO Size",
+ ### Animation Nodes
+ # Schedules
+ "CR Simple Schedule": "📋 CR Simple Schedule",
+ "CR Central Schedule": "📋 CR Central Schedule",
+ "CR Combine Schedules": "📋 CR Combine Schedules",
+ "CR Output Schedule To File": "📋 CR Output Schedule To File",
+ "CR Load Schedule From File": "📋 CR Load Schedule From File",
+ "CR Schedule Input Switch": "📋 CR Schedule Input Switch",
+ "CR Bit Schedule": "📋 CR Bit Schedule",
+ # Schedulers
+ "CR Simple Value Scheduler": "📑 CR Simple Value Scheduler",
+ "CR Simple Text Scheduler": "📑 CR Simple Text Scheduler",
+ "CR Value Scheduler": "📑 CR Value Scheduler",
+ "CR Text Scheduler": "📑 CR Text Scheduler",
+ "CR Load Scheduled Models": "📑 CR Load Scheduled Models",
+ "CR Load Scheduled LoRAs": "📑 CR Load Scheduled LoRAs",
+ "CR Prompt Scheduler": "📑 CR Prompt Scheduler",
+ "CR Simple Prompt Scheduler": "📑 CR Simple Prompt Scheduler",
+ # Prompt
+ "CR Keyframe List": "📝 CR Keyframe List",
+ #"CR Load Prompt Style": "📝 CR Load Prompt Style",
+ "CR Encode Scheduled Prompts": "📝 CR Encode Scheduled Prompts",
+ # Interpolation
+ "CR Gradient Float": "🔢 CR Gradient Float",
+ "CR Gradient Integer": "🔢 CR Gradient Integer",
+ "CR Increment Float": "🔢 CR Increment Float",
+ "CR Increment Integer": "🔢 CR Increment Integer",
+ "CR Interpolate Latents": "🔢 CR Interpolate Latents",
+ # Utils
+ "CR Debatch Frames": "🛠️ CR Debatch Frames",
+ "CR Current Frame": "🛠️ CR Current Frame",
+ # IO
+ "CR Load Animation Frames": "⌨️ CR Load Animation Frames",
+ "CR Load Flow Frames": "⌨️ CR Load Flow Frames",
+ "CR Output Flow Frames": "⌨️ CR Output Flow Frames",
+ ### Legacy
+ "CR Prompt List Keyframes": "CR Prompt List Keyframes (Legacy)",
+ "CR Simple Prompt List": "CR Simple Prompt List (Legacy)",
+ "CR Simple Prompt List Keyframes": "CR Simple Prompt List Keyframes (Legacy)",
+ "CR Cycle Models": "CR Cycle Models (Legacy)",
+ "CR Cycle LoRAs": "CR Cycle LoRAs (Legacy)",
+ "CR Cycle Text": "CR Cycle Text (Legacy)",
+ "CR Cycle Text Simple": "CR Cycle Text Simple (Legacy)",
+ "CR Cycle Images": "CR Cycle Images (Legacy)",
+ "CR Cycle Images Simple": "CR Cycle Images Simple (Legacy)",
+ "CR Model List": "CR Model List (Legacy)",
+ "CR LoRA List": "CR LoRA List (Legacy)",
+ "CR Text List Simple": "CR Text List Simple (Legacy)",
+ "CR Image List": "CR Image List (Legacy)",
+ "CR Image List Simple": "CR Image List Simple (Legacy)",
+ "CR Input Text List": "CR Input Text List (Legacy)",
+}
diff --git a/docs/hel-892/tts-reference/cr__nodes__nodes_core.py b/docs/hel-892/tts-reference/cr__nodes__nodes_core.py
new file mode 100644
index 00000000..02af795e
--- /dev/null
+++ b/docs/hel-892/tts-reference/cr__nodes__nodes_core.py
@@ -0,0 +1,431 @@
+#---------------------------------------------------------------------------------------------------------------------#
+# Comfyroll Studio custom nodes by RockOfFire and Akatsuzi https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes
+# for ComfyUI https://github.com/comfyanonymous/ComfyUI
+#---------------------------------------------------------------------------------------------------------------------#
+
+import torch
+import numpy as np
+import os
+import sys
+import csv
+import comfy.sd
+import json
+import folder_paths
+import typing as tg
+import datetime
+import io
+from server import PromptServer, BinaryEventTypes
+#from nodes import common_ksampler
+from PIL import Image
+from PIL.PngImagePlugin import PngInfo
+from pathlib import Path
+from ..categories import icons
+
+#---------------------------------------------------------------------------------------------------------------------#
+# Core Nodes
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_ImageOutput:
+ def __init__(self):
+ self.output_dir = folder_paths.get_output_directory()
+ self.type = "output"
+
+ @classmethod
+ def INPUT_TYPES(cls):
+
+ presets = ["None", "yyyyMMdd"]
+
+ return {"required":
+ {"images": ("IMAGE", ),
+ "output_type": (["Preview", "Save", "UI (no batch)"],),
+ "filename_prefix": ("STRING", {"default": "CR"}),
+ "prefix_presets": (presets, ),
+ "file_format": (["png", "jpg", "webp", "tif"],),
+ },
+ "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
+ "optional":
+ {"trigger": ("BOOLEAN", {"default": False},),
+ }
+ }
+
+ RETURN_TYPES = ("BOOLEAN", )
+ RETURN_NAMES = ("trigger", )
+ FUNCTION = "save_images"
+ OUTPUT_NODE = True
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def save_images(self, images, file_format, prefix_presets, filename_prefix="CR",
+ trigger=False, output_type="Preview", prompt=None, extra_pnginfo=None):
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-image-output"
+
+ def map_filename(filename):
+ prefix_len = len(os.path.basename(filename_prefix))
+ prefix = filename[:prefix_len + 1]
+ try:
+ digits = int(filename[prefix_len + 1:].split('_')[0])
+ except:
+ digits = 0
+ return (digits, prefix)
+
+ if output_type == "Save":
+ self.output_dir = folder_paths.get_output_directory()
+ self.type = "output"
+ elif output_type == "Preview":
+ self.output_dir = folder_paths.get_temp_directory()
+ self.type = "temp"
+
+ date_formats = {
+ 'yyyyMMdd': lambda d: '{}{:02d}{:02d}'.format(str(d.year), d.month, d.day),
+ }
+
+ current_datetime = datetime.datetime.now()
+
+ for format_key, format_lambda in date_formats.items():
+ preset_prefix = f"{format_lambda(current_datetime)}"
+
+ if prefix_presets != "None":
+ filename_prefix = filename_prefix + "_" + preset_prefix
+
+ if filename_prefix[0] == "_":
+ filename_prefix = filename_prefix[1:]
+
+ subfolder = os.path.dirname(os.path.normpath(filename_prefix))
+ filename = os.path.basename(os.path.normpath(filename_prefix))
+
+ full_output_folder = os.path.join(self.output_dir, subfolder)
+
+ if os.path.commonpath((self.output_dir, os.path.abspath(full_output_folder))) != self.output_dir:
+ return {}
+
+ try:
+ counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
+ except ValueError:
+ counter = 1
+ except FileNotFoundError:
+ os.makedirs(full_output_folder, exist_ok=True)
+ counter = 1
+
+ if output_type == "UI (no batch)":
+ # based on ETN_SendImageWebSocket
+ results = []
+ for tensor in images:
+ array = 255.0 * tensor.cpu().numpy()
+ image = Image.fromarray(np.clip(array, 0, 255).astype(np.uint8))
+
+ server = PromptServer.instance
+ server.send_sync(
+ BinaryEventTypes.UNENCODED_PREVIEW_IMAGE,
+ ["PNG", image, None],
+ server.client_id,
+ )
+ results.append(
+ {"source": "websocket", "content-type": "image/png", "type": "output"}
+ )
+ return {"ui": {"images": results}}
+ else:
+ results = list()
+ for image in images:
+ i = 255. * image.cpu().numpy()
+ img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
+ metadata = PngInfo()
+ if prompt is not None:
+ metadata.add_text("prompt", json.dumps(prompt))
+ if extra_pnginfo is not None:
+ for x in extra_pnginfo:
+ metadata.add_text(x, json.dumps(extra_pnginfo[x]))
+
+ file_name = f"{filename}_{counter:05}_.{file_format}"
+
+ img_params = {'png': {'compress_level': 4},
+ 'webp': {'method': 6, 'lossless': False, 'quality': 80},
+ 'jpg': {'format': 'JPEG'},
+ 'tif': {'format': 'TIFF'}
+ }
+
+ resolved_image_path = os.path.join(full_output_folder, file_name)
+
+ img.save(resolved_image_path, **img_params[file_format], pnginfo=metadata)
+ results.append({
+ "filename": file_name,
+ "subfolder": subfolder,
+ "type": self.type
+ })
+ counter += 1
+
+ return { "ui": { "images": results }, "result": (trigger, show_help,) }
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_Seed:
+
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff})}}
+
+ RETURN_TYPES = ("INT", "STRING", )
+ RETURN_NAMES = ("seed", "show_help", )
+ FUNCTION = "seedint"
+ OUTPUT_NODE = True
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ @staticmethod
+ def seedint(seed):
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-seed"
+ return (seed, show_help,)
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_LatentBatchSize:
+
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {"latent": ("LATENT", ),
+ "batch_size": ("INT", {"default": 2, "min": 1, "max": 999, "step": 1}),
+ }
+ }
+
+ RETURN_TYPES = ("LATENT", )
+ FUNCTION = "batchsize"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def batchsize(self, latent: tg.Sequence[tg.Mapping[tg.Text, torch.Tensor]], batch_size: int):
+ samples = latent['samples']
+ shape = samples.shape
+
+ sample_list = [samples] + [
+ torch.clone(samples) for _ in range(batch_size - 1)
+ ]
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-latent-batch-size"
+
+ return ({
+ 'samples': torch.cat(sample_list),
+ }, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_PromptText:
+
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "prompt": ("STRING", {"default": "prompt", "multiline": True})
+ }
+ }
+
+ RETURN_TYPES = ("STRING", "STRING", )
+ RETURN_NAMES = ("prompt", "show_help", )
+ FUNCTION = "get_value"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def get_value(self, prompt):
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-text"
+
+ return (prompt, show_help, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_CombinePrompt:
+
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ },
+ "optional": {
+ "part1": ("STRING", {"default": "", "multiline": True}),
+ "part2": ("STRING", {"default": "", "multiline": True}),
+ "part3": ("STRING", {"default": "", "multiline": True}),
+ "part4": ("STRING", {"default": "", "multiline": True}),
+ "separator": ("STRING", {"default": ",", "multiline": False}),
+ }
+ }
+
+ RETURN_TYPES = ("STRING", "STRING", )
+ RETURN_NAMES = ("prompt", "show_help", )
+ FUNCTION = "get_value"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def get_value(self, part1="", part2="", part3="", part4="", separator=""):
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-prompt-parts"
+
+ prompt = part1 + separator + part2 + separator + part3 + separator + part4
+
+ return (prompt, show_help, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_ConditioningMixer:
+
+ @classmethod
+ def INPUT_TYPES(cls):
+
+ mix_methods = ["Combine", "Average", "Concatenate"]
+
+ return {"required":
+ {"conditioning_1": ("CONDITIONING", ),
+ "conditioning_2": ("CONDITIONING", ),
+ "mix_method": (mix_methods, ),
+ "average_strength": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}),
+ }
+ }
+
+ RETURN_TYPES = ("CONDITIONING", "STRING", )
+ RETURN_NAMES = ("CONDITIONING", "show_help", )
+ FUNCTION = "conditioning"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def conditioning(self, mix_method, conditioning_1, conditioning_2, average_strength):
+
+ conditioning_from = conditioning_1
+ conditioning_to = conditioning_2
+ conditioning_to_strength = average_strength
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-conditioning-mixer"
+
+ if mix_method == "Combine":
+ return (conditioning_1 + conditioning_2, show_help, )
+
+ if mix_method == "Average":
+
+ out = []
+
+ if len(conditioning_from) > 1:
+ print("Warning: ConditioningAverage conditioning_from contains more than 1 cond, only the first one will actually be applied to conditioning_to.")
+
+ cond_from = conditioning_from[0][0]
+ pooled_output_from = conditioning_from[0][1].get("pooled_output", None)
+
+ for i in range(len(conditioning_to)):
+ t1 = conditioning_to[i][0]
+ pooled_output_to = conditioning_to[i][1].get("pooled_output", pooled_output_from)
+ t0 = cond_from[:,:t1.shape[1]]
+ if t0.shape[1] < t1.shape[1]:
+ t0 = torch.cat([t0] + [torch.zeros((1, (t1.shape[1] - t0.shape[1]), t1.shape[2]))], dim=1)
+
+ tw = torch.mul(t1, conditioning_to_strength) + torch.mul(t0, (1.0 - conditioning_to_strength))
+ t_to = conditioning_to[i][1].copy()
+ if pooled_output_from is not None and pooled_output_to is not None:
+ t_to["pooled_output"] = torch.mul(pooled_output_to, conditioning_to_strength) + torch.mul(pooled_output_from, (1.0 - conditioning_to_strength))
+ elif pooled_output_from is not None:
+ t_to["pooled_output"] = pooled_output_from
+
+ n = [tw, t_to]
+ out.append(n)
+ return (out, show_help, )
+
+ if mix_method == "Concatenate":
+
+ out = []
+
+ if len(conditioning_from) > 1:
+ print("Warning: ConditioningConcat conditioning_from contains more than 1 cond, only the first one will actually be applied to conditioning_to.")
+
+ cond_from = conditioning_from[0][0]
+
+ for i in range(len(conditioning_to)):
+ t1 = conditioning_to[i][0]
+ tw = torch.cat((t1, cond_from),1)
+ n = [tw, conditioning_to[i][1].copy()]
+ out.append(n)
+ return (out, show_help, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+class CR_SelectModel:
+
+ @classmethod
+ def INPUT_TYPES(cls):
+
+ checkpoint_files = ["None"] + folder_paths.get_filename_list("checkpoints")
+
+ return {"required": {"ckpt_name1": (checkpoint_files,),
+ "ckpt_name2": (checkpoint_files,),
+ "ckpt_name3": (checkpoint_files,),
+ "ckpt_name4": (checkpoint_files,),
+ "ckpt_name5": (checkpoint_files,),
+ "select_model": ("INT", {"default": 1, "min": 1, "max": 5}),
+ }
+ }
+
+
+ RETURN_TYPES = ("MODEL", "CLIP", "VAE", "STRING", "STRING", )
+ RETURN_NAMES = ("MODEL", "CLIP", "VAE", "ckpt_name", "show_help", )
+ FUNCTION = "select_model"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def select_model(self, ckpt_name1, ckpt_name2, ckpt_name3, ckpt_name4, ckpt_name5, select_model):
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-select-model"
+
+ # Initialise the list
+ model_list = list()
+
+ if select_model == 1:
+ model_name = ckpt_name1
+ elif select_model == 2:
+ model_name = ckpt_name2
+ elif select_model == 3:
+ model_name = ckpt_name3
+ elif select_model == 4:
+ model_name = ckpt_name4
+ elif select_model == 5:
+ model_name = ckpt_name5
+
+ if model_name == "None":
+ print(f"CR Select Model: No model selected")
+ return()
+
+ ckpt_path = folder_paths.get_full_path("checkpoints", model_name)
+ model, clip, vae, clipvision = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True,
+ embedding_directory=folder_paths.get_folder_paths("embeddings"))
+
+ return (model, clip, vae, model_name, show_help, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+# based on Jags111 CircularVAEDecode
+class CR_VAEDecode:
+
+ @classmethod
+ def INPUT_TYPES(s):
+
+ return {"required": {
+ "samples": ("LATENT", ),
+ "vae": ("VAE", ),
+ "tiled": ("BOOLEAN", {"default": False}),
+ "circular": ("BOOLEAN", {"default": False}),
+ }
+ }
+ RETURN_TYPES = ("IMAGE", "STRING", )
+ RETURN_NAMES = ("IMAGE", "show_help", )
+ FUNCTION = "vae_decode"
+ CATEGORY = icons.get("Comfyroll/Essential/Core")
+
+ def vae_decode(self, samples, vae, circular=False, tiled=False):
+
+ show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Core-Nodes#cr-vae-decode"
+
+ if circular == True:
+ for layer in [layer for layer in vae.first_stage_model.modules() if isinstance(layer, torch.nn.Conv2d)]:
+ layer.padding_mode = "circular"
+
+ if tiled == True:
+ c = vae.decode_tiled(samples["samples"], tile_x=512, tile_y=512, )
+ else:
+ c = vae.decode(samples["samples"])
+
+ return (c, show_help, )
+
+#---------------------------------------------------------------------------------------------------------------------#
+# MAPPINGS
+#---------------------------------------------------------------------------------------------------------------------#
+# For reference only, actual mappings are in __init__.py
+'''
+NODE_CLASS_MAPPINGS = {
+ ### Other
+ "CR Image Output": CR_ImageOutput,
+ "CR Latent Batch Size": CR_LatentBatchSize,
+ "CR Seed": CR_Seed,
+ "CR Prompt Text": CR_PromptText,
+ "CR Combine Prompt": CR_CombinePrompt,
+ "CR Conditioning Mixer": CR_ConditioningMixer,
+ "CR Select Model": CR_SelectModel,
+ "CR VAE Decode": CR_VAEDecode,
+}
+'''
+
diff --git a/docs/hel-892/tts-reference/dialog-commit.json b/docs/hel-892/tts-reference/dialog-commit.json
new file mode 100644
index 00000000..a8fc39d9
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog-commit.json
@@ -0,0 +1 @@
+{"sha":"0c20c6b9ac22ecc4b5525de651fca0776a382dd3","node_id":"C_kwDOQ_fZq9oAKDBjMjBjNmI5YWMyMmVjYzRiNTUyNWRlNjUxZmNhMDc3NmEzODJkZDM","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/0c20c6b9ac22ecc4b5525de651fca0776a382dd3","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/0c20c6b9ac22ecc4b5525de651fca0776a382dd3","author":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-25T18:30:23Z"},"committer":{"name":"AICodeTudou","email":"411011819@qq.com","date":"2026-01-25T18:30:23Z"},"tree":{"sha":"6da1640966511fb020ea54c2f3f20a5027907b14","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/6da1640966511fb020ea54c2f3f20a5027907b14"},"message":"update file","parents":[{"sha":"c513c371bd0cd3b95eb5313a29f9c3dacb84566d","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/commits/c513c371bd0cd3b95eb5313a29f9c3dacb84566d","html_url":"https://github.com/AICoderTudou/ComfyUI-TD-Qwen3TTS/commit/c513c371bd0cd3b95eb5313a29f9c3dacb84566d"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
\ No newline at end of file
diff --git a/docs/hel-892/tts-reference/dialog-tree.json b/docs/hel-892/tts-reference/dialog-tree.json
new file mode 100644
index 00000000..394d6531
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog-tree.json
@@ -0,0 +1 @@
+{"sha":"0c20c6b9ac22ecc4b5525de651fca0776a382dd3","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/0c20c6b9ac22ecc4b5525de651fca0776a382dd3","tree":[{"path":"LICENSE","mode":"100644","type":"blob","sha":"377b1cfa01684d2d02891c9f149d32b44bded68f","size":10173,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/377b1cfa01684d2d02891c9f149d32b44bded68f"},{"path":"Qwen3-TTS","mode":"040000","type":"tree","sha":"1e8c3d208c633ec2ffdf11781a606560b1e3a531","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/1e8c3d208c633ec2ffdf11781a606560b1e3a531"},{"path":"Qwen3-TTS/LICENSE","mode":"100644","type":"blob","sha":"c347eb5ec781d2702623e8e2b5923fa1a766a64d","size":11343,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/c347eb5ec781d2702623e8e2b5923fa1a766a64d"},{"path":"Qwen3-TTS/MANIFEST.in","mode":"100644","type":"blob","sha":"aa79178f07a544dc61f85c50516db6825f6438f4","size":227,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/aa79178f07a544dc61f85c50516db6825f6438f4"},{"path":"Qwen3-TTS/README.md","mode":"100644","type":"blob","sha":"c7659f42670aca3ba68ea55d50648b8dedb76b62","size":60152,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/c7659f42670aca3ba68ea55d50648b8dedb76b62"},{"path":"Qwen3-TTS/assets","mode":"040000","type":"tree","sha":"a2b3c301fceb162c6629e937c106751ca0e6a186","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/a2b3c301fceb162c6629e937c106751ca0e6a186"},{"path":"Qwen3-TTS/assets/Qwen3_TTS.pdf","mode":"100644","type":"blob","sha":"69e84f79aa2365dac881876b38c295ca141b2d13","size":8044886,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/69e84f79aa2365dac881876b38c295ca141b2d13"},{"path":"Qwen3-TTS/examples","mode":"040000","type":"tree","sha":"7f3b86ed51142568f4cf7a8ef35e59a9bbb16d22","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/7f3b86ed51142568f4cf7a8ef35e59a9bbb16d22"},{"path":"Qwen3-TTS/examples/test_model_12hz_base.py","mode":"100644","type":"blob","sha":"ec7ea4b59283c31f8af5f4a95a17857c3c907345","size":6427,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/ec7ea4b59283c31f8af5f4a95a17857c3c907345"},{"path":"Qwen3-TTS/examples/test_model_12hz_custom_voice.py","mode":"100644","type":"blob","sha":"560ecd1300e82544b1dcba163bb038e7a9bd5a8e","size":2275,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/560ecd1300e82544b1dcba163bb038e7a9bd5a8e"},{"path":"Qwen3-TTS/examples/test_model_12hz_voice_design.py","mode":"100644","type":"blob","sha":"7e7553918813894fba39812556b743d82a6eaed8","size":2546,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/7e7553918813894fba39812556b743d82a6eaed8"},{"path":"Qwen3-TTS/examples/test_tokenizer_12hz.py","mode":"100644","type":"blob","sha":"595809e3cd52059178f1d90ea76f6535ed9d0eff","size":2683,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/595809e3cd52059178f1d90ea76f6535ed9d0eff"},{"path":"Qwen3-TTS/finetuning","mode":"040000","type":"tree","sha":"6e0891e240c301bd381da9b4d335d2292076242b","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/6e0891e240c301bd381da9b4d335d2292076242b"},{"path":"Qwen3-TTS/finetuning/README.md","mode":"100644","type":"blob","sha":"7cd48b0fd5ba38c71f64ee946424bee4762d3407","size":3163,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/7cd48b0fd5ba38c71f64ee946424bee4762d3407"},{"path":"Qwen3-TTS/finetuning/dataset.py","mode":"100644","type":"blob","sha":"f7c1cbe7a79537c8ec5a3a91bdc725d59e253543","size":8664,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/f7c1cbe7a79537c8ec5a3a91bdc725d59e253543"},{"path":"Qwen3-TTS/finetuning/prepare_data.py","mode":"100644","type":"blob","sha":"c19c4a58a797e72360e56e0e9a49b4949d832937","size":2273,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/c19c4a58a797e72360e56e0e9a49b4949d832937"},{"path":"Qwen3-TTS/finetuning/sft_12hz.py","mode":"100644","type":"blob","sha":"9ed8c480e6acf0838d0628197231198864bf9642","size":6878,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/9ed8c480e6acf0838d0628197231198864bf9642"},{"path":"Qwen3-TTS/pyproject.toml","mode":"100644","type":"blob","sha":"b2b180ad1d0360c6f370da26e4a7817ed47d9a8b","size":1099,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/b2b180ad1d0360c6f370da26e4a7817ed47d9a8b"},{"path":"Qwen3-TTS/qwen_tts","mode":"040000","type":"tree","sha":"f6227ef6405b774426540f8dfbdd60fdb7583e23","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/f6227ef6405b774426540f8dfbdd60fdb7583e23"},{"path":"Qwen3-TTS/qwen_tts/__init__.py","mode":"100644","type":"blob","sha":"848c8ddac02841c1d2a6cc7af9be3ce871da8681","size":839,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/848c8ddac02841c1d2a6cc7af9be3ce871da8681"},{"path":"Qwen3-TTS/qwen_tts/__main__.py","mode":"100644","type":"blob","sha":"315d8da8ba9f63ec38023c371841029a0a2faf92","size":800,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/315d8da8ba9f63ec38023c371841029a0a2faf92"},{"path":"Qwen3-TTS/qwen_tts/__pycache__","mode":"040000","type":"tree","sha":"29c864e56617b31531e26feb2c979cf455e80cf7","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/29c864e56617b31531e26feb2c979cf455e80cf7"},{"path":"Qwen3-TTS/qwen_tts/__pycache__/__init__.cpython-311.pyc","mode":"100644","type":"blob","sha":"808a6dcf86a77384b30610a3174ec4a425c154b2","size":490,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/808a6dcf86a77384b30610a3174ec4a425c154b2"},{"path":"Qwen3-TTS/qwen_tts/cli","mode":"040000","type":"tree","sha":"4b93b124105bd835d9734891dd1ce84629fdffb3","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/4b93b124105bd835d9734891dd1ce84629fdffb3"},{"path":"Qwen3-TTS/qwen_tts/cli/demo.py","mode":"100644","type":"blob","sha":"e267861d198d116088770933988cdd556cf7ecca","size":29160,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e267861d198d116088770933988cdd556cf7ecca"},{"path":"Qwen3-TTS/qwen_tts/core","mode":"040000","type":"tree","sha":"c511b97fe1f6a0b0d304d15b6c3a9e90b47f854e","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/c511b97fe1f6a0b0d304d15b6c3a9e90b47f854e"},{"path":"Qwen3-TTS/qwen_tts/core/__init__.py","mode":"100644","type":"blob","sha":"66642361c66ce57c3e0f4dcad0acd6a73a7846a0","size":990,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/66642361c66ce57c3e0f4dcad0acd6a73a7846a0"},{"path":"Qwen3-TTS/qwen_tts/core/__pycache__","mode":"040000","type":"tree","sha":"0440a80bbe68cb81faf0dabad93281fb8acddf68","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/0440a80bbe68cb81faf0dabad93281fb8acddf68"},{"path":"Qwen3-TTS/qwen_tts/core/__pycache__/__init__.cpython-311.pyc","mode":"100644","type":"blob","sha":"8f7e4aa97f66ef30d4d04787975361c810862d2d","size":661,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/8f7e4aa97f66ef30d4d04787975361c810862d2d"},{"path":"Qwen3-TTS/qwen_tts/core/models","mode":"040000","type":"tree","sha":"cde7994914c14ed65ff7b6ab6f6aa4d3b86e6ba4","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/cde7994914c14ed65ff7b6ab6f6aa4d3b86e6ba4"},{"path":"Qwen3-TTS/qwen_tts/core/models/__init__.py","mode":"100644","type":"blob","sha":"f376f684ccd2d5060d6738d7ccf8871b4c9e4a38","size":807,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/f376f684ccd2d5060d6738d7ccf8871b4c9e4a38"},{"path":"Qwen3-TTS/qwen_tts/core/models/__pycache__","mode":"040000","type":"tree","sha":"f330ae2f5b8bf0a190b045bcf876a89b4db2204f","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/f330ae2f5b8bf0a190b045bcf876a89b4db2204f"},{"path":"Qwen3-TTS/qwen_tts/core/models/__pycache__/__init__.cpython-311.pyc","mode":"100644","type":"blob","sha":"b5ad8e511bd5662351d90e32360f732b7db1ee7c","size":458,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/b5ad8e511bd5662351d90e32360f732b7db1ee7c"},{"path":"Qwen3-TTS/qwen_tts/core/models/__pycache__/configuration_qwen3_tts.cpython-311.pyc","mode":"100644","type":"blob","sha":"f7346aa468e0f4d555d74ece5ed0dece0f38893e","size":24961,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/f7346aa468e0f4d555d74ece5ed0dece0f38893e"},{"path":"Qwen3-TTS/qwen_tts/core/models/__pycache__/modeling_qwen3_tts.cpython-311.pyc","mode":"100644","type":"blob","sha":"14d7a9cb6f9a21d6b51dfbe9369b3746c0bad269","size":120043,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/14d7a9cb6f9a21d6b51dfbe9369b3746c0bad269"},{"path":"Qwen3-TTS/qwen_tts/core/models/__pycache__/processing_qwen3_tts.cpython-311.pyc","mode":"100644","type":"blob","sha":"d655e8409332259041bbc8f556c7c59283e97b1d","size":5010,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/d655e8409332259041bbc8f556c7c59283e97b1d"},{"path":"Qwen3-TTS/qwen_tts/core/models/configuration_qwen3_tts.py","mode":"100644","type":"blob","sha":"0bd426db0fb6410a21b0649c7b5804739d600106","size":26428,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/0bd426db0fb6410a21b0649c7b5804739d600106"},{"path":"Qwen3-TTS/qwen_tts/core/models/modeling_qwen3_tts.py","mode":"100644","type":"blob","sha":"4f1261b7a0e09d80e3d0ce5689984d0b0dd7d0a7","size":99825,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/4f1261b7a0e09d80e3d0ce5689984d0b0dd7d0a7"},{"path":"Qwen3-TTS/qwen_tts/core/models/processing_qwen3_tts.py","mode":"100644","type":"blob","sha":"bed9bff76b26ffb674bab7c3ce6264a46891d0d7","size":4022,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/bed9bff76b26ffb674bab7c3ce6264a46891d0d7"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz","mode":"040000","type":"tree","sha":"abd8f9bbe7aee071383dcfe600f062e317618569","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/abd8f9bbe7aee071383dcfe600f062e317618569"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz/__pycache__","mode":"040000","type":"tree","sha":"121d746590406599b8596d13a937233814dc11a2","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/121d746590406599b8596d13a937233814dc11a2"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz/__pycache__/configuration_qwen3_tts_tokenizer_v2.cpython-311.pyc","mode":"100644","type":"blob","sha":"e6c5c522629b6fe5b5fe8a8bb6f6c13b12eafb6d","size":8065,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e6c5c522629b6fe5b5fe8a8bb6f6c13b12eafb6d"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz/__pycache__/modeling_qwen3_tts_tokenizer_v2.cpython-311.pyc","mode":"100644","type":"blob","sha":"1414caa003adf8adb0749d4c5d00056c6d2c7bbe","size":60657,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/1414caa003adf8adb0749d4c5d00056c6d2c7bbe"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz/configuration_qwen3_tts_tokenizer_v2.py","mode":"100644","type":"blob","sha":"82658a5da323deebdbee893d5c8e8c448a694ab5","size":7946,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/82658a5da323deebdbee893d5c8e8c448a694ab5"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_12hz/modeling_qwen3_tts_tokenizer_v2.py","mode":"100644","type":"blob","sha":"a91b104b18b514034b9e0296422fd299b820fc17","size":40465,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/a91b104b18b514034b9e0296422fd299b820fc17"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz","mode":"040000","type":"tree","sha":"2265e03eab8f650577fe8e0d3b097ca6579343dc","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/2265e03eab8f650577fe8e0d3b097ca6579343dc"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/__pycache__","mode":"040000","type":"tree","sha":"243299cbebcc3256d649036858fa116fd20a05f0","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/243299cbebcc3256d649036858fa116fd20a05f0"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/__pycache__/configuration_qwen3_tts_tokenizer_v1.cpython-311.pyc","mode":"100644","type":"blob","sha":"ff30123d3184c2f16648aee7d621cc855b8f2706","size":14927,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/ff30123d3184c2f16648aee7d621cc855b8f2706"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/__pycache__/modeling_qwen3_tts_tokenizer_v1.cpython-311.pyc","mode":"100644","type":"blob","sha":"e9d6dc6315208b1255e5fa69245b9c8ce6152866","size":81660,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e9d6dc6315208b1255e5fa69245b9c8ce6152866"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/configuration_qwen3_tts_tokenizer_v1.py","mode":"100644","type":"blob","sha":"50751dbf63ed0d5226db67e83693bb0583004307","size":14494,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/50751dbf63ed0d5226db67e83693bb0583004307"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/modeling_qwen3_tts_tokenizer_v1.py","mode":"100644","type":"blob","sha":"8a38d92b176e192d4fbe87fb07badaf50d2170a8","size":56472,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/8a38d92b176e192d4fbe87fb07badaf50d2170a8"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq","mode":"040000","type":"tree","sha":"47173f9dd2a5576a79f801044c3a07d80e0145b0","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/47173f9dd2a5576a79f801044c3a07d80e0145b0"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/__pycache__","mode":"040000","type":"tree","sha":"f3a18dcaac048bc8588f67a13306afc6bd99c1e4","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/f3a18dcaac048bc8588f67a13306afc6bd99c1e4"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/__pycache__/core_vq.cpython-311.pyc","mode":"100644","type":"blob","sha":"08d72221f9d5493032f5067247132793aad59bba","size":28569,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/08d72221f9d5493032f5067247132793aad59bba"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/__pycache__/speech_vq.cpython-311.pyc","mode":"100644","type":"blob","sha":"00822cda87d12f8bc5a290ab2fe1c7baa4a23a29","size":21581,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/00822cda87d12f8bc5a290ab2fe1c7baa4a23a29"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/__pycache__/whisper_encoder.cpython-311.pyc","mode":"100644","type":"blob","sha":"7dd513d8e1c16051f8c2058c4ebb6350678a33e8","size":24332,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/7dd513d8e1c16051f8c2058c4ebb6350678a33e8"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/assets","mode":"040000","type":"tree","sha":"bb12932dd50b5f502d12e3b8cc571672f1bf6cc1","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/bb12932dd50b5f502d12e3b8cc571672f1bf6cc1"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/assets/mel_filters.npz","mode":"100644","type":"blob","sha":"28ea26909dbdfd608aef67afc4d74d7961ae4bb6","size":4271,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/28ea26909dbdfd608aef67afc4d74d7961ae4bb6"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/core_vq.py","mode":"100644","type":"blob","sha":"6a793c2d581e9ff705066d801f9912c14c3b07f0","size":20074,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/6a793c2d581e9ff705066d801f9912c14c3b07f0"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/speech_vq.py","mode":"100644","type":"blob","sha":"e2063034453b5a06076ee35b9a73208f0d5ed0f5","size":14833,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e2063034453b5a06076ee35b9a73208f0d5ed0f5"},{"path":"Qwen3-TTS/qwen_tts/core/tokenizer_25hz/vq/whisper_encoder.py","mode":"100644","type":"blob","sha":"a1c97bbc308220133a7c451756d21c2bbf95e8c0","size":14351,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/a1c97bbc308220133a7c451756d21c2bbf95e8c0"},{"path":"Qwen3-TTS/qwen_tts/inference","mode":"040000","type":"tree","sha":"d4f803278a877428b710b813c06bcb22747badca","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/d4f803278a877428b710b813c06bcb22747badca"},{"path":"Qwen3-TTS/qwen_tts/inference/__pycache__","mode":"040000","type":"tree","sha":"feb6f52d0ec9f03b9f4bfb8e1022dd4e9c02dd0d","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/feb6f52d0ec9f03b9f4bfb8e1022dd4e9c02dd0d"},{"path":"Qwen3-TTS/qwen_tts/inference/__pycache__/qwen3_tts_model.cpython-311.pyc","mode":"100644","type":"blob","sha":"8281b85a603b1f6db33b03f8a608949b98298aaa","size":49645,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/8281b85a603b1f6db33b03f8a608949b98298aaa"},{"path":"Qwen3-TTS/qwen_tts/inference/__pycache__/qwen3_tts_tokenizer.cpython-311.pyc","mode":"100644","type":"blob","sha":"e5b083c6e2da415f9ca7041847abaf1e1886183b","size":22242,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e5b083c6e2da415f9ca7041847abaf1e1886183b"},{"path":"Qwen3-TTS/qwen_tts/inference/qwen3_tts_model.py","mode":"100644","type":"blob","sha":"641329b28c9cb1fa1422278e503c5050aadbc737","size":37123,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/641329b28c9cb1fa1422278e503c5050aadbc737"},{"path":"Qwen3-TTS/qwen_tts/inference/qwen3_tts_tokenizer.py","mode":"100644","type":"blob","sha":"eae969d945ea0a6a8b76796764417c467fe56d25","size":15698,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/eae969d945ea0a6a8b76796764417c467fe56d25"},{"path":"README.md","mode":"100644","type":"blob","sha":"e3754cc1c715ec47b5634d43012bc36611040548","size":7103,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/e3754cc1c715ec47b5634d43012bc36611040548"},{"path":"WorkFlow","mode":"040000","type":"tree","sha":"6feeca599e74b181871c5d3d6dab6fe5f0bffc03","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/6feeca599e74b181871c5d3d6dab6fe5f0bffc03"},{"path":"WorkFlow/Qwen3-TD-TTS.json","mode":"100644","type":"blob","sha":"51a4fc6fccf63461f3f76dcae30e9a6908182af5","size":13367,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/51a4fc6fccf63461f3f76dcae30e9a6908182af5"},{"path":"WorkFlow/qwen3tts-多人对话.json","mode":"100644","type":"blob","sha":"4f6dd4294b5c647060661acc614d4ba225989aa0","size":23510,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/4f6dd4294b5c647060661acc614d4ba225989aa0"},{"path":"__init__.py","mode":"100644","type":"blob","sha":"6ad7029884eb7ff2c491ebd8d0ad10834f79bfe6","size":237,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/6ad7029884eb7ff2c491ebd8d0ad10834f79bfe6"},{"path":"js","mode":"040000","type":"tree","sha":"53b58eb04b9676ab834091c4ca4ed6554d7ba046","url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/trees/53b58eb04b9676ab834091c4ca4ed6554d7ba046"},{"path":"js/batch_speaker.js","mode":"100644","type":"blob","sha":"71e5f8da1047f0e606b4a0a458f76661329d9939","size":10783,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/71e5f8da1047f0e606b4a0a458f76661329d9939"},{"path":"js/multi_dialog.js","mode":"100644","type":"blob","sha":"c60324a1faa88c5bd3b182197c73e8bdd34664fa","size":7788,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/c60324a1faa88c5bd3b182197c73e8bdd34664fa"},{"path":"nodes.py","mode":"100644","type":"blob","sha":"4861124c730b522857bc2b2eed08f8e1017911e2","size":31102,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/4861124c730b522857bc2b2eed08f8e1017911e2"},{"path":"requirements.txt","mode":"100644","type":"blob","sha":"3f440d584a1fcabe8cd0016e355ed1c06ac0b968","size":110,"url":"https://api.github.com/repos/AICoderTudou/ComfyUI-TD-Qwen3TTS/git/blobs/3f440d584a1fcabe8cd0016e355ed1c06ac0b968"}],"truncated":false}
\ No newline at end of file
diff --git a/docs/hel-892/tts-reference/dialog__LICENSE b/docs/hel-892/tts-reference/dialog__LICENSE
new file mode 100644
index 00000000..377b1cfa
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog__LICENSE
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/docs/hel-892/tts-reference/dialog____init__.py b/docs/hel-892/tts-reference/dialog____init__.py
new file mode 100644
index 00000000..6ad70298
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog____init__.py
@@ -0,0 +1,6 @@
+from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
+
+# 声明前端资源目录,确保 js 文件被 ComfyUI 加载
+WEB_DIRECTORY = "./js"
+
+__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY']
diff --git a/docs/hel-892/tts-reference/dialog__js__batch_speaker.js b/docs/hel-892/tts-reference/dialog__js__batch_speaker.js
new file mode 100644
index 00000000..71e5f8da
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog__js__batch_speaker.js
@@ -0,0 +1,254 @@
+import { app } from "../../scripts/app.js";
+
+app.registerExtension({
+ name: "ComfyUI-TD-Qwen3TTS.BatchGenerateSpeaker",
+ async beforeRegisterNodeDef(nodeType, nodeData, app) {
+ if (nodeData.name === "TDQwen3TTSBatchGenerateSpeaker") {
+ const onNodeCreated = nodeType.prototype.onNodeCreated;
+ nodeType.prototype.onNodeCreated = function () {
+ const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
+
+ // Find the speakers_config widget
+ const configWidget = this.widgets.find(w => w.name === "speakers_config");
+
+ // Add "Manage Speakers" button
+ this.addWidget("button", "Manage Speakers", "Edit", (w) => {
+ showSpeakerDialog(this, configWidget);
+ });
+
+ return r;
+ };
+
+ // Handle execution results to get generated audio
+ const onExecuted = nodeType.prototype.onExecuted;
+ nodeType.prototype.onExecuted = function(message) {
+ if (onExecuted) onExecuted.apply(this, arguments);
+
+ // message is the output object. message.batch_outputs comes from our python "ui" return
+ if (message && message.batch_outputs) {
+ this.batchOutputs = message.batch_outputs;
+ // If the dialog is open, we could potentially refresh it,
+ // but for now let's just let the user re-open or if we implement auto-refresh later.
+ // A simple check:
+ const dialog = document.getElementById('td-qwen3-speaker-dialog');
+ if (dialog && dialog.dataset.nodeId == this.id) {
+ // We can trigger a refresh if we exposed the render function
+ // For now, we'll just leave it.
+ }
+ }
+ };
+ }
+ }
+});
+
+function showSpeakerDialog(node, configWidget) {
+ // Remove existing if any
+ const existing = document.getElementById('td-qwen3-speaker-dialog');
+ if (existing) document.body.removeChild(existing);
+
+ const dialog = document.createElement("div");
+ dialog.id = 'td-qwen3-speaker-dialog';
+ dialog.dataset.nodeId = node.id;
+ dialog.style.cssText = `
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background: #222;
+ color: #ddd;
+ padding: 20px;
+ border-radius: 8px;
+ box-shadow: 0 0 20px rgba(0,0,0,0.5);
+ z-index: 10000;
+ width: 900px;
+ max-height: 85vh;
+ display: flex;
+ flex-direction: column;
+ border: 1px solid #444;
+ font-family: sans-serif;
+ `;
+
+ const title = document.createElement("h3");
+ title.innerText = "Manage Speakers (Batch Generate)";
+ title.style.marginTop = "0";
+ dialog.appendChild(title);
+
+ const contentArea = document.createElement("div");
+ contentArea.style.cssText = `
+ flex: 1;
+ overflow-y: auto;
+ margin-bottom: 20px;
+ border: 1px solid #333;
+ padding: 10px;
+ background: #111;
+ `;
+ dialog.appendChild(contentArea);
+
+ // Load existing config
+ let speakers = [];
+ try {
+ if (configWidget && configWidget.value) {
+ speakers = JSON.parse(configWidget.value);
+ }
+ } catch (e) {
+ console.error("Invalid JSON in speakers_config", e);
+ }
+ if (!Array.isArray(speakers)) speakers = [];
+
+ // Function to render list
+ function renderList() {
+ contentArea.innerHTML = "";
+ if (speakers.length === 0) {
+ contentArea.innerHTML = "No speakers defined. Click 'Add Speaker' to start.
";
+ return;
+ }
+
+ speakers.forEach((spk, index) => {
+ const row = document.createElement("div");
+ row.style.cssText = `
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ margin-bottom: 10px;
+ background: #2a2a2a;
+ padding: 10px;
+ border-radius: 4px;
+ `;
+
+ const topRow = document.createElement("div");
+ topRow.style.cssText = "display: flex; gap: 10px; align-items: flex-start; width: 100%;";
+ row.appendChild(topRow);
+
+ // Name
+ const nameGroup = document.createElement("div");
+ nameGroup.style.flex = "1";
+ nameGroup.innerHTML = "";
+ const nameInput = document.createElement("input");
+ nameInput.value = spk.name || "";
+ nameInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px;";
+ nameInput.onchange = (e) => { spk.name = e.target.value; };
+ nameGroup.appendChild(nameInput);
+ topRow.appendChild(nameGroup);
+
+ // Instruct
+ const instructGroup = document.createElement("div");
+ instructGroup.style.flex = "2";
+ instructGroup.innerHTML = "";
+ const instructInput = document.createElement("textarea");
+ instructInput.value = spk.instruct || "";
+ instructInput.rows = 2;
+ instructInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px; resize:vertical;";
+ instructInput.onchange = (e) => { spk.instruct = e.target.value; };
+ instructGroup.appendChild(instructInput);
+ topRow.appendChild(instructGroup);
+
+ // Text
+ const textGroup = document.createElement("div");
+ textGroup.style.flex = "2";
+ textGroup.innerHTML = "";
+ const textInput = document.createElement("textarea");
+ textInput.value = spk.text || "";
+ textInput.rows = 2;
+ textInput.style.cssText = "width:100%; background:#333; color:#fff; border:1px solid #555; padding:4px; resize:vertical;";
+ textInput.onchange = (e) => { spk.text = e.target.value; };
+ textGroup.appendChild(textInput);
+ topRow.appendChild(textGroup);
+
+ // Delete
+ const delBtn = document.createElement("button");
+ delBtn.innerText = "X";
+ delBtn.style.cssText = "background:#800; color:#fff; border:none; padding:5px 10px; cursor:pointer; margin-top:20px;";
+ delBtn.onclick = () => {
+ speakers.splice(index, 1);
+ renderList();
+ };
+ topRow.appendChild(delBtn);
+
+ // Preview Area (if audio exists)
+ // We look up audio from node.batchOutputs by name
+ // Note: If names are duplicated, this might pick the first match.
+ if (node.batchOutputs && spk.name) {
+ // Find latest output for this name?
+ // Or just find one.
+ // Since batchOutputs might accumulate if we don't clear it?
+ // Actually batchOutputs is replaced on each execution.
+ const audioInfo = node.batchOutputs.find(o => o.name === spk.name);
+
+ if (audioInfo) {
+ const audioRow = document.createElement("div");
+ audioRow.style.cssText = "margin-top: 5px; background: #222; padding: 5px; border-radius: 4px; display: flex; align-items: center; gap: 10px;";
+
+ const label = document.createElement("span");
+ label.innerText = "Last Generated Preview:";
+ label.style.fontSize = "12px";
+ label.style.color = "#aaa";
+ audioRow.appendChild(label);
+
+ const audioPlayer = document.createElement("audio");
+ audioPlayer.controls = true;
+ audioPlayer.style.height = "30px";
+ // Construct URL: /view?filename=...&type=...&subfolder=...
+ const params = new URLSearchParams({
+ filename: audioInfo.filename,
+ type: audioInfo.type,
+ subfolder: audioInfo.subfolder || ""
+ });
+ audioPlayer.src = "/view?" + params.toString();
+ audioRow.appendChild(audioPlayer);
+
+ row.appendChild(audioRow);
+ }
+ }
+
+ contentArea.appendChild(row);
+ });
+ }
+
+ renderList();
+
+ // Buttons area
+ const buttons = document.createElement("div");
+ buttons.style.cssText = "display:flex; justify-content:space-between; align-items:center;";
+ dialog.appendChild(buttons);
+
+ const leftBtns = document.createElement("div");
+ buttons.appendChild(leftBtns);
+
+ const addBtn = document.createElement("button");
+ addBtn.innerText = "+ Add Speaker";
+ addBtn.style.cssText = "background:#444; color:#fff; border:none; padding:8px 16px; cursor:pointer; margin-right:10px;";
+ addBtn.onclick = () => {
+ speakers.push({ name: "NewSpeaker", instruct: "A clear voice", text: "Hello world" });
+ renderList();
+ // Scroll to bottom
+ setTimeout(() => contentArea.scrollTop = contentArea.scrollHeight, 10);
+ };
+ leftBtns.appendChild(addBtn);
+
+ const rightBtns = document.createElement("div");
+ buttons.appendChild(rightBtns);
+
+ const cancelBtn = document.createElement("button");
+ cancelBtn.innerText = "Cancel";
+ cancelBtn.style.cssText = "background:transparent; color:#aaa; border:1px solid #444; padding:8px 16px; cursor:pointer; margin-right:10px;";
+ cancelBtn.onclick = () => {
+ document.body.removeChild(dialog);
+ };
+ rightBtns.appendChild(cancelBtn);
+
+ const saveBtn = document.createElement("button");
+ saveBtn.innerText = "Save";
+ saveBtn.style.cssText = "background:#28a745; color:#fff; border:none; padding:8px 24px; cursor:pointer; font-weight:bold;";
+ saveBtn.onclick = () => {
+ if (configWidget) {
+ configWidget.value = JSON.stringify(speakers, null, 2);
+ // Trigger graph change
+ if (node.onResize) node.onResize(node.size);
+ app.graph.setDirtyCanvas(true, true);
+ }
+ document.body.removeChild(dialog);
+ };
+ rightBtns.appendChild(saveBtn);
+
+ document.body.appendChild(dialog);
+}
diff --git a/docs/hel-892/tts-reference/dialog__js__multi_dialog.js b/docs/hel-892/tts-reference/dialog__js__multi_dialog.js
new file mode 100644
index 00000000..c60324a1
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog__js__multi_dialog.js
@@ -0,0 +1,145 @@
+import { app } from "../../scripts/app.js";
+
+app.registerExtension({
+ name: "ComfyUI-TD-Qwen3TTS.MultiDialog",
+ async beforeRegisterNodeDef(nodeType, nodeData, app) {
+ if (nodeData.name === "TDQwen3TTSMultiDialog") {
+ const onConnectionsChange = nodeType.prototype.onConnectionsChange;
+ nodeType.prototype.onConnectionsChange = function (type, index, connected, link_info, slot) {
+ const r = onConnectionsChange ? onConnectionsChange.apply(this, arguments) : undefined;
+
+ // Ensure inputs exist
+ // 确保输入存在
+ if (!this.inputs) return r;
+
+ // 1. Identify all speaker inputs and their indices
+ // 1. 识别所有 speaker 输入及其索引
+ const speakerInputs = [];
+ for(let i=0; i maxExistingNum) maxExistingNum = item.num;
+ if(item.input.link !== undefined && item.input.link !== null) {
+ if(item.num > maxConnectedNum) maxConnectedNum = item.num;
+
+ // NEW LOGIC: Rename input based on upstream node name
+ // 新逻辑:根据上游节点名称重命名输入
+ const linkId = item.input.link;
+ const link = app.graph.links[linkId];
+ if (link) {
+ const originNode = app.graph.getNodeById(link.origin_id);
+ if (originNode && originNode.widgets) {
+ // Look for 'name' widget
+ // 查找 'name' 控件
+ const nameWidget = originNode.widgets.find(w => w.name === "name");
+ if (nameWidget && nameWidget.value) {
+ const newLabel = `${nameWidget.value}`;
+ // Only update if changed to avoid loop/redraw issues
+ // 仅在发生变化时更新,以避免循环/重绘问题
+ if (item.input.label !== newLabel) {
+ item.input.label = newLabel;
+ // Force redraw of this node
+ // 强制重绘此节点
+ if (this.setDirtyCanvas) {
+ this.setDirtyCanvas(true, true);
+ }
+ }
+ }
+ }
+ }
+ } else {
+ // Reset label if disconnected
+ // 如果断开连接,重置标签
+ if (item.input.label) {
+ item.input.label = undefined; // Or null, to revert to name // 或者设为 null,以恢复为名称
+ if (this.setDirtyCanvas) {
+ this.setDirtyCanvas(true, true);
+ }
+ }
+ }
+ }
+
+ // 3. Determine target behavior
+ // 3. 确定目标行为
+ // We want to ensure that if speaker_N is connected, speaker_{N+1} exists.
+ // 我们要确保如果 speaker_N 已连接,则 speaker_{N+1} 存在。
+ // If nothing is connected, we want speaker_1 to exist.
+ // 如果没有任何连接,我们要确保 speaker_1 存在。
+ const targetNum = maxConnectedNum + 1;
+
+ // 4. Add if missing
+ // 4. 如果缺失则添加
+ if (maxExistingNum < targetNum) {
+ // Add intermediate slots if for some reason we jumped (unlikely but safe)
+ // 如果由于某种原因跳过了(不太可能但为了安全起见),添加中间插槽
+ for (let i = maxExistingNum + 1; i <= targetNum; i++) {
+ // console.log("Adding input", `speaker_${i}`);
+ this.addInput(`speaker_${i}`, "SPEAKER");
+ }
+ }
+
+ // 5. Remove if too many (trailing unconnected slots)
+ // 5. 如果过多则移除(末尾未连接的插槽)
+ // We only want to keep up to targetNum.
+ // 我们只想保留到 targetNum。
+ // Any slot > targetNum should be removed IF it is unconnected.
+ // 任何 > targetNum 的插槽如果未连接都应被移除。
+ // We iterate backwards to safely remove by index.
+ // 我们反向迭代以按索引安全移除。
+
+ // Refresh inputs list as we might have added some
+ // 刷新输入列表,因为我们可能添加了一些
+ // Actually, let's just use the current logic:
+ // 实际上,我们就使用当前的逻辑:
+ // Any input named speaker_X where X > targetNum is a candidate for removal.
+ // 任何名为 speaker_X 且 X > targetNum 的输入都是移除的候选对象。
+
+ // Note: Removing inputs changes indices, so we must be careful.
+ // 注意:移除输入会改变索引,所以我们必须小心。
+ // It's best to grab the current list of inputs again.
+ // 最好再次获取当前的输入列表。
+
+ let inputsModified = false;
+
+ // Loop backwards
+ // 反向循环
+ for (let i = this.inputs.length - 1; i >= 0; i--) {
+ const inp = this.inputs[i];
+ if (inp.name.startsWith("speaker_")) {
+ const num = parseInt(inp.name.split("_")[1]);
+ if (num > targetNum) {
+ // Verify it's not connected (double check)
+ // 验证它未连接(再次检查)
+ if (inp.link === undefined || inp.link === null) {
+ // console.log("Removing input", inp.name);
+ this.removeInput(i);
+ inputsModified = true;
+ }
+ }
+ }
+ }
+
+ // If we modified inputs, we might need to notify graph update?
+ // 如果我们修改了输入,可能需要通知图形更新?
+ // Usually not strictly required for inputs but good practice if visual glitches occur.
+ // 通常对于输入不是严格要求的,但如果出现视觉故障,这是一个好的做法。
+
+ return r;
+ };
+ }
+ }
+});
diff --git a/docs/hel-892/tts-reference/dialog__nodes.py b/docs/hel-892/tts-reference/dialog__nodes.py
new file mode 100644
index 00000000..4861124c
--- /dev/null
+++ b/docs/hel-892/tts-reference/dialog__nodes.py
@@ -0,0 +1,701 @@
+import os
+import sys
+import json
+import torch
+import torchaudio
+import random
+import string
+import numpy as np
+import folder_paths
+import zlib
+import ast
+
+# 将父目录添加到路径以允许导入 qwen_tts
+current_dir = os.path.dirname(os.path.abspath(__file__))
+# 添加本地克隆的 cc 目录到 sys.path
+qwen_repo_path = os.path.join(current_dir, "Qwen3-TTS")
+if os.path.exists(qwen_repo_path) and qwen_repo_path not in sys.path:
+ sys.path.append(qwen_repo_path)
+
+parent_dir = os.path.dirname(current_dir)
+if parent_dir not in sys.path:
+ sys.path.append(parent_dir)
+
+try:
+ from qwen_tts.inference.qwen3_tts_model import Qwen3TTSModel
+except ImportError as e:
+ print("\n" + "!" * 50)
+ print("Warning / 警告:")
+ print("Failed to import Qwen3TTS dependencies. / 无法导入 Qwen3TTS 依赖项。")
+ print(f"Error details / 错误详情: {e}")
+ print("\nPlease try the following steps to fix this issue / 请尝试以下步骤解决此问题:")
+ print("1. Open terminal in the node directory / 在节点目录下打开终端:")
+ print(f" cd {os.path.dirname(os.path.abspath(__file__))}")
+ print("2. Install dependencies / 安装依赖:")
+ print(" pip install -r requirements.txt")
+ print("3. If using portable ComfyUI / 如果使用便携版 ComfyUI:")
+ print(" path/to/python_embeded/python.exe -m pip install -r requirements.txt")
+ print("!" * 50 + "\n")
+ pass
+
+def get_all_speakers():
+ speakers = set()
+ qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
+ if os.path.exists(qwen_models_dir):
+ for d in os.listdir(qwen_models_dir):
+ path = os.path.join(qwen_models_dir, d)
+ if os.path.isdir(path):
+ config_path = os.path.join(path, "config.json")
+ if os.path.exists(config_path):
+ try:
+ with open(config_path, "r", encoding="utf-8") as f:
+ config = json.load(f)
+ if "talker_config" in config and "spk_id" in config["talker_config"]:
+ # Capitalize keys for better UI display (e.g. "vivian" -> "Vivian")
+ # This helps match default values like "Vivian" in workflows
+ keys = [k.capitalize() for k in config["talker_config"]["spk_id"].keys()]
+ speakers.update(keys)
+ except Exception as e:
+ print(f"Failed to read config for {d}: {e}")
+
+ if not speakers:
+ return ["Vivian", "Serena", "Ryan"] # Fallback defaults
+
+ return sorted(list(speakers))
+
+KNOWN_MODELS = [
+ "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice",
+ "Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign",
+ "Qwen/Qwen3-TTS-12Hz-1.7B-Base",
+ "Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice",
+ "Qwen/Qwen3-TTS-12Hz-0.6B-Base",
+]
+
+class TDQwen3TTSModelLoader:
+ @classmethod
+ def INPUT_TYPES(s):
+ qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
+ if not os.path.exists(qwen_models_dir):
+ try:
+ os.makedirs(qwen_models_dir, exist_ok=True)
+ except Exception:
+ pass
+
+ # Get existing directories
+ existing_models = []
+ if os.path.exists(qwen_models_dir):
+ existing_models = [d for d in os.listdir(qwen_models_dir) if os.path.isdir(os.path.join(qwen_models_dir, d))]
+
+ # Merge known models and existing models (deduplicate by checking if known model's basename exists)
+ model_list = list(KNOWN_MODELS)
+ for existing in existing_models:
+ # Check if this existing folder is already covered by a known model (by basename)
+ is_known = False
+ for known in KNOWN_MODELS:
+ if known.split("/")[-1] == existing:
+ is_known = True
+ break
+ if not is_known:
+ model_list.append(existing)
+
+ if not model_list:
+ model_list = ["Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"]
+
+ return {
+ "required": {
+ "model_path": (model_list, {"default": "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice"}),
+ "precision": (["bf16", "fp16", "fp32"], {"default": "bf16"}),
+ "device": (["cuda", "cpu"], {"default": "cuda"}),
+ "attn_implementation": (["sdpa", "flash_attention_2", "eager"], {"default": "sdpa"}),
+ "auto_download": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
+ "download_source": (["ModelScope", "HuggingFace"], {"default": "ModelScope"}),
+ }
+ }
+
+ RETURN_TYPES = ("QWEN3_TTS_MODEL",)
+ RETURN_NAMES = ("model",)
+ FUNCTION = "load_model"
+ CATEGORY = "Qwen3TTS"
+
+ def load_model(self, model_path, precision, device, attn_implementation, auto_download, download_source):
+ dtype = torch.bfloat16 if precision == "bf16" else torch.float16 if precision == "fp16" else torch.float32
+
+ print(f"Loading Qwen3-TTS Model from {model_path} (Precision: {precision}, Device: {device}, Attn: {attn_implementation})...")
+
+ qwen_models_dir = os.path.join(folder_paths.models_dir, "Qwen3-TTS-Models")
+
+ # Determine local path
+ if "/" in model_path:
+ local_name = model_path.split("/")[-1]
+ else:
+ local_name = model_path
+
+ local_path = os.path.join(qwen_models_dir, local_name)
+
+ # Check if model exists
+ if not os.path.exists(local_path):
+ if auto_download:
+ print(f"Model not found at {local_path}. Attempting to download from {download_source}...")
+ try:
+ self.download_model(model_path, local_path, download_source)
+ except Exception as e:
+ raise RuntimeError(f"Failed to download model {model_path}: {e}")
+ else:
+ raise FileNotFoundError(f"Model not found at {local_path} and auto_download is disabled. Please enable auto_download or manually place the model in {qwen_models_dir}.")
+
+ print(f"Loading model from {local_path}...")
+ model = Qwen3TTSModel.from_pretrained(
+ local_path,
+ device_map=device,
+ dtype=dtype,
+ attn_implementation=attn_implementation,
+ )
+ return (model,)
+
+ def download_model(self, model_id, local_dir, source):
+ # Handle cases where user selected a custom folder name that isn't a repo ID
+ if "/" not in model_id:
+ # If it's not a repo ID, we can't download it unless we know the mapping.
+ # But our INPUT_TYPES puts Repo IDs in the list.
+ # If user manually typed a folder name, we assume they know what they are doing or it exists.
+ # If it doesn't exist and isn't a repo ID, we can't download.
+ raise ValueError(f"Cannot download '{model_id}' because it does not look like a valid Repo ID (e.g. User/Model).")
+
+ if source == "ModelScope":
+ try:
+ from modelscope import snapshot_download
+ except ImportError:
+ raise ImportError("ModelScope is not installed. Please run: pip install -U modelscope")
+
+ print(f"Downloading {model_id} from ModelScope to {local_dir}...")
+ snapshot_download(model_id, local_dir=local_dir)
+
+ elif source == "HuggingFace":
+ try:
+ from huggingface_hub import snapshot_download
+ except ImportError:
+ raise ImportError("HuggingFace Hub is not installed. Please run: pip install -U huggingface_hub")
+
+ print(f"Downloading {model_id} from HuggingFace to {local_dir}...")
+ snapshot_download(repo_id=model_id, local_dir=local_dir)
+
+class TDQwen3TTSCustomVoice:
+ @classmethod
+ def INPUT_TYPES(s):
+ speakers = get_all_speakers()
+ return {
+ "required": {
+ "model": ("QWEN3_TTS_MODEL",),
+ "text": ("STRING", {"multiline": True, "default": "你好,我是Qwen3-TTS。"}),
+ "speaker": (speakers, {"default": speakers[0] if speakers else "Vivian"}),
+ "language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
+ },
+ "optional": {
+ "instruct": ("STRING", {"multiline": True, "default": ""}),
+ }
+ }
+
+ RETURN_TYPES = ("AUDIO",)
+ RETURN_NAMES = ("audio",)
+ FUNCTION = "generate"
+ CATEGORY = "Qwen3TTS"
+
+ def generate(self, model, text, speaker, language, instruct=""):
+ if language == "Auto":
+ language = None
+
+ print(f"正在为说话人 {speaker} 生成自定义语音...")
+ wavs, sr = model.generate_custom_voice(
+ text=text,
+ speaker=speaker,
+ language=language,
+ instruct=instruct if instruct else None
+ )
+
+ # ComfyUI 音频格式: {'waveform': tensor [batch, channels, samples], 'sample_rate': int}
+ # wavs[0] 是 [samples] (单声道)
+ audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
+ return ({"waveform": audio_tensor, "sample_rate": sr},)
+
+class TDQwen3TTSDefineSpeaker:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "audio": ("AUDIO",),
+ "name": ("STRING", {"default": "MySpeaker"}),
+ }
+ }
+
+ RETURN_TYPES = ("SPEAKER",)
+ RETURN_NAMES = ("speaker",)
+ FUNCTION = "define_speaker"
+ CATEGORY = "Qwen3TTS"
+
+ def define_speaker(self, audio, name):
+ # Remove existing with same name to avoid duplicates/allow override
+ name_clean = name.strip()
+ print(f"Defined speaker '{name_clean}'")
+ return ({"name": name_clean, "audio": audio},)
+
+class TDQwen3TTSBatchGenerateSpeaker:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "model": ("QWEN3_TTS_MODEL",),
+ "speakers_config": ("STRING", {"default": "[]", "multiline": True}), # JSON string (Widget or Input)
+ }
+ }
+
+ RETURN_TYPES = ("SPEAKER_LIST",)
+ RETURN_NAMES = ("speakers",)
+ FUNCTION = "batch_generate"
+ CATEGORY = "Qwen3TTS"
+
+ def batch_generate(self, model, speakers_config):
+ config_list = []
+ if isinstance(speakers_config, list):
+ config_list = speakers_config
+ elif isinstance(speakers_config, str):
+ try:
+ config_list = json.loads(speakers_config)
+ except json.JSONDecodeError:
+ # Try parsing as Python literal (single quotes)
+ try:
+ config_list = ast.literal_eval(speakers_config)
+ if not isinstance(config_list, list):
+ print("Error: speakers_config evaluated to non-list.")
+ return ([],)
+ except (ValueError, SyntaxError):
+ print("Error parsing speakers config. Ensure it is valid JSON or Python List.")
+ return ([],)
+ else:
+ print(f"Error: speakers_config must be a JSON string or a list, got {type(speakers_config)}")
+ return ([],)
+
+ generated_speakers = []
+ batch_outputs = [] # For UI preview
+
+ print(f"Batch generating {len(config_list)} speakers...")
+
+ output_dir = folder_paths.get_temp_directory()
+
+ for item in config_list:
+ name = item.get("name", "").strip()
+ instruct = item.get("instruct", "").strip()
+ text = item.get("text", "").strip()
+
+ if not name or not instruct or not text:
+ print(f"Skipping invalid speaker config: {item}")
+ continue
+
+ print(f"Generating speaker '{name}' with instruct: '{instruct}'...")
+ try:
+ # Use Voice Design logic
+ wavs, sr = model.generate_voice_design(
+ text=text,
+ instruct=instruct,
+ language=None # Auto
+ )
+
+ # Check if wavs is empty or None
+ if not wavs or len(wavs) == 0:
+ print(f"Warning: No audio generated for speaker '{name}'")
+ continue
+
+ # Convert to ComfyUI AUDIO format:
+ wav_data = wavs[0]
+
+ # Ensure it's a tensor
+ if isinstance(wav_data, np.ndarray):
+ wav_tensor = torch.from_numpy(wav_data)
+ else:
+ wav_tensor = wav_data
+
+ # Ensure dimensions: [batch, channels, samples]
+ if wav_tensor.ndim == 1:
+ wav_tensor = wav_tensor.unsqueeze(0).unsqueeze(0) # [1, 1, samples]
+ elif wav_tensor.ndim == 2:
+ wav_tensor = wav_tensor.unsqueeze(0) # [1, channels, samples]
+
+ audio_dict = {"waveform": wav_tensor, "sample_rate": sr}
+
+ generated_speakers.append({"name": name, "audio": audio_dict, "instruct": instruct})
+
+ # Save preview audio
+ filename = f"Qwen3TTS_Batch_{name}_{''.join(random.choices(string.ascii_letters + string.digits, k=8))}.wav"
+ filepath = os.path.join(output_dir, filename)
+
+ # Save using torchaudio
+ # torchaudio.save expects [channels, samples]
+ # wav_tensor is [1, 1, samples], so squeeze(0) -> [1, samples]
+ torchaudio.save(filepath, wav_tensor.squeeze(0), sr)
+
+ batch_outputs.append({
+ "name": name,
+ "filename": filename,
+ "subfolder": "",
+ "type": "temp"
+ })
+
+ print(f"Successfully generated speaker '{name}'")
+
+ except Exception as e:
+ print(f"Failed to generate speaker '{name}': {e}")
+ import traceback
+ traceback.print_exc()
+
+ return {"ui": {"batch_outputs": batch_outputs}, "result": (generated_speakers,)}
+
+class TDQwen3TTSMultiDialog:
+ @classmethod
+ def INPUT_TYPES(s):
+ speakers = get_all_speakers()
+ return {
+ "required": {
+ "model": ("QWEN3_TTS_MODEL",),
+ "text": ("STRING", {"multiline": True, "default": "Vivian: 你好!\nRyan: 你好,今天天气真不错。\nRoleA: 我是自定义角色A。\nVivian: 欢迎你!"}),
+ "interval": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 5.0, "step": 0.1}),
+ "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ },
+ "optional": {
+ "speaker_list": ("SPEAKER_LIST",), # New input for batch speakers
+ "speaker_1": ("SPEAKER",), # Add explicit initial slot to ensure visibility before JS loads
+ }
+ }
+
+ RETURN_TYPES = ("AUDIO",)
+ RETURN_NAMES = ("audio",)
+ FUNCTION = "generate"
+ CATEGORY = "Qwen3TTS"
+
+ def generate(self, model, text, interval=0.5, seed=0, speaker_list=None, **kwargs):
+
+ language = None # Auto identify from audio
+
+ # 构建自定义角色字典
+ custom_roles = {}
+
+ # Add from speaker_list (batch input)
+ if speaker_list:
+ # Handle case where speaker_list might be a single dictionary (if connected incorrectly but passed)
+ if isinstance(speaker_list, dict):
+ if "name" in speaker_list:
+ custom_roles[speaker_list["name"]] = speaker_list
+ elif isinstance(speaker_list, list):
+ for spk in speaker_list:
+ if isinstance(spk, dict) and "name" in spk:
+ # Store full speaker object (name, audio, instruct)
+ custom_roles[spk["name"]] = spk
+
+ # Add from individual inputs (kwargs)
+ for key, value in kwargs.items():
+ if key.startswith("speaker_") and value is not None:
+ custom_roles[value["name"]] = value
+
+ if custom_roles:
+ print(f"Loaded {len(custom_roles)} custom speakers: {list(custom_roles.keys())}")
+ else:
+ print("No custom speakers loaded.")
+
+ # Create lowercase mapping for custom roles to support case-insensitive matching
+ custom_roles_lower = {k.lower(): k for k in custom_roles.keys()}
+
+ # 1. 解析文本
+ dialog_items = []
+ lines = text.strip().split('\n')
+
+ # Default to the first custom speaker if available, otherwise "Vivian"
+ if custom_roles:
+ current_speaker = list(custom_roles.keys())[0]
+ else:
+ current_speaker = "Vivian"
+
+ available_speakers = get_all_speakers()
+ # Create a lowercase mapping for case-insensitive lookup
+ available_speakers_lower = {s.lower(): s for s in available_speakers}
+
+ for line in lines:
+ line = line.strip()
+ if not line:
+ continue
+
+ # 尝试解析 "Speaker: Text" 或 "[Speaker]: Text"
+ if ":" in line or ":" in line:
+ # 统一冒号
+ line_fixed = line.replace(":", ":")
+ parts = line_fixed.split(":", 1)
+ possible_speaker = parts[0].strip().replace("[", "").replace("]", "")
+ content = parts[1].strip()
+
+ # 优先级:自定义角色 > 预设角色
+
+ # 1. Exact match custom
+ if possible_speaker in custom_roles:
+ current_speaker = possible_speaker
+ dialog_items.append((current_speaker, content))
+ # 2. Case-insensitive match custom
+ elif possible_speaker.lower() in custom_roles_lower:
+ current_speaker = custom_roles_lower[possible_speaker.lower()]
+ dialog_items.append((current_speaker, content))
+ # 3. Exact match preset
+ elif possible_speaker in available_speakers:
+ current_speaker = possible_speaker
+ dialog_items.append((current_speaker, content))
+ # 4. Case-insensitive match preset
+ elif possible_speaker.lower() in available_speakers_lower:
+ current_speaker = available_speakers_lower[possible_speaker.lower()]
+ dialog_items.append((current_speaker, content))
+ else:
+ # 如果不是已知角色,归为当前 speaker 的延续
+ print(f"Warning: Speaker '{possible_speaker}' not found in custom or preset speakers. Treating as text for '{current_speaker}'.")
+ dialog_items.append((current_speaker, line))
+ else:
+ # 没有冒号,认为是当前角色的延续
+ dialog_items.append((current_speaker, line))
+
+ # 2. 生成音频
+ all_wavs = []
+ sample_rate = None
+
+ print(f"开始生成多人对话,共 {len(dialog_items)} 个片段...")
+
+ # Detect model type
+ model_type = getattr(model.model, "tts_model_type", "unknown")
+ print(f"Detected model type: {model_type}")
+
+ for i, (speaker, content) in enumerate(dialog_items):
+ if not content:
+ continue
+
+ # Set deterministic seed based on global seed + speaker name hash
+ # This ensures that the same speaker always gets the same random seed for generation
+ # Use & 0xffffffff to ensure adler32 result is treated consistently
+ speaker_seed = (seed + (zlib.adler32(speaker.encode('utf-8')) & 0xffffffff)) % 0xffffffffffffffff
+ torch.manual_seed(speaker_seed)
+ if torch.cuda.is_available():
+ torch.cuda.manual_seed(speaker_seed)
+
+ print(f"[{i+1}/{len(dialog_items)}] 正在为 {speaker} 生成: {content[:20]}...")
+ try:
+ wav = None
+ sr = None
+
+ # Check if it is a custom role
+ if speaker in custom_roles:
+ role_data = custom_roles[speaker]
+
+ if model_type == "voice_design":
+ # For Voice Design model, we MUST use instruct
+ instruct = role_data.get("instruct")
+ if instruct:
+ print(f" - 使用 Voice Design (Instruct: {instruct[:20]}...)...")
+ wavs, sr = model.generate_voice_design(
+ text=content,
+ instruct=instruct,
+ language=language
+ )
+ wav = wavs[0]
+ else:
+ print(f"Error: Speaker '{speaker}' has no 'instruct' and model is Voice Design. Skipping.")
+ continue
+
+ elif model_type == "base":
+ # For Base model, use Voice Clone (requires audio)
+ if "audio" in role_data and role_data["audio"]:
+ ref_audio = role_data["audio"]
+ waveform = ref_audio["waveform"]
+ ref_sr = ref_audio["sample_rate"]
+
+ # Prepare ref audio
+ ref_wav_tensor = waveform[0]
+ if ref_wav_tensor.shape[0] > 1:
+ ref_wav_tensor = torch.mean(ref_wav_tensor, dim=0, keepdim=True)
+ ref_wav_np = ref_wav_tensor.squeeze(0).numpy()
+
+ print(f" - 使用 Voice Clone (Base Model)...")
+ wavs, sr = model.generate_voice_clone(
+ text=content,
+ language=language,
+ ref_audio=(ref_wav_np, ref_sr),
+ ref_text=None,
+ x_vector_only_mode=True
+ )
+ wav = wavs[0]
+ else:
+ print(f"Error: Speaker '{speaker}' has no 'audio' and model is Base. Skipping.")
+ continue
+
+ elif model_type == "custom_voice":
+ # Try fallback to preset if name matches
+ supported = model.get_supported_speakers()
+ if supported and speaker.lower() in [s.lower() for s in supported]:
+ print(f" - Fallback to Preset Speaker '{speaker}'...")
+ wavs, sr = model.generate_custom_voice(
+ text=content,
+ speaker=speaker,
+ language=language
+ )
+ wav = wavs[0]
+ else:
+ print(f"Error: CustomVoice model cannot generate custom speaker '{speaker}'.")
+ continue
+ else:
+ print(f"Error: Unknown model type '{model_type}'. Cannot determine generation method.")
+ continue
+
+ else:
+ # Preset Speaker (not in custom_roles)
+ if model_type == "custom_voice":
+ print(f" - 使用 Custom Voice (Preset: {speaker})...")
+ wavs, sr = model.generate_custom_voice(
+ text=content,
+ speaker=speaker,
+ language=language,
+ instruct=None
+ )
+ wav = wavs[0]
+ else:
+ print(f"Error: Model type '{model_type}' does not support preset speaker '{speaker}'. Please define '{speaker}' as a custom role with an 'instruct' (for Voice Design) or 'audio' (for Base).")
+ continue
+
+ if sample_rate is None:
+ sample_rate = sr
+ elif sample_rate != sr:
+ print(f"Warning: Sample rate mismatch {sr} vs {sample_rate}, skipping resampling for now (assuming compatible).")
+
+ all_wavs.append(wav)
+
+ # 添加间隔
+ if interval > 0 and i < len(dialog_items) - 1:
+ silence_samples = int(interval * sr)
+ silence = np.zeros(silence_samples, dtype=np.float32)
+ all_wavs.append(silence)
+
+ except Exception as e:
+ print(f"Error generating segment for {speaker}: {e}")
+ import traceback
+ traceback.print_exc()
+ continue
+
+ if not all_wavs:
+ # 返回静音或报错
+ print("Warning: No audio generated.")
+ # 返回 1秒静音
+ sr = sample_rate if sample_rate else 24000
+ silence = np.zeros(sr, dtype=np.float32)
+ audio_tensor = torch.from_numpy(silence).unsqueeze(0).unsqueeze(0)
+ return ({"waveform": audio_tensor, "sample_rate": sr},)
+
+ # 3. 拼接
+ final_wav = np.concatenate(all_wavs)
+
+ # 转换为 tensor [1, 1, samples]
+ audio_tensor = torch.from_numpy(final_wav).unsqueeze(0).unsqueeze(0)
+
+ return ({"waveform": audio_tensor, "sample_rate": sample_rate},)
+
+class TDQwen3TTSVoiceDesign:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "model": ("QWEN3_TTS_MODEL",),
+ "text": ("STRING", {"multiline": True, "default": "这是一个语音设计测试。"}),
+ "instruct": ("STRING", {"multiline": True, "default": "一个年轻女性的声音,语气愉快。"}),
+ "language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
+ }
+ }
+
+ RETURN_TYPES = ("AUDIO",)
+ RETURN_NAMES = ("audio",)
+ FUNCTION = "generate"
+ CATEGORY = "Qwen3TTS"
+
+ def generate(self, model, text, instruct, language):
+ if language == "Auto":
+ language = None
+
+ print(f"正在使用指令生成语音设计: {instruct}...")
+ wavs, sr = model.generate_voice_design(
+ text=text,
+ instruct=instruct,
+ language=language
+ )
+
+ audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
+ return ({"waveform": audio_tensor, "sample_rate": sr},)
+
+class TDQwen3TTSVoiceClone:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "model": ("QWEN3_TTS_MODEL",),
+ "text": ("STRING", {"multiline": True, "default": "这是一个语音克隆测试。"}),
+ "ref_audio": ("AUDIO",),
+ "language": (["Auto", "Chinese", "English", "Japanese", "Korean", "German", "French", "Russian", "Portuguese", "Spanish", "Italian"], {"default": "Auto"}),
+ },
+ "optional": {
+ "ref_text": ("STRING", {"multiline": True, "default": ""}),
+ "x_vector_only_mode": ("BOOLEAN", {"default": False, "label_on": "Enable", "label_off": "Disable"}),
+ }
+ }
+
+ RETURN_TYPES = ("AUDIO",)
+ RETURN_NAMES = ("audio",)
+ FUNCTION = "generate"
+ CATEGORY = "Qwen3TTS"
+
+ def generate(self, model, text, ref_audio, language, ref_text="", x_vector_only_mode=False):
+ if language == "Auto":
+ language = None
+
+ waveform = ref_audio["waveform"] # [batch, channels, samples]
+ sr = ref_audio["sample_rate"]
+
+ # 处理参考音频:取第一个批次,如果多声道则混合为单声道,最后转为 numpy
+ ref_wav_tensor = waveform[0] # [channels, samples]
+ if ref_wav_tensor.shape[0] > 1:
+ print(f"检测到多声道音频,正在混合为单声道...")
+ ref_wav_tensor = torch.mean(ref_wav_tensor, dim=0, keepdim=True)
+
+ ref_wav_np = ref_wav_tensor.squeeze(0).numpy() # [samples]
+
+ # 参考 test_model_12hz_base.py 的实现
+ # 如果未启用 x_vector_only_mode,则必须提供 ref_text
+ if not x_vector_only_mode and not ref_text.strip():
+ raise ValueError("必须填写参考文本(ref_text),内容为参考音频的实际说话内容。如果无法提供文本,请开启 'x_vector_only_mode'。")
+
+ print(f"正在生成语音克隆 (x_vector_only_mode={x_vector_only_mode})...")
+ wavs, out_sr = model.generate_voice_clone(
+ text=text,
+ language=language,
+ ref_audio=(ref_wav_np, sr),
+ ref_text=ref_text if ref_text else None,
+ x_vector_only_mode=x_vector_only_mode
+ )
+
+ audio_tensor = torch.from_numpy(wavs[0]).unsqueeze(0).unsqueeze(0)
+ return ({"waveform": audio_tensor, "sample_rate": out_sr},)
+
+NODE_CLASS_MAPPINGS = {
+ "TDQwen3TTSModelLoader": TDQwen3TTSModelLoader,
+ "TDQwen3TTSCustomVoice": TDQwen3TTSCustomVoice,
+ "TDQwen3TTSMultiDialog": TDQwen3TTSMultiDialog,
+ "TDQwen3TTSDefineSpeaker": TDQwen3TTSDefineSpeaker,
+ "TDQwen3TTSBatchGenerateSpeaker": TDQwen3TTSBatchGenerateSpeaker,
+ "TDQwen3TTSVoiceDesign": TDQwen3TTSVoiceDesign,
+ "TDQwen3TTSVoiceClone": TDQwen3TTSVoiceClone,
+}
+
+NODE_DISPLAY_NAME_MAPPINGS = {
+ "TDQwen3TTSModelLoader": "TD Qwen3 TTS Model Loader",
+ "TDQwen3TTSCustomVoice": "TD Qwen3 TTS Custom Voice",
+ "TDQwen3TTSMultiDialog": "TD Qwen3 TTS Multi Dialog",
+ "TDQwen3TTSDefineSpeaker": "TD Qwen3 TTS Define Speaker",
+ "TDQwen3TTSBatchGenerateSpeaker": "TD Qwen3 TTS Batch Generate Speaker",
+ "TDQwen3TTSVoiceDesign": "TD Qwen3 TTS Voice Design",
+ "TDQwen3TTSVoiceClone": "TD Qwen3 TTS Voice Clone",
+}
diff --git a/docs/hel-892/tts-reference/impact-members.json b/docs/hel-892/tts-reference/impact-members.json
new file mode 100644
index 00000000..22f496e5
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact-members.json
@@ -0,0 +1,517 @@
+[
+ {
+ "path": ".github/workflows/publish.yml",
+ "size": 647,
+ "sha256": "0232916cbe1a18f885df5514f4b3480fd29fb8fac7c53a8a2bc92a862d61154e"
+ },
+ {
+ "path": ".gitignore",
+ "size": 122,
+ "sha256": "1748bd83608a34dccd2d16c2b45ebd066e7172f1d5135b87cdd2f300e6b27697"
+ },
+ {
+ "path": ".gitmodules",
+ "size": 96,
+ "sha256": "ead3e9a3279ccd0b9310f0d520ba3ca88a8e962e1451608180aa740c9c835153"
+ },
+ {
+ "path": "LICENSE.txt",
+ "size": 35149,
+ "sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986"
+ },
+ {
+ "path": "README.md",
+ "size": 51528,
+ "sha256": "052ed88a4183dcc2450f9f9275264de97520c44f0e966c032278586e295c5632"
+ },
+ {
+ "path": "__init__.py",
+ "size": 21951,
+ "sha256": "c28bb39a58fff73b476f3304e26ef5d57e3d5bec7069f86b0b0f69a9528195c0"
+ },
+ {
+ "path": "custom_wildcards/put_wildcards_here",
+ "size": 0,
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ },
+ {
+ "path": "docs/wildcards/README.md",
+ "size": 1225,
+ "sha256": "771e9555b7fae14b2019e8daad0a5411d59178747c115448282cfeb28095e87d"
+ },
+ {
+ "path": "docs/wildcards/SUMMARY.md",
+ "size": 4425,
+ "sha256": "b3e5fc6343c6236a02efac5ba6e7404d74388bb13a2e01df14f63329628e4c25"
+ },
+ {
+ "path": "docs/wildcards/WILDCARD_SYSTEM_DESIGN.md",
+ "size": 24923,
+ "sha256": "1642e920a75f9f14b25a121f25b64914344b2fb54c22b43c936efb3cbeedf853"
+ },
+ {
+ "path": "docs/wildcards/WILDCARD_SYSTEM_PRD.md",
+ "size": 15080,
+ "sha256": "1033516c3677998bc0f76d0c0fa0faeb2d36bc13c708bac219cde77ced59077b"
+ },
+ {
+ "path": "docs/wildcards/WILDCARD_TESTING_GUIDE.md",
+ "size": 9907,
+ "sha256": "fb03db6478a77a2419acf302f5b97b4c51c9f32f072a9166279081c325675980"
+ },
+ {
+ "path": "example_workflows/1-FaceDetailer.jpg",
+ "size": 64932,
+ "sha256": "c1a4ed7a9079d45a01a52043d9672d2646fdd28b88eac958e51dc2b38aa438c0"
+ },
+ {
+ "path": "example_workflows/1-FaceDetailer.json",
+ "size": 21147,
+ "sha256": "bce9cc29c07ba8995bf921f919392066cd4bfaba4dd33a17b035168deb7c947c"
+ },
+ {
+ "path": "example_workflows/2-MaskDetailer.jpg",
+ "size": 114261,
+ "sha256": "1abd1823bed26d5e8c92707c0369d41b4f7c6a0629e70c3fa92fcc914585dc8a"
+ },
+ {
+ "path": "example_workflows/2-MaskDetailer.json",
+ "size": 11958,
+ "sha256": "13c151c9f0bb7779020fee73a903819c24ca783e355e37b176e6977bddedbb3f"
+ },
+ {
+ "path": "example_workflows/3-SEGSDetailer.jpg",
+ "size": 42824,
+ "sha256": "9f4aed9e96b46408fba0ed644ce1a86ffa7ca3cfd373c2849a2cc1fc5f243175"
+ },
+ {
+ "path": "example_workflows/3-SEGSDetailer.json",
+ "size": 19373,
+ "sha256": "905062125d64bce059d9554e5adeb13e3ca3654109ef07a7a31ad6178c5b7b6d"
+ },
+ {
+ "path": "example_workflows/4-MakeTileSEGS-Upscale.jpg",
+ "size": 108834,
+ "sha256": "b1d3d9a3563821ba82a6277610e83ec2fe20473679ebb25c70c811a252e06ecd"
+ },
+ {
+ "path": "example_workflows/4-MakeTileSEGS-Upscale.json",
+ "size": 31936,
+ "sha256": "a63092b1dd1ae7d508b9818e57b141894fdd017bc15d8b94fd731bfea6fdebab"
+ },
+ {
+ "path": "example_workflows/5-PreviewDetailerHookProvider.jpg",
+ "size": 68539,
+ "sha256": "f37a67d0b42e4d94950a4d27de403b022d684824571021c702196a2989bf8349"
+ },
+ {
+ "path": "example_workflows/5-PreviewDetailerHookProvider.json",
+ "size": 29902,
+ "sha256": "b20ee55ffae8fb564f6d3806b6b062ff81e54a3bd1c8ebd80421b21613694163"
+ },
+ {
+ "path": "example_workflows/5-prompt-per-tile.jpg",
+ "size": 130918,
+ "sha256": "232bde22503e087e47c391bb91bbcc830c9882889ac715c1ec139667ea3d2c03"
+ },
+ {
+ "path": "example_workflows/5-prompt-per-tile.json",
+ "size": 21444,
+ "sha256": "501fc470c82e93c5e619e54ca16bc45e9e5c8aed4823d9c7b4884ad70f14ee6b"
+ },
+ {
+ "path": "example_workflows/6-DetailerWildcard.jpg",
+ "size": 538538,
+ "sha256": "f80a2add23387329e86abfb00382d1efd818df33a8fa19c93cdf75a478a491df"
+ },
+ {
+ "path": "example_workflows/6-DetailerWildcard.json",
+ "size": 21235,
+ "sha256": "1e7c57991611bd1277e9367b278a55efcc82a1e9e737ca510947fb480650757c"
+ },
+ {
+ "path": "install.py",
+ "size": 3971,
+ "sha256": "9520f8f0c099b78d78e47316323e47b31597cb10de3f4017565fc986eabd1e8e"
+ },
+ {
+ "path": "js/common.js",
+ "size": 7809,
+ "sha256": "0b52de41ef5d5e51add0dd1051ac708ea882aa5b8ce0a10779ae1d2cbbe7d795"
+ },
+ {
+ "path": "js/impact-image-util.js",
+ "size": 5699,
+ "sha256": "6a2063c647ac7bcd1db150b9bdc4b1883721bf33990be5c1773a760d0a71fd38"
+ },
+ {
+ "path": "js/impact-pack.js",
+ "size": 28835,
+ "sha256": "03d2ea39e66bd669166b8dbb5e3eb7b25ac23e6a761bce5cacde6ca979a42a71"
+ },
+ {
+ "path": "js/impact-sam-editor.js",
+ "size": 19863,
+ "sha256": "fdc061010d8c00505af3a3fc95db12ae01f2ffa0bc8a2162dc05f6c17a64a7fd"
+ },
+ {
+ "path": "js/impact-segs-picker.js",
+ "size": 5725,
+ "sha256": "ed1b8f380befcd21651af11ac46ac2fd9348d57ea8ef3d752634da498f6ce0c5"
+ },
+ {
+ "path": "js/mask-rect-area-advanced.js",
+ "size": 16638,
+ "sha256": "19138d8e1d2c0dcc2066adc3541977837b115843e139a25b5d099d5649444f81"
+ },
+ {
+ "path": "js/mask-rect-area.js",
+ "size": 17842,
+ "sha256": "279136cb6e3912f0f280cda23ad6fb8bfb8beb19e94ac288753eeb772214a5cf"
+ },
+ {
+ "path": "latent.png",
+ "size": 2814,
+ "sha256": "1faf0cc926b0d65c8ab93e7485aea816283eb22fdeefe9682c206948c1de2043"
+ },
+ {
+ "path": "locales/ko/nodeDefs.json",
+ "size": 70753,
+ "sha256": "40e46597d8772a53a3d5c93295aa290899bd83372fe82d37bd2d9c6eec5386fd"
+ },
+ {
+ "path": "modules/impact/additional_dependencies.py",
+ "size": 424,
+ "sha256": "9aaaf0bd584f6006bd39ae04eaf240a3a76688a2a2f8f6dba4d6b2013438052e"
+ },
+ {
+ "path": "modules/impact/animatediff_nodes.py",
+ "size": 11434,
+ "sha256": "d89c2c095c3ae2dc89a1aa9014d75c0b035c484a442cf3c1343638e61db31e15"
+ },
+ {
+ "path": "modules/impact/bridge_nodes.py",
+ "size": 22509,
+ "sha256": "60ff69d1a707dce3d9bb52c3d3dd69b00e8855bde7795e736634577cd18234cc"
+ },
+ {
+ "path": "modules/impact/config.py",
+ "size": 3364,
+ "sha256": "5d733ecc85bdf0cde27e5a25dc936736582767812486a566f412e53e691a20f5"
+ },
+ {
+ "path": "modules/impact/core.py",
+ "size": 99603,
+ "sha256": "6dc6cfc3048ae222779841eb28c61c594106293e68730003c13d72dc73f01545"
+ },
+ {
+ "path": "modules/impact/defs.py",
+ "size": 1302,
+ "sha256": "3245470dd01c49582ee9a4a626518c316c57d6ef236ed098f8d42b9554fd1757"
+ },
+ {
+ "path": "modules/impact/detectors.py",
+ "size": 29207,
+ "sha256": "d9a8cfce4f4a4ca54025f6b35bd92fe22ff9732bfe5cf9f470140fde389a546c"
+ },
+ {
+ "path": "modules/impact/hf_nodes.py",
+ "size": 5431,
+ "sha256": "51c56b535d0181f515b077f6b150b0ce778605461ce3fea988a9e59571535c9c"
+ },
+ {
+ "path": "modules/impact/hook_nodes.py",
+ "size": 4182,
+ "sha256": "581769ce60b53fa017ac7e33eb6b6f2579efaf8b18d2e17947b5a06475e52204"
+ },
+ {
+ "path": "modules/impact/hooks.py",
+ "size": 21012,
+ "sha256": "0fc1b9efbee36e5e8509dbc76300e4d6760bb8e95d637660a0f5051088dc2da6"
+ },
+ {
+ "path": "modules/impact/impact_onnx.py",
+ "size": 1399,
+ "sha256": "8b838d1bdd173284d906dcb261d100c16edd13e0ea55566fa5856a59defd23d7"
+ },
+ {
+ "path": "modules/impact/impact_pack.py",
+ "size": 129693,
+ "sha256": "16c91003f6508c33858193b763ad2a72a78dd8e9a83274a56897cbbd0fe80b5a"
+ },
+ {
+ "path": "modules/impact/impact_sampling.py",
+ "size": 16526,
+ "sha256": "66ae5415e256004ed45376cc25172cd77e48d15d310b20c7e3f051b8dc842536"
+ },
+ {
+ "path": "modules/impact/impact_server.py",
+ "size": 23765,
+ "sha256": "2e0bac8e1bc1596e63b1b51f9c0f4183aa72b48753fbe1dbd97413a82d14496d"
+ },
+ {
+ "path": "modules/impact/logics.py",
+ "size": 22496,
+ "sha256": "354daeec00a5f18aeba1277c2366ae55f32bee433c469e44853d36ed6ccb37cb"
+ },
+ {
+ "path": "modules/impact/pipe.py",
+ "size": 17229,
+ "sha256": "7462c32b156a17d41ce3ffaca6b12a6e4e347223a90f255a6f4c0e5743aa4c9b"
+ },
+ {
+ "path": "modules/impact/segs_nodes.py",
+ "size": 77516,
+ "sha256": "c1d9fb7962a3a46da3e6ec94a88384a1b22ee9f9845a0aa722501f408bef65d1"
+ },
+ {
+ "path": "modules/impact/segs_upscaler.py",
+ "size": 5765,
+ "sha256": "cb4d0adecb1a80db92a46af83569bb911e68b84264b626146e041f803073954b"
+ },
+ {
+ "path": "modules/impact/special_samplers.py",
+ "size": 39309,
+ "sha256": "32647b60dd169f953b04ebdacf9e2a59c3870ecf442f01f3f76d96906283989c"
+ },
+ {
+ "path": "modules/impact/util_nodes.py",
+ "size": 24486,
+ "sha256": "7ca6a382fd2d5e7c563a0c9ac15918a23b84c872ef7f64248bc485c26921c710"
+ },
+ {
+ "path": "modules/impact/utils.py",
+ "size": 21262,
+ "sha256": "92853e548bbc77860bc6f6e1b582a93a7d7d0ecea278138c475f1cdc2f62cce7"
+ },
+ {
+ "path": "modules/impact/wildcards.py",
+ "size": 47830,
+ "sha256": "8a0e2f2b4cafd05bfc431d22d0f563d0427f55cab51cd641369451217251161c"
+ },
+ {
+ "path": "modules/thirdparty/noise_nodes.py",
+ "size": 3428,
+ "sha256": "f6266cf6f4a812324ab3058c6d9c04ae2153d02785f7d1cac21a32efec5f8904"
+ },
+ {
+ "path": "node_list.json",
+ "size": 147,
+ "sha256": "c6476f5df53446e8801ec089740c293228cd0ac23b3a8c7134165e45e525b4f8"
+ },
+ {
+ "path": "notebook/comfyui_colab_impact_pack.ipynb",
+ "size": 5435,
+ "sha256": "92c17ec345f68bc588bfe69285ff6b17af661bfa17a48f5842dc3994cf317636"
+ },
+ {
+ "path": "pyproject.toml",
+ "size": 745,
+ "sha256": "3d6fa2cbd4b687d3d514ac41f601aae9e8a2f73c71f93adb548ccb09458a9094"
+ },
+ {
+ "path": "requirements.txt",
+ "size": 146,
+ "sha256": "a8220b5c17eabc1edb99739679b65907cc17d8d4dd0980f73fe638989b4365a8"
+ },
+ {
+ "path": "ruff.toml",
+ "size": 68,
+ "sha256": "e75bd15977c61ec29aa2b9966950fd64a95987424427618c3b6552da3b7b45e3"
+ },
+ {
+ "path": "tests/README.md",
+ "size": 4253,
+ "sha256": "cce7304b4f820a624950402863a14be57540f441d7ebbdc8dbde5d118265b98c"
+ },
+ {
+ "path": "tests/RUN_ALL_TESTS.md",
+ "size": 1537,
+ "sha256": "4a9752d276247d78c4bb2fd13c002e2be08c308df4ff70dffb35429d040f4905"
+ },
+ {
+ "path": "tests/restart_test_server.sh",
+ "size": 1882,
+ "sha256": "92207b469c2030a83ab5e7b49c4b4458e70d09d9042014a67d50cee55ed0ef6d"
+ },
+ {
+ "path": "tests/test_config_quotes.sh",
+ "size": 4328,
+ "sha256": "f9c6ad1cb862ce499fff4851d24d359ffaee2ab2ee7f7ab14342b83e0c878db2"
+ },
+ {
+ "path": "tests/test_deep_nesting.sh",
+ "size": 8167,
+ "sha256": "e76f19b01ab0d3badee36f533dd46a9ac1fdedf7f2d0911d619370e1a6066fac"
+ },
+ {
+ "path": "tests/test_dynamic_prompts_full.sh",
+ "size": 7988,
+ "sha256": "23a51b552fdf13daa55c789ce49530ed07817df736908178c6405d8b5ade1303"
+ },
+ {
+ "path": "tests/test_edge_cases.sh",
+ "size": 5949,
+ "sha256": "2bb56022e3b95b6d45ffc0df87a7c2f4d922aa7cd85b491b2b80c707ad8d715c"
+ },
+ {
+ "path": "tests/test_encoding.sh",
+ "size": 5508,
+ "sha256": "ea49b64fc533d6156beab2218f69b0330819080d6f0d67505d57d4bc7cd6edfd"
+ },
+ {
+ "path": "tests/test_error_handling.sh",
+ "size": 5526,
+ "sha256": "a5623230828d03d1fda3047b437f4b5db8addf43e106de603324e2ad24383304"
+ },
+ {
+ "path": "tests/test_ondemand_loading.sh",
+ "size": 6950,
+ "sha256": "273a2691a1f2b56802cd2e49cc2b38e7763399d2e594ef89a130904b7c1295c8"
+ },
+ {
+ "path": "tests/wildcards/README.md",
+ "size": 21263,
+ "sha256": "be3939debb78c731aa9a8a86f9366317a04b377f336dbfa0460bb4b89737ab73"
+ },
+ {
+ "path": "tests/wildcards/find_deep_transitive.py",
+ "size": 5863,
+ "sha256": "c518baa0b863cfc8f4b052755410e88d28b6de345783772c6f02aee728a58fb9"
+ },
+ {
+ "path": "tests/wildcards/find_transitive_wildcards.sh",
+ "size": 3781,
+ "sha256": "d8ea0e9f2b29258d4ba40db523159c8640677707339cec86568ccd1ae6afa211"
+ },
+ {
+ "path": "tests/wildcards/run_quick_test.sh",
+ "size": 2956,
+ "sha256": "e55b5743358444c332601bdd64b4f4aa68f32eb6f318afeb213bb280fbc59c52"
+ },
+ {
+ "path": "tests/wildcards/samples/README.md",
+ "size": 6409,
+ "sha256": "74a0fd21a65ab7482425b4b481d2eea97f7f9c40c91472fa97829c04ec6e809f"
+ },
+ {
+ "path": "tests/wildcards/test_lazy_load_api.sh",
+ "size": 7153,
+ "sha256": "b7c5b2ca8f343b864bd5b433dce1932b75d2fa033e544f4dfc3b7fda3db8077e"
+ },
+ {
+ "path": "tests/wildcards/test_lazy_load_verification.py",
+ "size": 7687,
+ "sha256": "9d7bd05162aa52e74fd1b586ef5f869012398cdf2cd361b1eda3b3d0b4a5716b"
+ },
+ {
+ "path": "tests/wildcards/test_progressive_loading.py",
+ "size": 9361,
+ "sha256": "3a2ac369b40fe77a52dbd04720a84bc1727977cbd2f77d3e0ef3c75210bfcf83"
+ },
+ {
+ "path": "tests/wildcards/test_progressive_ondemand.sh",
+ "size": 9519,
+ "sha256": "2e79224bc201981765c260d8924bcaf80fc4a25e685cd4ec24a92e7ad00054f1"
+ },
+ {
+ "path": "tests/wildcards/test_sequential_loading.sh",
+ "size": 8785,
+ "sha256": "91a8c26d307e303b22ca641629a451e21c9a956fa51b3a9afe7157746d21806b"
+ },
+ {
+ "path": "tests/wildcards/test_versatile_prompts.sh",
+ "size": 7713,
+ "sha256": "1f9cf7048e1e1fb2b70e736771f88a468fb296b907ffc8c45df688bdbcf6eea6"
+ },
+ {
+ "path": "tests/wildcards/test_wildcard_consistency.sh",
+ "size": 6870,
+ "sha256": "9a2cef04ebc35890f09fc8dc47eab6d388ebaf4078391acbfa0afb19469c0810"
+ },
+ {
+ "path": "tests/wildcards/test_wildcard_final.py",
+ "size": 4746,
+ "sha256": "42798e3d7202ff683c28b2e812fc3788764e0d7998c6f060922bf1d860954a3c"
+ },
+ {
+ "path": "tests/wildcards/test_wildcard_lazy_loading.py",
+ "size": 6149,
+ "sha256": "7d795cacf73aa8ef6b60b4a8e0b20fcb72746a6fbca6d4517551c810cec79e85"
+ },
+ {
+ "path": "tests/wildcards/verify_ondemand_mode.sh",
+ "size": 2777,
+ "sha256": "4864c64ea8372aefd6a7885d7d5982b2cf87f5af13fb0f286dcf4ff15aec0ed9"
+ },
+ {
+ "path": "tests/workflows/advanced-sampler.json",
+ "size": 16207,
+ "sha256": "26c6be819f803b2bb169b1a4062050aae772e91b3f3e05654a16c7b24f54cfb2"
+ },
+ {
+ "path": "tests/workflows/detailer-pipe-test-sdxl.json",
+ "size": 33006,
+ "sha256": "a8119d665e35c29d63290b8c107587b490c8ba48b2f1d4cf3fe59ea4c49e3fe2"
+ },
+ {
+ "path": "tests/workflows/detailer-pipe-test.json",
+ "size": 60406,
+ "sha256": "ac986ae1e8df0c2b64710800f90c429cadd77de32d591f3b92b2bede40a8aeca"
+ },
+ {
+ "path": "tests/workflows/impactwildcardprocessor_separate_tests.json",
+ "size": 23061,
+ "sha256": "9ed458ba00674b02d0e479f88672b55294e3e79492b9306c8eaaf3c265ba700f"
+ },
+ {
+ "path": "tests/workflows/impactwildcardprocessor_yaml_tests.json",
+ "size": 41914,
+ "sha256": "30741ef5abb771694c884f842cf2f9dfa33fa73cca828d94651ba54444c4ae8a"
+ },
+ {
+ "path": "tests/workflows/loop-test.json",
+ "size": 17958,
+ "sha256": "9e487c1934798ee23e7f7dd0976797f1c488039db0f38098bb86a999d9a118da"
+ },
+ {
+ "path": "tests/workflows/masks.json",
+ "size": 9985,
+ "sha256": "51a43424f8d57c7617dc6285df69d80fa7899966485e86b693f9e0ed49f9dfeb"
+ },
+ {
+ "path": "tests/workflows/regional_prompt.json",
+ "size": 28215,
+ "sha256": "21af512d8f5fda65955ad821a64e066941f112f741900780038b16fe484b1330"
+ },
+ {
+ "path": "troubleshooting/TROUBLESHOOTING.md",
+ "size": 2856,
+ "sha256": "2c852099dc7eb1de573708bd5f291a17c8e8d8a0a9ae7d06ad04d69a7dfb6d42"
+ },
+ {
+ "path": "troubleshooting/black1.png",
+ "size": 752880,
+ "sha256": "6e32fe1606d35a26ddf08d2a3ff24c8fcd62831b9ed11eeaa76468e27a2b5f0f"
+ },
+ {
+ "path": "troubleshooting/black2.png",
+ "size": 709592,
+ "sha256": "829d72c3cc1034f72bbd0945e1a2aed69e1f38060126159c0b911c4c102e2fcc"
+ },
+ {
+ "path": "wildcards/put_wildcards_here",
+ "size": 0,
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
+ },
+ {
+ "path": "wildcards/samples/flower.txt",
+ "size": 67,
+ "sha256": "63ad428a02551243d1835c324236c785cca6fe64cd6cf646fe22a9a88c36350f"
+ },
+ {
+ "path": "wildcards/samples/jewel.txt",
+ "size": 70,
+ "sha256": "e1c6436c087de80f9a08f49b0c815d7d7a9b500df2c4d5e26bfd6e877d18bcb5"
+ }
+]
diff --git a/docs/hel-892/tts-reference/impact-registry.json b/docs/hel-892/tts-reference/impact-registry.json
new file mode 100644
index 00000000..63553d3c
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact-registry.json
@@ -0,0 +1 @@
+{"changelog":"","createdAt":"2026-01-02T12:06:31.501557Z","dependencies":["segment-anything","scikit-image","piexif","transformers","opencv-python-headless","scipy","numpy","dill","matplotlib","sam2 @ git+https://github.com/facebookresearch/sam2"],"deprecated":false,"downloadUrl":"https://cdn.comfy.org/drltdata/comfyui-impact-pack/8.28.2/node.zip","id":"b3f817b8-e820-464e-82be-7ea3bf2c1517","node_id":"comfyui-impact-pack","status":"NodeVersionStatusActive","supported_accelerators":[],"supported_comfyui_frontend_version":"","supported_comfyui_version":"","supported_os":[],"tags":[],"version":"8.28.2"}
diff --git a/docs/hel-892/tts-reference/impact-source.zip b/docs/hel-892/tts-reference/impact-source.zip
new file mode 100644
index 00000000..77d42475
Binary files /dev/null and b/docs/hel-892/tts-reference/impact-source.zip differ
diff --git a/docs/hel-892/tts-reference/impact__LICENSE.txt b/docs/hel-892/tts-reference/impact__LICENSE.txt
new file mode 100644
index 00000000..f288702d
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact__LICENSE.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/docs/hel-892/tts-reference/impact____init__.py b/docs/hel-892/tts-reference/impact____init__.py
new file mode 100644
index 00000000..ee98acab
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact____init__.py
@@ -0,0 +1,456 @@
+"""
+@author: Dr.Lt.Data
+@title: Impact Pack
+@nickname: Impact Pack
+@description: This extension offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler.
+"""
+
+import folder_paths
+import os
+import sys
+import logging
+
+comfy_path = os.path.dirname(folder_paths.__file__)
+impact_path = os.path.join(os.path.dirname(__file__))
+modules_path = os.path.join(os.path.dirname(__file__), "modules")
+
+sys.path.append(modules_path)
+
+import impact.config
+logging.info(f"### Loading: ComfyUI-Impact-Pack ({impact.config.version})")
+
+# Core
+# recheck dependencies for colab
+try:
+ import folder_paths
+ import torch # noqa: F401
+ import cv2 # noqa: F401
+ from cv2 import setNumThreads # noqa: F401
+ import numpy as np # noqa: F401
+ import comfy.samplers
+ import comfy.sd # noqa: F401
+ from PIL import Image, ImageFilter # noqa: F401
+ from skimage.measure import label, regionprops # noqa: F401
+ from collections import namedtuple # noqa: F401
+ import piexif # noqa: F401
+ import nodes
+except Exception as e:
+ import logging
+ logging.error("[Impact Pack] Failed to import due to several dependencies are missing!!!!")
+ raise e
+
+
+import impact.impact_server # to load server api
+
+from .modules.impact.impact_pack import * # noqa: F403
+from .modules.impact.detectors import * # noqa: F403
+from .modules.impact.pipe import * # noqa: F403
+from .modules.impact.logics import * # noqa: F403
+from .modules.impact.util_nodes import * # noqa: F403
+from .modules.impact.segs_nodes import * # noqa: F403
+from .modules.impact.special_samplers import * # noqa: F403
+from .modules.impact.hf_nodes import * # noqa: F403
+from .modules.impact.bridge_nodes import * # noqa: F403
+from .modules.impact.hook_nodes import * # noqa: F403
+from .modules.impact.animatediff_nodes import * # noqa: F403
+from .modules.impact.segs_upscaler import * # noqa: F403
+
+import threading
+
+
+threading.Thread(target=impact.wildcards.wildcard_load).start()
+
+
+NODE_CLASS_MAPPINGS = {
+ "SAMLoader": SAMLoader, # noqa: F405
+ "CLIPSegDetectorProvider": CLIPSegDetectorProvider, # noqa: F405
+ "ONNXDetectorProvider": ONNXDetectorProvider, # noqa: F405
+
+ "BitwiseAndMaskForEach": BitwiseAndMaskForEach, # noqa: F405
+ "SubtractMaskForEach": SubtractMaskForEach, # noqa: F405
+
+ "DetailerForEach": DetailerForEach, # noqa: F405
+ "DetailerForEachAutoRetry": DetailerForEachAutoRetry, # noqa: F405
+ "DetailerForEachDebug": DetailerForEachTest, # noqa: F405
+ "DetailerForEachPipe": DetailerForEachPipe, # noqa: F405
+ "DetailerForEachDebugPipe": DetailerForEachTestPipe, # noqa: F405
+ "DetailerForEachPipeForAnimateDiff": DetailerForEachPipeForAnimateDiff, # noqa: F405
+
+ "SAMDetectorCombined": SAMDetectorCombined, # noqa: F405
+ "SAMDetectorSegmented": SAMDetectorSegmented, # noqa: F405
+
+ "FaceDetailer": FaceDetailer, # noqa: F405
+ "FaceDetailerPipe": FaceDetailerPipe, # noqa: F405
+ "MaskDetailerPipe": MaskDetailerPipe, # noqa: F405
+
+ "ToDetailerPipe": ToDetailerPipe, # noqa: F405
+ "ToDetailerPipeSDXL": ToDetailerPipeSDXL, # noqa: F405
+ "FromDetailerPipe": FromDetailerPipe, # noqa: F405
+ "FromDetailerPipe_v2": FromDetailerPipe_v2, # noqa: F405
+ "FromDetailerPipeSDXL": FromDetailerPipe_SDXL, # noqa: F405
+ "AnyPipeToBasic": AnyPipeToBasic, # noqa: F405
+ "ToBasicPipe": ToBasicPipe, # noqa: F405
+ "FromBasicPipe": FromBasicPipe, # noqa: F405
+ "FromBasicPipe_v2": FromBasicPipe_v2, # noqa: F405
+ "BasicPipeToDetailerPipe": BasicPipeToDetailerPipe, # noqa: F405
+ "BasicPipeToDetailerPipeSDXL": BasicPipeToDetailerPipeSDXL, # noqa: F405
+ "DetailerPipeToBasicPipe": DetailerPipeToBasicPipe, # noqa: F405
+ "EditBasicPipe": EditBasicPipe, # noqa: F405
+ "EditDetailerPipe": EditDetailerPipe, # noqa: F405
+ "EditDetailerPipeSDXL": EditDetailerPipeSDXL, # noqa: F405
+
+ "LatentPixelScale": LatentPixelScale, # noqa: F405
+ "PixelKSampleUpscalerProvider": PixelKSampleUpscalerProvider, # noqa: F405
+ "PixelKSampleUpscalerProviderPipe": PixelKSampleUpscalerProviderPipe, # noqa: F405
+ "IterativeLatentUpscale": IterativeLatentUpscale, # noqa: F405
+ "IterativeImageUpscale": IterativeImageUpscale, # noqa: F405
+ "PixelTiledKSampleUpscalerProvider": PixelTiledKSampleUpscalerProvider, # noqa: F405
+ "PixelTiledKSampleUpscalerProviderPipe": PixelTiledKSampleUpscalerProviderPipe, # noqa: F405
+ "TwoSamplersForMaskUpscalerProvider": TwoSamplersForMaskUpscalerProvider, # noqa: F405
+ "TwoSamplersForMaskUpscalerProviderPipe": TwoSamplersForMaskUpscalerProviderPipe, # noqa: F405
+
+ "PixelKSampleHookCombine": PixelKSampleHookCombine, # noqa: F405
+ "DenoiseScheduleHookProvider": DenoiseScheduleHookProvider, # noqa: F405
+ "StepsScheduleHookProvider": StepsScheduleHookProvider, # noqa: F405
+ "CfgScheduleHookProvider": CfgScheduleHookProvider, # noqa: F405
+ "NoiseInjectionHookProvider": NoiseInjectionHookProvider, # noqa: F405
+ "UnsamplerHookProvider": UnsamplerHookProvider, # noqa: F405
+ "CoreMLDetailerHookProvider": CoreMLDetailerHookProvider, # noqa: F405
+ "PreviewDetailerHookProvider": PreviewDetailerHookProvider, # noqa: F405
+ "BlackPatchRetryHookProvider": BlackPatchRetryHookProvider, # noqa: F405
+ "CustomSamplerDetailerHookProvider": CustomSamplerDetailerHookProvider, # noqa: F405
+ "LamaRemoverDetailerHookProvider": LamaRemoverDetailerHookProvider, # noqa: F405
+
+ "DetailerHookCombine": DetailerHookCombine, # noqa: F405
+ "NoiseInjectionDetailerHookProvider": NoiseInjectionDetailerHookProvider, # noqa: F405
+ "UnsamplerDetailerHookProvider": UnsamplerDetailerHookProvider, # noqa: F405
+ "DenoiseSchedulerDetailerHookProvider": DenoiseSchedulerDetailerHookProvider, # noqa: F405
+ "SEGSOrderedFilterDetailerHookProvider": SEGSOrderedFilterDetailerHookProvider, # noqa: F405
+ "SEGSRangeFilterDetailerHookProvider": SEGSRangeFilterDetailerHookProvider, # noqa: F405
+ "SEGSLabelFilterDetailerHookProvider": SEGSLabelFilterDetailerHookProvider, # noqa: F405
+ "VariationNoiseDetailerHookProvider": VariationNoiseDetailerHookProvider, # noqa: F405
+ # "CustomNoiseDetailerHookProvider": CustomNoiseDetailerHookProvider,
+
+ "BitwiseAndMask": BitwiseAndMask, # noqa: F405
+ "SubtractMask": SubtractMask, # noqa: F405
+ "AddMask": AddMask, # noqa: F405
+ "MaskRectArea": MaskRectArea, # noqa: F405
+ "MaskRectAreaAdvanced": MaskRectAreaAdvanced, # noqa: F405
+ "ImpactSegsAndMask": SegsBitwiseAndMask, # noqa: F405
+ "ImpactSegsAndMaskForEach": SegsBitwiseAndMaskForEach, # noqa: F405
+ "EmptySegs": EmptySEGS, # noqa: F405
+ "ImpactFlattenMask": FlattenMask, # noqa: F405
+
+ "MediaPipeFaceMeshToSEGS": MediaPipeFaceMeshToSEGS, # noqa: F405
+ "MaskToSEGS": MaskToSEGS, # noqa: F405
+ "MaskToSEGS_for_AnimateDiff": MaskToSEGS_for_AnimateDiff, # noqa: F405
+ "ToBinaryMask": ToBinaryMask, # noqa: F405
+ "MasksToMaskList": MasksToMaskList, # noqa: F405
+ "MaskListToMaskBatch": MaskListToMaskBatch, # noqa: F405
+ "ImageListToImageBatch": ImageListToImageBatch, # noqa: F405
+ "SetDefaultImageForSEGS": DefaultImageForSEGS, # noqa: F405
+ "RemoveImageFromSEGS": RemoveImageFromSEGS, # noqa: F405
+
+ "BboxDetectorSEGS": BboxDetectorForEach, # noqa: F405
+ "SegmDetectorSEGS": SegmDetectorForEach, # noqa: F405
+ "ONNXDetectorSEGS": BboxDetectorForEach, # noqa: F405
+ "ImpactSimpleDetectorSEGS_for_AD": SimpleDetectorForAnimateDiff, # noqa: F405
+ "ImpactSAM2VideoDetectorSEGS": SAM2VideoDetectorSEGS, # noqa: F405
+ "ImpactSimpleDetectorSEGS": SimpleDetectorForEach, # noqa: F405
+ "ImpactSimpleDetectorSEGSPipe": SimpleDetectorForEachPipe, # noqa: F405
+ "ImpactControlNetApplySEGS": ControlNetApplySEGS, # noqa: F405
+ "ImpactControlNetApplyAdvancedSEGS": ControlNetApplyAdvancedSEGS, # noqa: F405
+ "ImpactControlNetClearSEGS": ControlNetClearSEGS, # noqa: F405
+ "ImpactIPAdapterApplySEGS": IPAdapterApplySEGS, # noqa: F405
+
+ "ImpactDecomposeSEGS": DecomposeSEGS, # noqa: F405
+ "ImpactAssembleSEGS": AssembleSEGS, # noqa: F405
+ "ImpactFrom_SEG_ELT": From_SEG_ELT, # noqa: F405
+ "ImpactEdit_SEG_ELT": Edit_SEG_ELT, # noqa: F405
+ "ImpactDilate_Mask_SEG_ELT": Dilate_SEG_ELT, # noqa: F405
+ "ImpactDilateMask": DilateMask, # noqa: F405
+ "ImpactGaussianBlurMask": GaussianBlurMask, # noqa: F405
+ "ImpactDilateMaskInSEGS": DilateMaskInSEGS, # noqa: F405
+ "ImpactGaussianBlurMaskInSEGS": GaussianBlurMaskInSEGS, # noqa: F405
+ "ImpactScaleBy_BBOX_SEG_ELT": SEG_ELT_BBOX_ScaleBy, # noqa: F405
+ "ImpactFrom_SEG_ELT_bbox": From_SEG_ELT_bbox, # noqa: F405
+ "ImpactFrom_SEG_ELT_crop_region": From_SEG_ELT_crop_region, # noqa: F405
+ "ImpactCount_Elts_in_SEGS": Count_Elts_in_SEGS, # noqa: F405
+
+ "BboxDetectorCombined_v2": BboxDetectorCombined, # noqa: F405
+ "SegmDetectorCombined_v2": SegmDetectorCombined, # noqa: F405
+ "SegsToCombinedMask": SegsToCombinedMask, # noqa: F405
+
+ "KSamplerProvider": KSamplerProvider, # noqa: F405
+ "TwoSamplersForMask": TwoSamplersForMask, # noqa: F405
+ "TiledKSamplerProvider": TiledKSamplerProvider, # noqa: F405
+
+ "KSamplerAdvancedProvider": KSamplerAdvancedProvider, # noqa: F405
+ "TwoAdvancedSamplersForMask": TwoAdvancedSamplersForMask, # noqa: F405
+
+ "ImpactNegativeConditioningPlaceholder": NegativeConditioningPlaceholder, # noqa: F405
+
+ "PreviewBridge": PreviewBridge, # noqa: F405
+ "PreviewBridgeLatent": PreviewBridgeLatent, # noqa: F405
+ "ImageSender": ImageSender, # noqa: F405
+ "ImageReceiver": ImageReceiver, # noqa: F405
+ "LatentSender": LatentSender, # noqa: F405
+ "LatentReceiver": LatentReceiver, # noqa: F405
+ "ImageMaskSwitch": ImageMaskSwitch, # noqa: F405
+ "LatentSwitch": GeneralSwitch, # noqa: F405
+ "SEGSSwitch": GeneralSwitch, # noqa: F405
+ "ImpactSwitch": GeneralSwitch, # noqa: F405
+ "ImpactInversedSwitch": GeneralInversedSwitch, # noqa: F405
+
+ "ImpactWildcardProcessor": ImpactWildcardProcessor, # noqa: F405
+ "ImpactWildcardEncode": ImpactWildcardEncode, # noqa: F405
+
+ "SEGSUpscaler": SEGSUpscaler, # noqa: F405
+ "SEGSUpscalerPipe": SEGSUpscalerPipe, # noqa: F405
+ "SEGSDetailer": SEGSDetailer, # noqa: F405
+ "SEGSPaste": SEGSPaste, # noqa: F405
+ "SEGSPreview": SEGSPreview, # noqa: F405
+ "SEGSPreviewCNet": SEGSPreviewCNet, # noqa: F405
+ "SEGSToImageList": SEGSToImageList, # noqa: F405
+ "ImpactSEGSToMaskList": SEGSToMaskList, # noqa: F405
+ "ImpactSEGSToMaskBatch": SEGSToMaskBatch, # noqa: F405
+ "ImpactSEGSConcat": SEGSConcat, # noqa: F405
+ "ImpactSEGSPicker": SEGSPicker, # noqa: F405
+ "ImpactMakeTileSEGS": MakeTileSEGS, # noqa: F405
+ "ImpactSEGSMerge": SEGSMerge, # noqa: F405
+
+ "SEGSDetailerForAnimateDiff": SEGSDetailerForAnimateDiff, # noqa: F405
+
+ "ImpactKSamplerBasicPipe": KSamplerBasicPipe, # noqa: F405
+ "ImpactKSamplerAdvancedBasicPipe": KSamplerAdvancedBasicPipe, # noqa: F405
+
+ "ReencodeLatent": ReencodeLatent, # noqa: F405
+ "ReencodeLatentPipe": ReencodeLatentPipe, # noqa: F405
+
+ "ImpactImageBatchToImageList": ImageBatchToImageList, # noqa: F405
+ "ImpactMakeImageList": MakeImageList, # noqa: F405
+ "ImpactMakeImageBatch": MakeImageBatch, # noqa: F405
+ "ImpactMakeAnyList": MakeAnyList, # noqa: F405
+ "ImpactMakeMaskList": MakeMaskList, # noqa: F405
+ "ImpactMakeMaskBatch": MakeMaskBatch, # noqa: F405
+ "ImpactSelectNthItemOfAnyList": NthItemOfAnyList, # noqa: F405
+
+ "RegionalSampler": RegionalSampler, # noqa: F405
+ "RegionalSamplerAdvanced": RegionalSamplerAdvanced, # noqa: F405
+ "CombineRegionalPrompts": CombineRegionalPrompts, # noqa: F405
+ "RegionalPrompt": RegionalPrompt, # noqa: F405
+
+ "ImpactCombineConditionings": CombineConditionings, # noqa: F405
+ "ImpactConcatConditionings": ConcatConditionings, # noqa: F405
+
+ "ImpactSEGSLabelAssign": SEGSLabelAssign, # noqa: F405
+ "ImpactSEGSLabelFilter": SEGSLabelFilter, # noqa: F405
+ "ImpactSEGSRangeFilter": SEGSRangeFilter, # noqa: F405
+ "ImpactSEGSOrderedFilter": SEGSOrderedFilter, # noqa: F405
+ "ImpactSEGSIntersectionFilter": SEGSIntersectionFilter, # noqa: F405
+ "ImpactSEGSNMSFilter": SEGSNMSFilter, # noqa: F405
+
+ "ImpactCompare": ImpactCompare, # noqa: F405
+ "ImpactConditionalBranch": ImpactConditionalBranch, # noqa: F405
+ "ImpactConditionalBranchSelMode": ImpactConditionalBranchSelMode, # noqa: F405
+ "ImpactIfNone": ImpactIfNone, # noqa: F405
+ "ImpactConvertDataType": ImpactConvertDataType, # noqa: F405
+ "ImpactLogicalOperators": ImpactLogicalOperators, # noqa: F405
+ "ImpactInt": ImpactInt, # noqa: F405
+ "ImpactFloat": ImpactFloat, # noqa: F405
+ "ImpactBoolean": ImpactBoolean, # noqa: F405
+ "ImpactValueSender": ImpactValueSender, # noqa: F405
+ "ImpactValueReceiver": ImpactValueReceiver, # noqa: F405
+ "ImpactImageInfo": ImpactImageInfo, # noqa: F405
+ "ImpactLatentInfo": ImpactLatentInfo, # noqa: F405
+ "ImpactMinMax": ImpactMinMax, # noqa: F405
+ "ImpactNeg": ImpactNeg, # noqa: F405
+ "ImpactConditionalStopIteration": ImpactConditionalStopIteration, # noqa: F405
+ "ImpactStringSelector": StringSelector, # noqa: F405
+ "StringListToString": StringListToString, # noqa: F405
+ "WildcardPromptFromString": WildcardPromptFromString, # noqa: F405
+ "ImpactExecutionOrderController": ImpactExecutionOrderController, # noqa: F405
+ "ImpactListBridge": ImpactListBridge, # noqa: F405
+
+ "RemoveNoiseMask": RemoveNoiseMask, # noqa: F405
+
+ "ImpactLogger": ImpactLogger, # noqa: F405
+ "ImpactDummyInput": ImpactDummyInput, # noqa: F405
+
+ "ImpactQueueTrigger": ImpactQueueTrigger, # noqa: F405
+ "ImpactQueueTriggerCountdown": ImpactQueueTriggerCountdown, # noqa: F405
+ "ImpactSetWidgetValue": ImpactSetWidgetValue, # noqa: F405
+ "ImpactNodeSetMuteState": ImpactNodeSetMuteState, # noqa: F405
+ "ImpactControlBridge": ImpactControlBridge, # noqa: F405
+ "ImpactIsNotEmptySEGS": ImpactNotEmptySEGS, # noqa: F405
+ "ImpactSleep": ImpactSleep, # noqa: F405
+ "ImpactRemoteBoolean": ImpactRemoteBoolean, # noqa: F405
+ "ImpactRemoteInt": ImpactRemoteInt, # noqa: F405
+
+ "ImpactHFTransformersClassifierProvider": HF_TransformersClassifierProvider, # noqa: F405
+ "ImpactSEGSClassify": SEGS_Classify, # noqa: F405
+
+ "ImpactSchedulerAdapter": ImpactSchedulerAdapter, # noqa: F405
+ "GITSSchedulerFuncProvider": GITSSchedulerFuncProvider # noqa: F405
+}
+
+
+NODE_DISPLAY_NAME_MAPPINGS = {
+ "SAMLoader": "SAMLoader (Impact)",
+
+ "BboxDetectorSEGS": "BBOX Detector (SEGS)",
+ "SegmDetectorSEGS": "SEGM Detector (SEGS)",
+ "ONNXDetectorSEGS": "ONNX Detector (SEGS/legacy) - use BBOXDetector",
+ "ImpactSimpleDetectorSEGS_for_AD": "Simple Detector for Video (SEGS)",
+ "ImpactSAM2VideoDetectorSEGS": "SAM2 Video Detector (SEGS)",
+ "ImpactSimpleDetectorSEGS": "Simple Detector (SEGS)",
+ "ImpactSimpleDetectorSEGSPipe": "Simple Detector (SEGS/pipe)",
+ "ImpactControlNetApplySEGS": "ControlNetApply (SEGS) - DEPRECATED",
+ "ImpactControlNetApplyAdvancedSEGS": "ControlNetApply (SEGS)",
+ "ImpactIPAdapterApplySEGS": "IPAdapterApply (SEGS)",
+
+ "BboxDetectorCombined_v2": "BBOX Detector (combined)",
+ "SegmDetectorCombined_v2": "SEGM Detector (combined)",
+ "SegsToCombinedMask": "SEGS to MASK (combined)",
+ "MediaPipeFaceMeshToSEGS": "MediaPipe FaceMesh to SEGS",
+ "MaskToSEGS": "MASK to SEGS",
+ "MaskToSEGS_for_AnimateDiff": "MASK to SEGS for Video",
+ "BitwiseAndMaskForEach": "Pixelwise(SEGS & SEGS)",
+ "SubtractMaskForEach": "Pixelwise(SEGS - SEGS)",
+ "ImpactSegsAndMask": "Pixelwise(SEGS & MASK)",
+ "ImpactSegsAndMaskForEach": "Pixelwise(SEGS & MASKS ForEach)",
+ "BitwiseAndMask": "Pixelwise(MASK & MASK)",
+ "SubtractMask": "Pixelwise(MASK - MASK)",
+ "AddMask": "Pixelwise(MASK + MASK)",
+ "MaskRectArea": "Mask Rect Area",
+ "MaskRectAreaAdvanced": "Mask Rect Area (Advanced)",
+ "ImpactFlattenMask": "Flatten Mask Batch",
+ "DetailerForEach": "Detailer (SEGS)",
+ "DetailerForEachAutoRetry": "Detailer (SEGS) with auto retry",
+ "DetailerForEachPipe": "Detailer (SEGS/pipe)",
+ "DetailerForEachDebug": "DetailerDebug (SEGS)",
+ "DetailerForEachDebugPipe": "DetailerDebug (SEGS/pipe)",
+ "SEGSDetailerForAnimateDiff": "SEGSDetailer For Video (SEGS/pipe)",
+ "DetailerForEachPipeForAnimateDiff": "Detailer For Video (SEGS/pipe)",
+ "SEGSUpscaler": "Upscaler (SEGS)",
+ "SEGSUpscalerPipe": "Upscaler (SEGS/pipe)",
+
+ "SAMDetectorCombined": "SAMDetector (combined)",
+ "SAMDetectorSegmented": "SAMDetector (segmented)",
+ "FaceDetailerPipe": "FaceDetailer (pipe)",
+ "MaskDetailerPipe": "MaskDetailer (pipe)",
+
+ "FromDetailerPipeSDXL": "FromDetailer (SDXL/pipe)",
+ "BasicPipeToDetailerPipeSDXL": "BasicPipe -> DetailerPipe (SDXL)",
+ "EditDetailerPipeSDXL": "Edit DetailerPipe (SDXL)",
+
+ "BasicPipeToDetailerPipe": "BasicPipe -> DetailerPipe",
+ "DetailerPipeToBasicPipe": "DetailerPipe -> BasicPipe",
+ "EditBasicPipe": "Edit BasicPipe",
+ "EditDetailerPipe": "Edit DetailerPipe",
+ "AnyPipeToBasic": "Any PIPE -> BasicPipe",
+
+ "LatentPixelScale": "Latent Scale (on Pixel Space)",
+ "IterativeLatentUpscale": "Iterative Upscale (Latent/on Pixel Space)",
+ "IterativeImageUpscale": "Iterative Upscale (Image)",
+
+ "TwoSamplersForMaskUpscalerProvider": "TwoSamplersForMask Upscaler Provider",
+ "TwoSamplersForMaskUpscalerProviderPipe": "TwoSamplersForMask Upscaler Provider (pipe)",
+
+ "ReencodeLatent": "Reencode Latent",
+ "ReencodeLatentPipe": "Reencode Latent (pipe)",
+
+ "ImpactKSamplerBasicPipe": "KSampler (pipe)",
+ "ImpactKSamplerAdvancedBasicPipe": "KSampler (Advanced/pipe)",
+ "ImpactSEGSLabelAssign": "SEGS Assign (label)",
+ "ImpactSEGSLabelFilter": "SEGS Filter (label)",
+ "ImpactSEGSRangeFilter": "SEGS Filter (range)",
+ "ImpactSEGSOrderedFilter": "SEGS Filter (ordered)",
+ "ImpactSEGSIntersectionFilter": "SEGS Filter (intersection)",
+ "ImpactSEGSNMSFilter": "SEGS Filter (non max suppression)",
+ "ImpactSEGSConcat": "SEGS Concat",
+ "ImpactSEGSToMaskList": "SEGS to Mask List",
+ "ImpactSEGSToMaskBatch": "SEGS to Mask Batch",
+ "ImpactSEGSPicker": "Picker (SEGS)",
+ "ImpactMakeTileSEGS": "Make Tile SEGS",
+ "ImpactSEGSMerge": "SEGS Merge",
+
+ "ImpactDecomposeSEGS": "Decompose (SEGS)",
+ "ImpactAssembleSEGS": "Assemble (SEGS)",
+ "ImpactFrom_SEG_ELT": "From SEG_ELT",
+ "ImpactEdit_SEG_ELT": "Edit SEG_ELT",
+ "ImpactFrom_SEG_ELT_bbox": "From SEG_ELT bbox",
+ "ImpactFrom_SEG_ELT_crop_region": "From SEG_ELT crop_region",
+ "ImpactDilate_Mask_SEG_ELT": "Dilate Mask (SEG_ELT)",
+ "ImpactScaleBy_BBOX_SEG_ELT": "ScaleBy BBOX (SEG_ELT)",
+ "ImpactCount_Elts_in_SEGS": "Count Elts in SEGS",
+ "ImpactDilateMask": "Dilate Mask",
+ "ImpactGaussianBlurMask": "Gaussian Blur Mask",
+ "ImpactDilateMaskInSEGS": "Dilate Mask (SEGS)",
+ "ImpactGaussianBlurMaskInSEGS": "Gaussian Blur Mask (SEGS)",
+
+ "PreviewBridge": "Preview Bridge (Image)",
+ "PreviewBridgeLatent": "Preview Bridge (Latent)",
+ "ImageSender": "Image Sender",
+ "ImageReceiver": "Image Receiver",
+ "ImageMaskSwitch": "Switch (images, mask)",
+ "ImpactSwitch": "Switch (Any)",
+ "ImpactInversedSwitch": "Inversed Switch (Any)",
+ "ImpactExecutionOrderController": "Execution Order Controller",
+ "ImpactListBridge": "List Bridge",
+
+ "MasksToMaskList": "Mask Batch to Mask List",
+ "MaskListToMaskBatch": "Mask List to Mask Batch",
+ "ImpactImageBatchToImageList": "Image Batch to Image List",
+ "ImageListToImageBatch": "Image List to Image Batch",
+
+ "ImpactMakeImageList": "Make Image List",
+ "ImpactMakeImageBatch": "Make Image Batch",
+ "ImpactMakeMaskList": "Make Mask List",
+ "ImpactMakeMaskBatch": "Make Mask Batch",
+ "ImpactMakeAnyList": "Make List (Any)",
+ "ImpactSelectNthItemOfAnyList": "Select Nth Item (Any list)",
+
+ "ImpactStringSelector": "String Selector",
+ "StringListToString": "String List to String",
+ "WildcardPromptFromString": "Wildcard Prompt from String",
+ "ImpactIsNotEmptySEGS": "SEGS isn't Empty",
+ "SetDefaultImageForSEGS": "Set Default Image for SEGS",
+ "RemoveImageFromSEGS": "Remove Image from SEGS",
+
+ "RemoveNoiseMask": "Remove Noise Mask",
+
+ "ImpactCombineConditionings": "Combine Conditionings",
+ "ImpactConcatConditionings": "Concat Conditionings",
+
+ "ImpactQueueTrigger": "Queue Trigger",
+ "ImpactQueueTriggerCountdown": "Queue Trigger (Countdown)",
+ "ImpactSetWidgetValue": "Set Widget Value",
+ "ImpactNodeSetMuteState": "Set Mute State",
+ "ImpactControlBridge": "Control Bridge",
+ "ImpactSleep": "Sleep",
+ "ImpactRemoteBoolean": "Remote Boolean (on prompt)",
+ "ImpactRemoteInt": "Remote Int (on prompt)",
+
+ "ImpactHFTransformersClassifierProvider": "HF Transformers Classifier Provider",
+ "ImpactSEGSClassify": "SEGS Classify",
+
+ "LatentSwitch": "Switch (latent/legacy)",
+ "SEGSSwitch": "Switch (SEGS/legacy)",
+
+ "SEGSPreviewCNet": "SEGSPreview (CNET Image)",
+
+ "ImpactSchedulerAdapter": "Impact Scheduler Adapter",
+ "GITSSchedulerFuncProvider": "GITSScheduler Func Provider",
+ "ImpactNegativeConditioningPlaceholder": "Negative Cond Placeholder"
+}
+
+
+# NOTE: Inject directly into EXTENSION_WEB_DIRS instead of WEB_DIRECTORY
+# Provide the js path fixed as ComfyUI-Impact-Pack instead of the path name, making it available for external use
+
+# WEB_DIRECTORY = "js" -- deprecated method
+nodes.EXTENSION_WEB_DIRS["ComfyUI-Impact-Pack"] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'js')
+
+
+__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
diff --git a/docs/hel-892/tts-reference/impact__modules__impact__core.py b/docs/hel-892/tts-reference/impact__modules__impact__core.py
new file mode 100644
index 00000000..801b71fb
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact__modules__impact__core.py
@@ -0,0 +1,2417 @@
+import os
+import warnings
+
+import torch
+from segment_anything import SamPredictor
+
+from comfy_extras.nodes_custom_sampler import Noise_RandomNoise
+from collections import namedtuple
+import numpy as np
+from PIL import ImageOps, Image
+
+import nodes
+from server import PromptServer
+import comfy
+import impact.wildcards as wildcards
+import math
+import cv2
+import time
+from comfy import model_management
+from impact import utils
+from impact import impact_sampling
+from concurrent.futures import ThreadPoolExecutor
+import inspect
+from collections import OrderedDict
+import torch.nn.functional as F
+import logging
+import sys
+import importlib
+
+
+is_sam2_available = importlib.util.find_spec("sam2")
+sam2_unavailable_message = f"\n----------------------------------------------------------------------------\n[Impact Pack] The SAM2 functionality is unavailable because the `facebook/sam2` dependency is not installed.\n\nInstallation command:\n{sys.executable} -m pip install git+https://github.com/facebookresearch/sam2\n----------------------------------------------------------------------------\n"
+if is_sam2_available:
+ from sam2.sam2_image_predictor import SAM2ImagePredictor
+ from sam2.build_sam import build_sam2, build_sam2_video_predictor
+else:
+ logging.warning(sam2_unavailable_message)
+
+try:
+ from comfy_extras import nodes_differential_diffusion
+except Exception:
+ logging.warning("\n#############################################\n[Impact Pack] ComfyUI is an outdated version.\n#############################################\n")
+ raise Exception("[Impact Pack] ComfyUI is an outdated version.")
+
+
+SEG = namedtuple("SEG",
+ ['cropped_image', 'cropped_mask', 'confidence', 'crop_region', 'bbox', 'label', 'control_net_wrapper'],
+ defaults=[None])
+
+pb_id_cnt = time.time()
+preview_bridge_image_id_map = {}
+preview_bridge_image_name_map = {}
+
+preview_bridge_cache = {}
+preview_bridge_last_mask_cache = {}
+
+current_prompt = None
+
+ADDITIONAL_SCHEDULERS = ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]', 'LTXV[default]', 'OSS FLUX', 'OSS Wan', 'OSS Chroma']
+
+def get_schedulers():
+ return list(comfy.samplers.SCHEDULER_HANDLERS) + ADDITIONAL_SCHEDULERS
+
+def is_execution_model_version_supported():
+ try:
+ import comfy_execution # noqa: F401
+ return True
+ except Exception:
+ return False
+
+
+def set_previewbridge_image(node_id, file, item):
+ global pb_id_cnt
+
+ if file in preview_bridge_image_name_map:
+ pb_id = preview_bridge_image_name_map[node_id, file]
+ if pb_id.startswith(f"${node_id}"):
+ return pb_id
+
+ pb_id = f"${node_id}-{pb_id_cnt}"
+ preview_bridge_image_id_map[pb_id] = (file, item)
+ preview_bridge_image_name_map[node_id, file] = (pb_id, item)
+ if os.path.isfile(file):
+ i = Image.open(file)
+ i = ImageOps.exif_transpose(i)
+ if 'A' in i.getbands():
+ mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0
+ mask = 1. - torch.from_numpy(mask)
+ preview_bridge_last_mask_cache[node_id] = mask.unsqueeze(0)
+ pb_id_cnt += 1
+
+ return pb_id
+
+
+def erosion_mask(mask, grow_mask_by):
+ mask = utils.make_2d_mask(mask)
+
+ w = mask.shape[1]
+ h = mask.shape[0]
+
+ device = comfy.model_management.get_torch_device()
+ mask = mask.clone().to(device)
+ mask2 = torch.nn.functional.interpolate(mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])), size=(w, h), mode="bilinear").to(device)
+ if grow_mask_by == 0:
+ mask_erosion = mask2
+ else:
+ kernel_tensor = torch.ones((1, 1, grow_mask_by, grow_mask_by)).to(device)
+ padding = math.ceil((grow_mask_by - 1) / 2)
+
+ mask_erosion = torch.clamp(torch.nn.functional.conv2d(mask2.round(), kernel_tensor, padding=padding), 0, 1)
+
+ return mask_erosion[:, :, :w, :h].round().cpu()
+
+
+# CREDIT: https://github.com/BlenderNeko/ComfyUI_Noise/blob/afb14757216257b12268c91845eac248727a55e2/nodes.py#L68
+# https://discuss.pytorch.org/t/help-regarding-slerp-function-for-generative-model-sampling/32475/3
+def slerp(val, low, high):
+ dims = low.shape
+
+ low = low.reshape(dims[0], -1)
+ high = high.reshape(dims[0], -1)
+
+ low_norm = low/torch.norm(low, dim=1, keepdim=True)
+ high_norm = high/torch.norm(high, dim=1, keepdim=True)
+
+ low_norm[low_norm != low_norm] = 0.0
+ high_norm[high_norm != high_norm] = 0.0
+
+ omega = torch.acos((low_norm*high_norm).sum(1))
+ so = torch.sin(omega)
+ res = (torch.sin((1.0-val)*omega)/so).unsqueeze(1)*low + (torch.sin(val*omega)/so).unsqueeze(1) * high
+
+ return res.reshape(dims)
+
+
+def mix_noise(from_noise, to_noise, strength, variation_method):
+ if variation_method == 'slerp':
+ mixed_noise = slerp(strength, from_noise, to_noise)
+ else:
+ # linear
+ mixed_noise = (1 - strength) * from_noise + strength * to_noise
+
+ # NOTE: Since the variance of the Gaussian noise in mixed_noise has changed, it must be corrected through scaling.
+ scale_factor = math.sqrt((1 - strength) ** 2 + strength ** 2)
+ mixed_noise /= scale_factor
+
+ return mixed_noise
+
+
+class REGIONAL_PROMPT:
+ def __init__(self, mask, sampler, variation_seed=0, variation_strength=0.0, variation_method='linear'):
+ mask = utils.make_2d_mask(mask)
+
+ self.mask = mask
+ self.sampler = sampler
+ self.mask_erosion = None
+ self.erosion_factor = None
+ self.variation_seed = variation_seed
+ self.variation_strength = variation_strength
+ self.variation_method = variation_method
+
+ def clone_with_sampler(self, sampler):
+ rp = REGIONAL_PROMPT(self.mask, sampler)
+ rp.mask_erosion = self.mask_erosion
+ rp.erosion_factor = self.erosion_factor
+ rp.variation_seed = self.variation_seed
+ rp.variation_strength = self.variation_strength
+ rp.variation_method = self.variation_method
+ return rp
+
+ def get_mask_erosion(self, factor):
+ if self.mask_erosion is None or self.erosion_factor != factor:
+ self.mask_erosion = erosion_mask(self.mask, factor)
+ self.erosion_factor = factor
+
+ return self.mask_erosion
+
+ def touch_noise(self, noise):
+ if self.variation_strength > 0.0:
+ mask = utils.make_3d_mask(self.mask)
+ mask = utils.resize_mask(mask, (noise.shape[2], noise.shape[3])).unsqueeze(0)
+
+ regional_noise = Noise_RandomNoise(self.variation_seed).generate_noise({'samples': noise})
+ mixed_noise = mix_noise(noise, regional_noise, self.variation_strength, variation_method=self.variation_method)
+
+ return (mask == 1).float() * mixed_noise + (mask == 0).float() * noise
+
+ return noise
+
+
+class NO_BBOX_DETECTOR:
+ pass
+
+
+class NO_SEGM_DETECTOR:
+ pass
+
+
+def create_segmasks(results):
+ bboxs = results[1]
+ segms = results[2]
+ confidence = results[3]
+
+ results = []
+ for i in range(len(segms)):
+ item = (bboxs[i], segms[i].astype(np.float32), confidence[i])
+ results.append(item)
+ return results
+
+
+def gen_detection_hints_from_mask_area(x, y, mask, threshold, use_negative):
+ mask = utils.make_2d_mask(mask)
+
+ points = []
+ plabs = []
+
+ # minimum sampling step >= 3
+ y_step = max(3, int(mask.shape[0] / 20))
+ x_step = max(3, int(mask.shape[1] / 20))
+
+ for i in range(0, len(mask), y_step):
+ for j in range(0, len(mask[i]), x_step):
+ if mask[i][j] > threshold:
+ points.append((x + j, y + i))
+ plabs.append(1)
+ elif use_negative and mask[i][j] == 0:
+ points.append((x + j, y + i))
+ plabs.append(0)
+
+ return points, plabs
+
+
+def gen_negative_hints(w, h, x1, y1, x2, y2):
+ npoints = []
+ nplabs = []
+
+ # minimum sampling step >= 3
+ y_step = max(3, int(w / 20))
+ x_step = max(3, int(h / 20))
+
+ for i in range(10, h - 10, y_step):
+ for j in range(10, w - 10, x_step):
+ if not (x1 - 10 <= j and j <= x2 + 10 and y1 - 10 <= i and i <= y2 + 10):
+ npoints.append((j, i))
+ nplabs.append(0)
+
+ return npoints, nplabs
+
+
+def enhance_detail(image, model, clip, vae, guide_size, guide_size_for_bbox, max_size, bbox, seed, steps, cfg,
+ sampler_name,
+ scheduler, positive, negative, denoise, noise_mask, force_inpaint,
+ wildcard_opt=None, wildcard_opt_concat_mode=None,
+ detailer_hook=None,
+ refiner_ratio=None, refiner_model=None, refiner_clip=None, refiner_positive=None,
+ refiner_negative=None, control_net_wrapper=None, cycle=1,
+ inpaint_model=False, noise_mask_feather=0, scheduler_func=None,
+ vae_tiled_encode=False, vae_tiled_decode=False):
+
+ if noise_mask is not None:
+ noise_mask = utils.tensor_gaussian_blur_mask(noise_mask, noise_mask_feather)
+ noise_mask = noise_mask.squeeze(3)
+
+ if noise_mask_feather > 0 and 'denoise_mask_function' not in model.model_options:
+ model = nodes_differential_diffusion.DifferentialDiffusion().execute(model)[0]
+
+ if wildcard_opt is not None and wildcard_opt != "":
+ model, _, wildcard_positive = wildcards.process_with_loras(wildcard_opt, model, clip)
+
+ if wildcard_opt_concat_mode == "concat":
+ positive = nodes.ConditioningConcat().concat(positive, wildcard_positive)[0]
+ else:
+ positive = wildcard_positive
+ positive = [positive[0].copy()]
+ if 'pooled_output' in wildcard_positive[0][1]:
+ positive[0][1]['pooled_output'] = wildcard_positive[0][1]['pooled_output']
+ elif 'pooled_output' in positive[0][1]:
+ del positive[0][1]['pooled_output']
+
+ h = image.shape[1]
+ w = image.shape[2]
+
+ bbox_h = bbox[3] - bbox[1]
+ bbox_w = bbox[2] - bbox[0]
+
+ # Skip processing if the detected bbox is already larger than the guide_size
+ if not force_inpaint and bbox_h >= guide_size and bbox_w >= guide_size:
+ logging.info("Detailer: segment skip (enough big)")
+ return None, None
+
+ if guide_size_for_bbox: # == "bbox"
+ # Scale up based on the smaller dimension between width and height.
+ upscale = guide_size / min(bbox_w, bbox_h)
+ else:
+ # for cropped_size
+ upscale = guide_size / min(w, h)
+
+ new_w = int(w * upscale)
+ new_h = int(h * upscale)
+
+ # safeguard
+ if 'aitemplate_keep_loaded' in model.model_options:
+ max_size = min(4096, max_size)
+
+ if new_w > max_size or new_h > max_size:
+ upscale *= max_size / max(new_w, new_h)
+ new_w = int(w * upscale)
+ new_h = int(h * upscale)
+
+ if not force_inpaint:
+ if upscale <= 1.0:
+ logging.info(f"Detailer: segment skip [determined upscale factor={upscale}]")
+ return None, None
+
+ if new_w == 0 or new_h == 0:
+ logging.info(f"Detailer: segment skip [zero size={new_w, new_h}]")
+ return None, None
+ else:
+ if upscale <= 1.0 or new_w == 0 or new_h == 0:
+ logging.info("Detailer: force inpaint")
+ upscale = 1.0
+ new_w = w
+ new_h = h
+
+ if detailer_hook is not None:
+ new_w, new_h = detailer_hook.touch_scaled_size(new_w, new_h)
+
+ logging.info(f"Detailer: segment upscale for ({bbox_w, bbox_h}) | crop region {w, h} x {upscale} -> {new_w, new_h}")
+
+ # upscale
+ upscaled_image = utils.tensor_resize(image, new_w, new_h)
+
+ if detailer_hook is not None:
+ upscaled_image = detailer_hook.post_upscale(upscaled_image, noise_mask)
+
+ cnet_pils = None
+ if control_net_wrapper is not None:
+ positive, negative, cnet_pils = control_net_wrapper.apply(positive, negative, upscaled_image, noise_mask)
+ model, cnet_pils2 = control_net_wrapper.doit_ipadapter(model)
+ cnet_pils.extend(cnet_pils2)
+
+ # prepare mask
+ if detailer_hook is None or not detailer_hook.get_skip_sampling():
+ if noise_mask is not None and inpaint_model:
+ imc_encode = nodes.InpaintModelConditioning().encode
+ if 'noise_mask' in inspect.signature(imc_encode).parameters:
+ positive, negative, latent_image = imc_encode(positive, negative, upscaled_image, vae, mask=noise_mask, noise_mask=True)
+ else:
+ logging.warning("[Impact Pack] ComfyUI is an outdated version.")
+ positive, negative, latent_image = imc_encode(positive, negative, upscaled_image, vae, noise_mask)
+ else:
+ latent_image = utils.to_latent_image(upscaled_image, vae, vae_tiled_encode=vae_tiled_encode)
+ if noise_mask is not None:
+ latent_image['noise_mask'] = noise_mask
+
+ if detailer_hook is not None:
+ latent_image = detailer_hook.post_encode(latent_image)
+
+ refined_latent = latent_image
+
+ sampler_opt=None
+ if detailer_hook is not None:
+ sampler_opt = detailer_hook.get_custom_sampler()
+
+ # ksampler
+ for i in range(0, cycle):
+ if detailer_hook is not None:
+ if detailer_hook is not None:
+ detailer_hook.set_steps((i, cycle))
+
+ refined_latent = detailer_hook.cycle_latent(refined_latent)
+
+ model2, seed2, steps2, cfg2, sampler_name2, scheduler2, positive2, negative2, upscaled_latent2, denoise2 = \
+ detailer_hook.pre_ksample(model, seed+i, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise)
+ noise, is_touched = detailer_hook.get_custom_noise(seed+i, torch.zeros(latent_image['samples'].size()), is_touched=False)
+ if not is_touched:
+ noise = None
+ else:
+ model2, seed2, steps2, cfg2, sampler_name2, scheduler2, positive2, negative2, _, denoise2 = \
+ model, seed + i, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise
+ noise = None
+
+ refined_latent = impact_sampling.ksampler_wrapper(model2, seed2, steps2, cfg2, sampler_name2, scheduler2, positive2, negative2,
+ refined_latent, denoise2, refiner_ratio, refiner_model, refiner_clip, refiner_positive, refiner_negative,
+ noise=noise, scheduler_func=scheduler_func, sampler_opt=sampler_opt)
+
+ if detailer_hook is not None:
+ refined_latent = detailer_hook.pre_decode(refined_latent)
+
+ # non-latent downscale - latent downscale cause bad quality
+ start = time.time()
+ if vae_tiled_decode:
+ (refined_image,) = nodes.VAEDecodeTiled().decode(vae, refined_latent, 512) # using default settings
+ logging.info(f"[Impact Pack] vae decoded (tiled) in {time.time() - start:.1f}s")
+ else:
+ try:
+ refined_image = vae.decode(refined_latent['samples'])
+ except Exception:
+ # usually an out-of-memory exception from the decode, so try a tiled approach
+ logging.warning(f"[Impact Pack] failed after {time.time() - start:.1f}s, doing vae.decode_tiled 64...")
+ refined_image = vae.decode_tiled(refined_latent["samples"], tile_x=64, tile_y=64, )
+ logging.info(f"[Impact Pack] vae decoded in {time.time() - start:.1f}s")
+ else:
+ # skipped
+ refined_image = upscaled_image
+
+ if detailer_hook is not None:
+ refined_image = detailer_hook.post_decode(refined_image)
+
+ # downscale
+
+ # workaround: support WAN as an i2i model
+ if len(refined_image.shape) == 5:
+ refined_image = refined_image.squeeze(0)
+
+ refined_image = utils.tensor_resize(refined_image, w, h)
+
+ # prevent mixing of device
+ refined_image = refined_image.cpu()
+
+ # don't convert to latent - latent break image
+ # preserving pil is much better
+ return refined_image, cnet_pils
+
+
+def enhance_detail_for_animatediff(image_frames, model, clip, vae, guide_size, guide_size_for_bbox, max_size, bbox, seed, steps, cfg,
+ sampler_name,
+ scheduler, positive, negative, denoise, noise_mask,
+ wildcard_opt=None, wildcard_opt_concat_mode=None,
+ detailer_hook=None,
+ refiner_ratio=None, refiner_model=None, refiner_clip=None, refiner_positive=None,
+ refiner_negative=None, control_net_wrapper=None, noise_mask_feather=0, scheduler_func=None):
+ if noise_mask is not None:
+ noise_mask = utils.tensor_gaussian_blur_mask(noise_mask, noise_mask_feather)
+ noise_mask = noise_mask.squeeze(3)
+
+ if noise_mask_feather > 0 and 'denoise_mask_function' not in model.model_options:
+ model = nodes_differential_diffusion.DifferentialDiffusion().execute(model)[0]
+
+ if wildcard_opt is not None and wildcard_opt != "":
+ model, _, wildcard_positive = wildcards.process_with_loras(wildcard_opt, model, clip)
+
+ if wildcard_opt_concat_mode == "concat":
+ positive = nodes.ConditioningConcat().concat(positive, wildcard_positive)[0]
+ else:
+ positive = wildcard_positive
+
+ h = image_frames.shape[1]
+ w = image_frames.shape[2]
+
+ bbox_h = bbox[3] - bbox[1]
+ bbox_w = bbox[2] - bbox[0]
+
+ # Skip processing if the detected bbox is already larger than the guide_size
+ if guide_size_for_bbox: # == "bbox"
+ # Scale up based on the smaller dimension between width and height.
+ upscale = guide_size / min(bbox_w, bbox_h)
+ else:
+ # for cropped_size
+ upscale = guide_size / min(w, h)
+
+ new_w = int(w * upscale)
+ new_h = int(h * upscale)
+
+ # safeguard
+ if 'aitemplate_keep_loaded' in model.model_options:
+ max_size = min(4096, max_size)
+
+ if new_w > max_size or new_h > max_size:
+ upscale *= max_size / max(new_w, new_h)
+ new_w = int(w * upscale)
+ new_h = int(h * upscale)
+
+ if upscale <= 1.0 or new_w == 0 or new_h == 0:
+ logging.info("Detailer: force inpaint")
+ upscale = 1.0
+ new_w = w
+ new_h = h
+
+ if detailer_hook is not None:
+ new_w, new_h = detailer_hook.touch_scaled_size(new_w, new_h)
+
+ logging.info(f"Detailer: segment upscale for ({bbox_w, bbox_h}) | crop region {w, h} x {upscale} -> {new_w, new_h}")
+
+ # upscale the mask tensor by a factor of 2 using bilinear interpolation
+ if isinstance(noise_mask, np.ndarray):
+ noise_mask = torch.from_numpy(noise_mask)
+
+ if len(noise_mask.shape) == 2:
+ noise_mask = noise_mask.unsqueeze(0)
+ else: # == 3
+ noise_mask = noise_mask
+
+ upscaled_mask = None
+
+ for single_mask in noise_mask:
+ single_mask = single_mask.unsqueeze(0).unsqueeze(0)
+ upscaled_single_mask = torch.nn.functional.interpolate(single_mask, size=(new_h, new_w), mode='bilinear', align_corners=False)
+ upscaled_single_mask = upscaled_single_mask.squeeze(0)
+
+ if upscaled_mask is None:
+ upscaled_mask = upscaled_single_mask
+ else:
+ upscaled_mask = torch.cat((upscaled_mask, upscaled_single_mask), dim=0)
+
+ latent_frames = None
+ for image in image_frames:
+ image = torch.from_numpy(image).unsqueeze(0)
+
+ # upscale
+ upscaled_image = utils.tensor_resize(image, new_w, new_h)
+
+ # ksampler
+ samples = utils.to_latent_image(upscaled_image, vae)['samples']
+
+ if latent_frames is None:
+ latent_frames = samples
+ else:
+ latent_frames = torch.concat((latent_frames, samples), dim=0)
+
+ cnet_images = None
+ if control_net_wrapper is not None:
+ positive, negative, cnet_images = control_net_wrapper.apply(positive, negative, torch.from_numpy(image_frames), noise_mask, use_acn=True)
+
+ if len(upscaled_mask) != len(image_frames) and len(upscaled_mask) > 1:
+ logging.warning(f"[Impact Pack] DetailerForAnimateDiff: The number of the mask frames({len(upscaled_mask)}) and the image frames({len(image_frames)}) are different. Combine the mask frames and apply.")
+ combined_mask = upscaled_mask[0].to(torch.uint8)
+
+ for frame_mask in upscaled_mask[1:]:
+ combined_mask |= (frame_mask * 255).to(torch.uint8)
+
+ combined_mask = (combined_mask/255.0).to(torch.float32)
+
+ upscaled_mask = combined_mask.expand(len(image_frames), -1, -1)
+ upscaled_mask = utils.to_binary_mask(upscaled_mask, 0.1)
+
+ latent = {
+ 'noise_mask': upscaled_mask,
+ 'samples': latent_frames
+ }
+
+
+ sampler_opt=None
+ if detailer_hook is not None:
+ sampler_opt = detailer_hook.get_custom_sampler()
+
+ if detailer_hook is not None:
+ latent = detailer_hook.post_encode(latent)
+
+ refined_latent = impact_sampling.ksampler_wrapper(model, seed, steps, cfg, sampler_name, scheduler, positive, negative,
+ latent, denoise, refiner_ratio, refiner_model, refiner_clip, refiner_positive, refiner_negative, scheduler_func=scheduler_func, sampler_opt=sampler_opt)
+
+ if detailer_hook is not None:
+ refined_latent = detailer_hook.pre_decode(refined_latent)
+
+ refined_image_frames = None
+ for refined_sample in refined_latent['samples']:
+ refined_sample = refined_sample.unsqueeze(0)
+
+ # non-latent downscale - latent downscale cause bad quality
+ refined_image = vae.decode(refined_sample)
+
+ if refined_image_frames is None:
+ refined_image_frames = refined_image
+ else:
+ refined_image_frames = torch.concat((refined_image_frames, refined_image), dim=0)
+
+ if detailer_hook is not None:
+ refined_image_frames = detailer_hook.post_decode(refined_image_frames)
+
+ refined_image_frames = nodes.ImageScale().upscale(image=refined_image_frames, upscale_method='lanczos', width=w, height=h, crop='disabled')[0]
+
+ return refined_image_frames, cnet_images
+
+
+def composite_to(dest_latent, crop_region, src_latent):
+ x1 = crop_region[0]
+ y1 = crop_region[1]
+
+ # composite to original latent
+ lc = nodes.LatentComposite()
+ orig_image = lc.composite(dest_latent, src_latent, x1, y1)
+
+ return orig_image[0]
+
+
+def sam_predict(predictor, points, plabs, bbox, threshold):
+ point_coords = None if not points else np.array(points)
+ point_labels = None if not plabs else np.array(plabs)
+
+ box = np.array([bbox]) if bbox is not None else None
+
+ cur_masks, scores, _ = predictor.predict(point_coords=point_coords, point_labels=point_labels, box=box)
+
+ total_masks = []
+
+ selected = False
+ max_score = 0
+ max_mask = None
+ for idx in range(len(scores)):
+ if scores[idx] > max_score:
+ max_score = scores[idx]
+ max_mask = cur_masks[idx]
+
+ if scores[idx] >= threshold:
+ selected = True
+ total_masks.append(cur_masks[idx])
+ else:
+ pass
+
+ if not selected and max_mask is not None:
+ total_masks.append(max_mask)
+
+ return total_masks
+
+
+class SAMWrapper:
+ def __init__(self, model, is_auto_mode, safe_to_gpu=None):
+ self.model = model
+ self.safe_to_gpu = safe_to_gpu if safe_to_gpu is not None else SafeToGPU_stub()
+ self.is_auto_mode = is_auto_mode
+
+ def prepare_device(self):
+ if self.is_auto_mode:
+ device = comfy.model_management.get_torch_device()
+ self.safe_to_gpu.to_device(self.model, device=device)
+
+ def release_device(self):
+ if self.is_auto_mode:
+ self.model.to(device="cpu")
+
+ def predict(self, image, points, plabs, bbox, threshold):
+ predictor = SamPredictor(self.model)
+ predictor.set_image(image, "RGB")
+
+ return sam_predict(predictor, points, plabs, bbox, threshold)
+
+
+class SAM2Wrapper:
+ def __init__(self, config, modelname, is_auto_mode, safe_to_gpu=None, device_mode="AUTO"):
+ self.config = config
+ self.modelname = modelname
+ self.image_predictor = None
+ self.video_predictor = None
+ self.device_mode = device_mode
+ self.safe_to_gpu = safe_to_gpu if safe_to_gpu is not None else SafeToGPU_stub()
+ self.is_auto_mode = is_auto_mode
+
+ def prepare_device(self):
+ pass
+
+ def prepare_image_device(self):
+ if self.is_auto_mode:
+ device = comfy.model_management.get_torch_device()
+ self.safe_to_gpu.to_device(self.image_predictor.model, device=device)
+
+ def prepare_video_device(self):
+ if self.is_auto_mode:
+ device = comfy.model_management.get_torch_device()
+ self.safe_to_gpu.to_device(self.video_predictor, device=device)
+
+ def release_device(self):
+ if self.is_auto_mode:
+ if self.image_predictor:
+ self.image_predictor.model.to(device="cpu")
+ if self.video_predictor:
+ self.video_predictor.to(device="cpu")
+
+ def predict(self, image, points, plabs, bbox, threshold):
+ if not is_sam2_available:
+ raise Exception(sam2_unavailable_message)
+
+ if self.image_predictor is None:
+ self.image_predictor = SAM2ImagePredictor(build_sam2(self.config, self.modelname))
+
+ self.prepare_image_device()
+
+ self.image_predictor.set_image(image)
+
+ return sam_predict(self.image_predictor, points, plabs, bbox, threshold)
+
+ def predict_video_segs(self, image_frames, segs):
+ if not is_sam2_available:
+ raise Exception(sam2_unavailable_message)
+
+ if self.video_predictor is None:
+ self.video_predictor = build_sam2_video_predictor(self.config, self.modelname)
+
+ self.prepare_video_device()
+
+ orig_video_height = image_frames.shape[1]
+ orig_video_width = image_frames.shape[2]
+
+ image_frames, padding = utils.resize_with_padding(image_frames, self.video_predictor.image_size, self.video_predictor.image_size)
+ image_frames = image_frames.permute(0, 3, 1, 2)
+
+ inference_state = {}
+ inference_state["images"] = image_frames
+ inference_state["num_frames"] = len(image_frames)
+ inference_state["video_height"] = self.video_predictor.image_size
+ inference_state["video_width"] = self.video_predictor.image_size
+ inference_state["offload_video_to_cpu"] = True
+ inference_state["offload_state_to_cpu"] = self.device_mode == "CPU"
+ inference_state["device"] = self.video_predictor.device
+
+ if inference_state["offload_state_to_cpu"]:
+ inference_state["storage_device"] = torch.device("cpu")
+ else:
+ inference_state["storage_device"] = self.video_predictor.device
+
+ inference_state["point_inputs_per_obj"] = {}
+ inference_state["mask_inputs_per_obj"] = {}
+ inference_state["cached_features"] = {}
+ inference_state["constants"] = {}
+
+ inference_state["obj_id_to_idx"] = OrderedDict()
+ inference_state["obj_idx_to_id"] = OrderedDict()
+ inference_state["obj_ids"] = []
+
+ inference_state["output_dict_per_obj"] = {}
+ inference_state["temp_output_dict_per_obj"] = {}
+ inference_state["frames_tracked_per_obj"] = {}
+ self.video_predictor._get_image_feature(inference_state, frame_idx=0, batch_size=1)
+
+ temp_masks = {}
+ for i in range(0, len(segs[1])):
+ bbox = segs[1][i].bbox
+
+ adjusted_bbox = utils.adjust_bbox_after_resize(
+ bbox,
+ (orig_video_height, orig_video_width),
+ (self.video_predictor.image_size, self.video_predictor.image_size),
+ padding
+ )
+
+ points = [utils.center_of_bbox(adjusted_bbox)]
+ plabs = [1]
+ self.video_predictor.add_new_points_or_box(inference_state=inference_state, frame_idx=0, obj_id=i, points=points, labels=plabs, box=adjusted_bbox)
+ temp_masks[i] = []
+
+ for frame_idx, object_ids, masks in self.video_predictor.propagate_in_video(inference_state):
+ for i in object_ids:
+ m = masks[i]
+ m = m.permute(1, 2, 0)
+ temp_masks[i].append(m)
+
+ result = {}
+ for k, v in temp_masks.items():
+ m = torch.stack(v, dim=0)
+ m = utils.remove_padding(m, padding)
+ result[k] = utils.resize_with_padding(m, orig_video_width, orig_video_height)[0]
+
+ return result
+
+class ESAMWrapper:
+ def __init__(self, model, device):
+ self.model = model
+ self.func_inference = nodes.NODE_CLASS_MAPPINGS['Yoloworld_ESAM_Zho']
+ self.device = device
+
+ def prepare_device(self):
+ pass
+
+ def release_device(self):
+ pass
+
+ def predict(self, image, points, plabs, bbox, threshold):
+ if self.device == 'CPU':
+ self.device = 'cpu'
+ else:
+ self.device = 'cuda'
+
+ detected_masks = self.func_inference.inference_sam_with_boxes(image=image, xyxy=[bbox], model=self.model, device=self.device)
+ return [detected_masks.squeeze(0)]
+
+
+def make_sam_mask(sam, segs, image, detection_hint, dilation,
+ threshold, bbox_expansion, mask_hint_threshold, mask_hint_use_negative):
+
+ if not hasattr(sam, 'sam_wrapper') and not isinstance(sam, SAM2Wrapper):
+ raise Exception("[Impact Pack] Invalid SAMLoader is connected. Make sure 'SAMLoader (Impact)'.\nKnown issue: The ComfyUI-YOLO node overrides the SAMLoader (Impact), making it unusable. You need to uninstall ComfyUI-YOLO.\n\n\n")
+
+
+ if isinstance(sam, SAM2Wrapper):
+ sam_obj = sam
+ else:
+ sam_obj = sam.sam_wrapper
+
+ sam_obj.prepare_device()
+
+ try:
+ image = np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8)
+
+ total_masks = []
+
+ use_small_negative = mask_hint_use_negative == "Small"
+
+ # seg_shape = segs[0]
+ segs = segs[1]
+ if detection_hint == "mask-points":
+ points = []
+ plabs = []
+
+ for i in range(len(segs)):
+ bbox = segs[i].bbox
+ center = utils.center_of_bbox(segs[i].bbox)
+ points.append(center)
+
+ # small point is background, big point is foreground
+ if use_small_negative and bbox[2] - bbox[0] < 10:
+ plabs.append(0)
+ else:
+ plabs.append(1)
+
+ detected_masks = sam_obj.predict(image, points, plabs, None, threshold)
+ total_masks += detected_masks
+
+ else:
+ for i in range(len(segs)):
+ bbox = segs[i].bbox
+ center = utils.center_of_bbox(bbox)
+
+ x1 = max(bbox[0] - bbox_expansion, 0)
+ y1 = max(bbox[1] - bbox_expansion, 0)
+ x2 = min(bbox[2] + bbox_expansion, image.shape[1])
+ y2 = min(bbox[3] + bbox_expansion, image.shape[0])
+
+ dilated_bbox = [x1, y1, x2, y2]
+
+ points = []
+ plabs = []
+ if detection_hint == "center-1":
+ points.append(center)
+ plabs = [1] # 1 = foreground point, 0 = background point
+
+ elif detection_hint == "horizontal-2":
+ gap = (x2 - x1) / 3
+ points.append((x1 + gap, center[1]))
+ points.append((x1 + gap * 2, center[1]))
+ plabs = [1, 1]
+
+ elif detection_hint == "vertical-2":
+ gap = (y2 - y1) / 3
+ points.append((center[0], y1 + gap))
+ points.append((center[0], y1 + gap * 2))
+ plabs = [1, 1]
+
+ elif detection_hint == "rect-4":
+ x_gap = (x2 - x1) / 3
+ y_gap = (y2 - y1) / 3
+ points.append((x1 + x_gap, center[1]))
+ points.append((x1 + x_gap * 2, center[1]))
+ points.append((center[0], y1 + y_gap))
+ points.append((center[0], y1 + y_gap * 2))
+ plabs = [1, 1, 1, 1]
+
+ elif detection_hint == "diamond-4":
+ x_gap = (x2 - x1) / 3
+ y_gap = (y2 - y1) / 3
+ points.append((x1 + x_gap, y1 + y_gap))
+ points.append((x1 + x_gap * 2, y1 + y_gap))
+ points.append((x1 + x_gap, y1 + y_gap * 2))
+ points.append((x1 + x_gap * 2, y1 + y_gap * 2))
+ plabs = [1, 1, 1, 1]
+
+ elif detection_hint == "mask-point-bbox":
+ center = utils.center_of_bbox(segs[i].bbox)
+ points.append(center)
+ plabs = [1]
+
+ elif detection_hint == "mask-area":
+ points, plabs = gen_detection_hints_from_mask_area(segs[i].crop_region[0], segs[i].crop_region[1],
+ segs[i].cropped_mask,
+ mask_hint_threshold, use_small_negative)
+
+ if mask_hint_use_negative == "Outter":
+ npoints, nplabs = gen_negative_hints(image.shape[0], image.shape[1],
+ segs[i].crop_region[0], segs[i].crop_region[1],
+ segs[i].crop_region[2], segs[i].crop_region[3])
+
+ points += npoints
+ plabs += nplabs
+
+ detected_masks = sam_obj.predict(image, points, plabs, dilated_bbox, threshold)
+ total_masks += detected_masks
+
+ # merge every collected masks
+ mask = utils.combine_masks2(total_masks)
+
+ finally:
+ sam_obj.release_device()
+
+ if mask is not None:
+ mask = mask.float()
+ mask = utils.dilate_mask(mask.cpu().numpy(), dilation)
+ mask = torch.from_numpy(mask)
+ else:
+ size = image.shape[0], image.shape[1]
+ mask = torch.zeros(size, dtype=torch.float32, device="cpu") # empty mask
+
+ mask = utils.make_3d_mask(mask)
+ return mask
+
+
+def generate_detection_hints(image, seg, center, detection_hint, dilated_bbox, mask_hint_threshold, use_small_negative,
+ mask_hint_use_negative):
+ [x1, y1, x2, y2] = dilated_bbox
+
+ points = []
+ plabs = []
+ if detection_hint == "center-1":
+ points.append(center)
+ plabs = [1] # 1 = foreground point, 0 = background point
+
+ elif detection_hint == "horizontal-2":
+ gap = (x2 - x1) / 3
+ points.append((x1 + gap, center[1]))
+ points.append((x1 + gap * 2, center[1]))
+ plabs = [1, 1]
+
+ elif detection_hint == "vertical-2":
+ gap = (y2 - y1) / 3
+ points.append((center[0], y1 + gap))
+ points.append((center[0], y1 + gap * 2))
+ plabs = [1, 1]
+
+ elif detection_hint == "rect-4":
+ x_gap = (x2 - x1) / 3
+ y_gap = (y2 - y1) / 3
+ points.append((x1 + x_gap, center[1]))
+ points.append((x1 + x_gap * 2, center[1]))
+ points.append((center[0], y1 + y_gap))
+ points.append((center[0], y1 + y_gap * 2))
+ plabs = [1, 1, 1, 1]
+
+ elif detection_hint == "diamond-4":
+ x_gap = (x2 - x1) / 3
+ y_gap = (y2 - y1) / 3
+ points.append((x1 + x_gap, y1 + y_gap))
+ points.append((x1 + x_gap * 2, y1 + y_gap))
+ points.append((x1 + x_gap, y1 + y_gap * 2))
+ points.append((x1 + x_gap * 2, y1 + y_gap * 2))
+ plabs = [1, 1, 1, 1]
+
+ elif detection_hint == "mask-point-bbox":
+ center = utils.center_of_bbox(seg.bbox)
+ points.append(center)
+ plabs = [1]
+
+ elif detection_hint == "mask-area":
+ points, plabs = gen_detection_hints_from_mask_area(seg.crop_region[0], seg.crop_region[1],
+ seg.cropped_mask,
+ mask_hint_threshold, use_small_negative)
+
+ if mask_hint_use_negative == "Outter":
+ npoints, nplabs = gen_negative_hints(image.shape[0], image.shape[1],
+ seg.crop_region[0], seg.crop_region[1],
+ seg.crop_region[2], seg.crop_region[3])
+
+ points += npoints
+ plabs += nplabs
+
+ return points, plabs
+
+
+def convert_and_stack_masks(masks):
+ if len(masks) == 0:
+ return None
+
+ mask_tensors = []
+ for mask in masks:
+ mask_array = np.array(mask, dtype=np.uint8)
+ mask_tensor = torch.from_numpy(mask_array)
+ mask_tensors.append(mask_tensor)
+
+ stacked_masks = torch.stack(mask_tensors, dim=0)
+ stacked_masks = stacked_masks.unsqueeze(1)
+
+ return stacked_masks
+
+
+def merge_and_stack_masks(stacked_masks, group_size):
+ if stacked_masks is None:
+ return None
+
+ num_masks = stacked_masks.size(0)
+ merged_masks = []
+
+ for i in range(0, num_masks, group_size):
+ subset_masks = stacked_masks[i:i + group_size]
+ merged_mask = torch.any(subset_masks, dim=0)
+ merged_masks.append(merged_mask)
+
+ if len(merged_masks) > 0:
+ merged_masks = torch.stack(merged_masks, dim=0)
+
+ return merged_masks
+
+
+def segs_scale_match(segs, target_shape):
+ h = segs[0][0]
+ w = segs[0][1]
+
+ th = target_shape[1]
+ tw = target_shape[2]
+
+ if (h == th and w == tw) or h == 0 or w == 0:
+ return segs
+
+ rh = th / h
+ rw = tw / w
+
+ new_segs = []
+ for seg in segs[1]:
+ cropped_image = seg.cropped_image
+ cropped_mask = seg.cropped_mask
+ x1, y1, x2, y2 = seg.crop_region
+ bx1, by1, bx2, by2 = seg.bbox
+
+ crop_region = int(x1*rw), int(y1*rw), int(x2*rh), int(y2*rh)
+ bbox = int(bx1*rw), int(by1*rw), int(bx2*rh), int(by2*rh)
+ new_w = crop_region[2] - crop_region[0]
+ new_h = crop_region[3] - crop_region[1]
+
+ if isinstance(cropped_mask, np.ndarray):
+ cropped_mask = torch.from_numpy(cropped_mask)
+
+ if isinstance(cropped_mask, torch.Tensor) and len(cropped_mask.shape) == 3:
+ cropped_mask = torch.nn.functional.interpolate(cropped_mask.unsqueeze(0), size=(new_h, new_w), mode='bilinear', align_corners=False)
+ cropped_mask = cropped_mask.squeeze(0)
+ else:
+ cropped_mask = torch.nn.functional.interpolate(cropped_mask.unsqueeze(0).unsqueeze(0), size=(new_h, new_w), mode='bilinear', align_corners=False)
+ cropped_mask = cropped_mask.squeeze(0).squeeze(0).numpy()
+
+ if cropped_image is not None:
+ cropped_image = utils.tensor_resize(cropped_image if isinstance(cropped_image, torch.Tensor) else torch.from_numpy(cropped_image), new_w, new_h)
+ cropped_image = cropped_image.numpy()
+
+ new_seg = SEG(cropped_image, cropped_mask, seg.confidence, crop_region, bbox, seg.label, seg.control_net_wrapper)
+ new_segs.append(new_seg)
+
+ return (th, tw), new_segs
+
+
+# Used Python's slicing feature. stacked_masks[2::3] means starting from index 2, selecting every third tensor with a step size of 3.
+# This allows for quickly obtaining the last tensor of every three tensors in stacked_masks.
+def every_three_pick_last(stacked_masks):
+ selected_masks = stacked_masks[2::3]
+ return selected_masks
+
+
+def make_sam_mask_segmented(sam, segs, image, detection_hint, dilation,
+ threshold, bbox_expansion, mask_hint_threshold, mask_hint_use_negative):
+
+ if not hasattr(sam, 'sam_wrapper'):
+ raise Exception("[Impact Pack] Invalid SAMLoader is connected. Make sure 'SAMLoader (Impact)'.")
+
+ sam_obj = sam.sam_wrapper
+ sam_obj.prepare_device()
+
+ try:
+ image = np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8)
+
+ total_masks = []
+
+ use_small_negative = mask_hint_use_negative == "Small"
+
+ # seg_shape = segs[0]
+ segs = segs[1]
+ if detection_hint == "mask-points":
+ points = []
+ plabs = []
+
+ for i in range(len(segs)):
+ bbox = segs[i].bbox
+ center = utils.center_of_bbox(bbox)
+ points.append(center)
+
+ # small point is background, big point is foreground
+ if use_small_negative and bbox[2] - bbox[0] < 10:
+ plabs.append(0)
+ else:
+ plabs.append(1)
+
+ detected_masks = sam_obj.predict(image, points, plabs, None, threshold)
+ total_masks += detected_masks
+
+ else:
+ for i in range(len(segs)):
+ bbox = segs[i].bbox
+ center = utils.center_of_bbox(bbox)
+ x1 = max(bbox[0] - bbox_expansion, 0)
+ y1 = max(bbox[1] - bbox_expansion, 0)
+ x2 = min(bbox[2] + bbox_expansion, image.shape[1])
+ y2 = min(bbox[3] + bbox_expansion, image.shape[0])
+
+ dilated_bbox = [x1, y1, x2, y2]
+
+ points, plabs = generate_detection_hints(image, segs[i], center, detection_hint, dilated_bbox,
+ mask_hint_threshold, use_small_negative,
+ mask_hint_use_negative)
+
+ detected_masks = sam_obj.predict(image, points, plabs, dilated_bbox, threshold)
+
+ total_masks += detected_masks
+
+ # merge every collected masks
+ mask = utils.combine_masks2(total_masks)
+
+ finally:
+ sam_obj.release_device()
+
+ mask_working_device = torch.device("cpu")
+
+ if mask is not None:
+ mask = mask.float()
+ mask = utils.dilate_mask(mask.cpu().numpy(), dilation)
+ mask = torch.from_numpy(mask)
+ mask = mask.to(device=mask_working_device)
+ else:
+ # Extracting batch, height and width
+ height, width, _ = image.shape
+ mask = torch.zeros(
+ (height, width), dtype=torch.float32, device=mask_working_device
+ ) # empty mask
+
+ stacked_masks = convert_and_stack_masks(total_masks)
+
+ return (mask, merge_and_stack_masks(stacked_masks, group_size=3))
+ # return every_three_pick_last(stacked_masks)
+
+
+def segs_bitwise_and_mask(segs, mask):
+ mask = utils.make_2d_mask(mask)
+
+ if mask is None:
+ logging.warning("[SegsBitwiseAndMask] Cannot operate: MASK is empty.")
+ return ([],)
+
+ items = []
+
+ mask = (mask.cpu().numpy() * 255).astype(np.uint8)
+
+ for seg in segs[1]:
+ cropped_mask = (seg.cropped_mask * 255).astype(np.uint8)
+ crop_region = seg.crop_region
+
+ cropped_mask2 = mask[crop_region[1]:crop_region[3], crop_region[0]:crop_region[2]]
+
+ new_mask = np.bitwise_and(cropped_mask.astype(np.uint8), cropped_mask2)
+ new_mask = new_mask.astype(np.float32) / 255.0
+
+ item = SEG(seg.cropped_image, new_mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, None)
+ items.append(item)
+
+ return segs[0], items
+
+
+def segs_bitwise_subtract_mask(segs, mask):
+ mask = utils.make_2d_mask(mask)
+
+ if mask is None:
+ logging.warning("[SegsBitwiseSubtractMask] Cannot operate: MASK is empty.")
+ return ([],)
+
+ items = []
+
+ mask = (mask.cpu().numpy() * 255).astype(np.uint8)
+
+ for seg in segs[1]:
+ cropped_mask = (seg.cropped_mask * 255).astype(np.uint8)
+ crop_region = seg.crop_region
+
+ cropped_mask2 = mask[crop_region[1]:crop_region[3], crop_region[0]:crop_region[2]]
+
+ new_mask = cv2.subtract(cropped_mask.astype(np.uint8), cropped_mask2)
+ new_mask = new_mask.astype(np.float32) / 255.0
+
+ item = SEG(seg.cropped_image, new_mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, None)
+ items.append(item)
+
+ return segs[0], items
+
+
+def apply_mask_to_each_seg(segs, masks):
+ if masks is None:
+ logging.warning("[SegsBitwiseAndMask] Cannot operate: MASK is empty.")
+ return (segs[0], [],)
+
+ items = []
+
+ masks = masks.squeeze(1)
+
+ for seg, mask in zip(segs[1], masks):
+ cropped_mask = (seg.cropped_mask * 255).astype(np.uint8)
+ crop_region = seg.crop_region
+
+ cropped_mask2 = (mask.cpu().numpy() * 255).astype(np.uint8)
+ cropped_mask2 = cropped_mask2[crop_region[1]:crop_region[3], crop_region[0]:crop_region[2]]
+
+ new_mask = np.bitwise_and(cropped_mask.astype(np.uint8), cropped_mask2)
+ new_mask = new_mask.astype(np.float32) / 255.0
+
+ item = SEG(seg.cropped_image, new_mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, None)
+ items.append(item)
+
+ return segs[0], items
+
+
+def dilate_segs(segs, factor):
+ if factor == 0:
+ return segs
+
+ new_segs = []
+ for seg in segs[1]:
+ new_mask = utils.dilate_mask(seg.cropped_mask, factor)
+ new_seg = SEG(seg.cropped_image, new_mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, seg.control_net_wrapper)
+ new_segs.append(new_seg)
+
+ return (segs[0], new_segs)
+
+
+class ONNXDetector:
+ onnx_model = None
+
+ def __init__(self, onnx_model):
+ self.onnx_model = onnx_model
+
+ def detect(self, image, threshold, dilation, crop_factor, drop_size=1, detailer_hook=None):
+ drop_size = max(drop_size, 1)
+ try:
+ import impact.impact_onnx as onnx
+
+ h = image.shape[1]
+ w = image.shape[2]
+
+ labels, scores, boxes = onnx.onnx_inference(image, self.onnx_model)
+
+ # collect feasible item
+ result = []
+
+ for i in range(len(labels)):
+ if scores[i] > threshold:
+ item_bbox = boxes[i]
+ x1, y1, x2, y2 = item_bbox
+
+ if x2 - x1 > drop_size and y2 - y1 > drop_size: # minimum dimension must be (2,2) to avoid squeeze issue
+ crop_region = utils.make_crop_region(w, h, item_bbox, crop_factor)
+
+ if detailer_hook is not None:
+ crop_region = item_bbox.post_crop_region(w, h, item_bbox, crop_region)
+
+ crop_x1, crop_y1, crop_x2, crop_y2, = crop_region
+
+ # prepare cropped mask
+ cropped_mask = np.zeros((crop_y2 - crop_y1, crop_x2 - crop_x1))
+ cropped_mask[y1 - crop_y1:y2 - crop_y1, x1 - crop_x1:x2 - crop_x1] = 1
+ cropped_mask = utils.dilate_mask(cropped_mask, dilation)
+
+ # make items. just convert the integer label to a string
+ item = SEG(None, cropped_mask, scores[i], crop_region, item_bbox, str(labels[i]), None)
+ result.append(item)
+
+ shape = h, w
+ segs = shape, result
+
+ if detailer_hook is not None and hasattr(detailer_hook, "post_detection"):
+ segs = detailer_hook.post_detection(segs)
+
+ return segs
+ except Exception as e:
+ logging.error(f"ONNXDetector: unable to execute.\n{e}")
+
+ def detect_combined(self, image, threshold, dilation):
+ return segs_to_combined_mask(self.detect(image, threshold, dilation, 1))
+
+ def setAux(self, x):
+ pass
+
+
+def batch_mask_to_segs(mask, combined, crop_factor, bbox_fill, drop_size=1, label='A', crop_min_size=None, detailer_hook=None):
+ combined_mask = mask.max(dim=0).values
+
+ segs = mask_to_segs(combined_mask, combined, crop_factor, bbox_fill, drop_size, label, crop_min_size, detailer_hook)
+
+ new_segs = []
+ for seg in segs[1]:
+ x1, y1, x2, y2 = seg.crop_region
+ cropped_mask = mask[:, y1:y2, x1:x2]
+ item = SEG(None, cropped_mask, 1.0, seg.crop_region, seg.bbox, label, None)
+ new_segs.append(item)
+
+ return segs[0], new_segs
+
+
+def mask_to_segs(mask, combined, crop_factor, bbox_fill, drop_size=1, label='A', crop_min_size=None, detailer_hook=None, is_contour=True):
+ drop_size = max(drop_size, 1)
+ if mask is None:
+ logging.info("[mask_to_segs] Cannot operate: MASK is empty.")
+ return ([],)
+
+ if isinstance(mask, np.ndarray):
+ pass # `mask` is already a NumPy array
+ else:
+ try:
+ mask = mask.numpy()
+ except AttributeError:
+ logging.info("[mask_to_segs] Cannot operate: MASK is not a NumPy array or Tensor.")
+ return ([],)
+
+ if mask is None:
+ logging.info("[mask_to_segs] Cannot operate: MASK is empty.")
+ return ([],)
+
+ result = []
+
+ if len(mask.shape) == 2:
+ mask = np.expand_dims(mask, axis=0)
+
+ for i in range(mask.shape[0]):
+ mask_i = mask[i]
+
+ if combined:
+ indices = np.nonzero(mask_i)
+ if len(indices[0]) > 0 and len(indices[1]) > 0:
+ bbox = (
+ np.min(indices[1]),
+ np.min(indices[0]),
+ np.max(indices[1]),
+ np.max(indices[0]),
+ )
+ crop_region = utils.make_crop_region(
+ mask_i.shape[1], mask_i.shape[0], bbox, crop_factor
+ )
+ x1, y1, x2, y2 = crop_region
+
+ if detailer_hook is not None:
+ crop_region = detailer_hook.post_crop_region(mask_i.shape[1], mask_i.shape[0], bbox, crop_region)
+
+ if x2 - x1 > 0 and y2 - y1 > 0:
+ cropped_mask = mask_i[y1:y2, x1:x2]
+
+ if bbox_fill:
+ bx1, by1, bx2, by2 = bbox
+ cropped_mask = cropped_mask.copy()
+ cropped_mask[by1:by2, bx1:bx2] = 1.0
+
+ if cropped_mask is not None:
+ item = SEG(None, cropped_mask, 1.0, crop_region, bbox, label, None)
+ result.append(item)
+
+ else:
+ mask_i_uint8 = (mask_i * 255.0).astype(np.uint8)
+ contours, ctree = cv2.findContours(mask_i_uint8, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
+ for j, contour in enumerate(contours):
+ hierarchy = ctree[0][j]
+ if hierarchy[3] != -1:
+ continue
+
+ separated_mask = np.zeros_like(mask_i_uint8)
+ cv2.drawContours(separated_mask, [contour], 0, 255, -1)
+ separated_mask = np.array(separated_mask / 255.0).astype(np.float32)
+
+ x, y, w, h = cv2.boundingRect(contour)
+ bbox = x, y, x + w, y + h
+ crop_region = utils.make_crop_region(
+ mask_i.shape[1], mask_i.shape[0], bbox, crop_factor, crop_min_size
+ )
+
+ if detailer_hook is not None:
+ crop_region = detailer_hook.post_crop_region(mask_i.shape[1], mask_i.shape[0], bbox, crop_region)
+
+ if w > drop_size and h > drop_size:
+ if is_contour:
+ mask_src = separated_mask
+ else:
+ mask_src = mask_i * separated_mask
+
+ cropped_mask = np.array(
+ mask_src[
+ crop_region[1]: crop_region[3],
+ crop_region[0]: crop_region[2],
+ ]
+ )
+
+ if bbox_fill:
+ cx1, cy1, _, _ = crop_region
+ bx1 = x - cx1
+ bx2 = x+w - cx1
+ by1 = y - cy1
+ by2 = y+h - cy1
+ cropped_mask[by1:by2, bx1:bx2] = 1.0
+
+ if cropped_mask is not None:
+ cropped_mask = torch.clip(torch.from_numpy(cropped_mask), 0, 1.0)
+ item = SEG(None, cropped_mask.numpy(), 1.0, crop_region, bbox, label, None)
+ result.append(item)
+
+ if not result:
+ logging.info("[mask_to_segs] Empty mask.")
+
+ logging.info(f"# of Detected SEGS: {len(result)}")
+ # for r in result:
+ # print(f"\tbbox={r.bbox}, crop={r.crop_region}, label={r.label}")
+
+ # shape: (b,h,w) -> (h,w)
+ return (mask.shape[1], mask.shape[2]), result
+
+
+def mediapipe_facemesh_to_segs(image, crop_factor, bbox_fill, crop_min_size, drop_size, dilation, face, mouth, left_eyebrow, left_eye, left_pupil, right_eyebrow, right_eye, right_pupil):
+ parts = {
+ "face": np.array([0x0A, 0xC8, 0x0A]),
+ "mouth": np.array([0x0A, 0xB4, 0x0A]),
+ "left_eyebrow": np.array([0xB4, 0xDC, 0x0A]),
+ "left_eye": np.array([0xB4, 0xC8, 0x0A]),
+ "left_pupil": np.array([0xFA, 0xC8, 0x0A]),
+ "right_eyebrow": np.array([0x0A, 0xDC, 0xB4]),
+ "right_eye": np.array([0x0A, 0xC8, 0xB4]),
+ "right_pupil": np.array([0x0A, 0xC8, 0xFA]),
+ }
+
+ def create_segments(image, color):
+ image = (image * 255).to(torch.uint8)
+ image = image.squeeze(0).numpy()
+ mask = cv2.inRange(image, color, color)
+
+ contours, ctree = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
+ mask_list = []
+ for i, contour in enumerate(contours):
+ hierarchy = ctree[0][i]
+ if hierarchy[3] == -1:
+ convex_hull = cv2.convexHull(contour)
+ convex_segment = np.zeros_like(image)
+ cv2.fillPoly(convex_segment, [convex_hull], (255, 255, 255))
+
+ convex_segment = np.expand_dims(convex_segment, axis=0).astype(np.float32) / 255.0
+ tensor = torch.from_numpy(convex_segment)
+ mask_tensor = torch.any(tensor != 0, dim=-1).float()
+ mask_tensor = mask_tensor.squeeze(0)
+ mask_tensor = torch.from_numpy(utils.dilate_mask(mask_tensor.numpy(), dilation))
+ mask_list.append(mask_tensor.unsqueeze(0))
+
+ return mask_list
+
+ segs = []
+
+ def create_seg(label):
+ mask_list = create_segments(image, parts[label])
+ for mask in mask_list:
+ seg = mask_to_segs(mask, False, crop_factor, bbox_fill, drop_size=drop_size, label=label, crop_min_size=crop_min_size)
+ if len(seg[1]) > 0:
+ segs.extend(seg[1])
+
+ if face:
+ create_seg('face')
+
+ if mouth:
+ create_seg('mouth')
+
+ if left_eyebrow:
+ create_seg('left_eyebrow')
+
+ if left_eye:
+ create_seg('left_eye')
+
+ if left_pupil:
+ create_seg('left_pupil')
+
+ if right_eyebrow:
+ create_seg('right_eyebrow')
+
+ if right_eye:
+ create_seg('right_eye')
+
+ if right_pupil:
+ create_seg('right_pupil')
+
+ return (image.shape[1], image.shape[2]), segs
+
+
+def segs_to_combined_mask(segs):
+ shape = segs[0]
+ h = shape[0]
+ w = shape[1]
+
+ mask = np.zeros((h, w), dtype=np.uint8)
+
+ for seg in segs[1]:
+ cropped_mask = seg.cropped_mask
+ crop_region = seg.crop_region
+ mask[crop_region[1]:crop_region[3], crop_region[0]:crop_region[2]] |= (cropped_mask * 255).astype(np.uint8)
+
+ return torch.from_numpy(mask.astype(np.float32) / 255.0)
+
+
+def segs_to_masklist(segs):
+ shape = segs[0]
+ h = shape[0]
+ w = shape[1]
+
+ masks = []
+ for seg in segs[1]:
+ if isinstance(seg.cropped_mask, np.ndarray):
+ cropped_mask = torch.from_numpy(seg.cropped_mask)
+ else:
+ cropped_mask = seg.cropped_mask
+
+ if cropped_mask.ndim == 2:
+ cropped_mask = cropped_mask.unsqueeze(0)
+
+ n = len(cropped_mask)
+
+ mask = torch.zeros((n, h, w), dtype=torch.uint8)
+ crop_region = seg.crop_region
+ mask[:, crop_region[1]:crop_region[3], crop_region[0]:crop_region[2]] |= (cropped_mask * 255).to(torch.uint8)
+ mask = (mask / 255.0).to(torch.float32)
+
+ for x in mask:
+ masks.append(x)
+
+ if len(masks) == 0:
+ empty_mask = torch.zeros((h, w), dtype=torch.float32, device="cpu")
+ masks = [empty_mask]
+
+ return masks
+
+
+def vae_decode(vae, samples, use_tile, hook, tile_size=512, overlap=64):
+ if use_tile:
+ decoder = nodes.VAEDecodeTiled()
+ if 'overlap' in inspect.signature(decoder.decode).parameters:
+ pixels = decoder.decode(vae, samples, tile_size, overlap=overlap)[0]
+ else:
+ logging.warning("[Impact Pack] Your ComfyUI is outdated.")
+ pixels = decoder.decode(vae, samples, tile_size)[0]
+ else:
+ pixels = nodes.VAEDecode().decode(vae, samples)[0]
+
+ if hook is not None:
+ pixels = hook.post_decode(pixels)
+
+ return pixels
+
+
+def vae_encode(vae, pixels, use_tile, hook, tile_size=512, overlap=64):
+ if use_tile:
+ encoder = nodes.VAEEncodeTiled()
+ if 'overlap' in inspect.signature(encoder.encode).parameters:
+ samples = encoder.encode(vae, pixels, tile_size, overlap=overlap)[0]
+ else:
+ logging.warning("[Impact Pack] Your ComfyUI is outdated.")
+ samples = encoder.encode(vae, pixels, tile_size)[0]
+ else:
+ samples = nodes.VAEEncode().encode(vae, pixels)[0]
+
+ if hook is not None:
+ samples = hook.post_encode(samples)
+
+ return samples
+
+
+def latent_upscale_on_pixel_space_shape(samples, scale_method, w, h, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ return latent_upscale_on_pixel_space_shape2(samples, scale_method, w, h, vae, use_tile, tile_size, save_temp_prefix, hook, overlap=overlap)[0]
+
+
+def latent_upscale_on_pixel_space_shape2(samples, scale_method, w, h, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ pixels = vae_decode(vae, samples, use_tile, hook, tile_size=tile_size, overlap=overlap)
+
+ if save_temp_prefix is not None:
+ nodes.PreviewImage().save_images(pixels, filename_prefix=save_temp_prefix)
+
+ pixels = nodes.ImageScale().upscale(pixels, scale_method, int(w), int(h), False)[0]
+
+ old_pixels = pixels
+ if hook is not None:
+ pixels = hook.post_upscale(pixels)
+
+ return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels
+
+
+def latent_upscale_on_pixel_space(samples, scale_method, scale_factor, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ return latent_upscale_on_pixel_space2(samples, scale_method, scale_factor, vae, use_tile, tile_size, save_temp_prefix, hook, overlap=overlap)[0]
+
+
+def latent_upscale_on_pixel_space2(samples, scale_method, scale_factor, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ pixels = vae_decode(vae, samples, use_tile, hook, tile_size=tile_size, overlap=overlap)
+
+ if save_temp_prefix is not None:
+ nodes.PreviewImage().save_images(pixels, filename_prefix=save_temp_prefix)
+
+ w = pixels.shape[2] * scale_factor
+ h = pixels.shape[1] * scale_factor
+ pixels = nodes.ImageScale().upscale(pixels, scale_method, int(w), int(h), False)[0]
+
+ old_pixels = pixels
+ if hook is not None:
+ pixels = hook.post_upscale(pixels)
+
+ return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels
+
+
+def latent_upscale_on_pixel_space_with_model_shape(samples, scale_method, upscale_model, new_w, new_h, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ return latent_upscale_on_pixel_space_with_model_shape2(samples, scale_method, upscale_model, new_w, new_h, vae, use_tile, tile_size, save_temp_prefix, hook, overlap=overlap)[0]
+
+
+def latent_upscale_on_pixel_space_with_model_shape2(samples, scale_method, upscale_model, new_w, new_h, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ pixels = vae_decode(vae, samples, use_tile, hook, tile_size=tile_size, overlap=overlap)
+
+ if save_temp_prefix is not None:
+ nodes.PreviewImage().save_images(pixels, filename_prefix=save_temp_prefix)
+
+ w = pixels.shape[2]
+
+ # upscale by model upscaler
+ current_w = w
+ while current_w < new_w:
+ model_upscaler = nodes.NODE_CLASS_MAPPINGS['ImageUpscaleWithModel']()
+ if hasattr(model_upscaler, 'execute'):
+ pixels = model_upscaler.execute(upscale_model, pixels)[0]
+ else:
+ pixels = model_upscaler.upscale(upscale_model, pixels)[0]
+
+ current_w = pixels.shape[2]
+ if current_w == w:
+ logging.info("[latent_upscale_on_pixel_space_with_model] x1 upscale model selected")
+ break
+
+ # downscale to target scale
+ pixels = nodes.ImageScale().upscale(pixels, scale_method, int(new_w), int(new_h), False)[0]
+
+ old_pixels = pixels
+ if hook is not None:
+ pixels = hook.post_upscale(pixels)
+
+ return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels
+
+
+def latent_upscale_on_pixel_space_with_model(samples, scale_method, upscale_model, scale_factor, vae, use_tile=False,
+ tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ return latent_upscale_on_pixel_space_with_model2(samples, scale_method, upscale_model, scale_factor, vae, use_tile, tile_size, save_temp_prefix, hook, overlap=overlap)[0]
+
+def latent_upscale_on_pixel_space_with_model2(samples, scale_method, upscale_model, scale_factor, vae, use_tile=False,
+ tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
+ pixels = vae_decode(vae, samples, use_tile, hook, tile_size=tile_size, overlap=overlap)
+
+ if save_temp_prefix is not None:
+ nodes.PreviewImage().save_images(pixels, filename_prefix=save_temp_prefix)
+
+ w = pixels.shape[2]
+ h = pixels.shape[1]
+
+ new_w = w * scale_factor
+ new_h = h * scale_factor
+
+ # upscale by model upscaler
+ current_w = w
+ while current_w < new_w:
+ model_upscaler = nodes.NODE_CLASS_MAPPINGS['ImageUpscaleWithModel']()
+ if hasattr(model_upscaler, 'execute'):
+ pixels = model_upscaler.execute(upscale_model, pixels)[0]
+ else:
+ pixels = model_upscaler.upscale(upscale_model, pixels)[0]
+
+ current_w = pixels.shape[2]
+ if current_w == w:
+ logging.info("[latent_upscale_on_pixel_space_with_model] x1 upscale model selected")
+ break
+
+ # downscale to target scale
+ pixels = nodes.ImageScale().upscale(pixels, scale_method, int(new_w), int(new_h), False)[0]
+
+ old_pixels = pixels
+ if hook is not None:
+ pixels = hook.post_upscale(pixels)
+
+ return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels
+
+
+class TwoSamplersForMaskUpscaler:
+ def __init__(self, scale_method, sample_schedule, use_tiled_vae, base_sampler, mask_sampler, mask, vae,
+ full_sampler_opt=None, upscale_model_opt=None, hook_base_opt=None, hook_mask_opt=None,
+ hook_full_opt=None,
+ tile_size=512):
+
+ mask = utils.make_2d_mask(mask)
+
+ mask = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1]))
+
+ self.params = scale_method, sample_schedule, use_tiled_vae, base_sampler, mask_sampler, mask, vae
+ self.upscale_model = upscale_model_opt
+ self.full_sampler = full_sampler_opt
+ self.hook_base = hook_base_opt
+ self.hook_mask = hook_mask_opt
+ self.hook_full = hook_full_opt
+ self.use_tiled_vae = use_tiled_vae
+ self.tile_size = tile_size
+ self.is_tiled = False
+ self.vae = vae
+
+ def upscale(self, step_info, samples, upscale_factor, save_temp_prefix=None):
+ scale_method, sample_schedule, use_tiled_vae, base_sampler, mask_sampler, mask, vae = self.params
+
+ mask = utils.make_2d_mask(mask)
+
+ self.prepare_hook(step_info)
+
+ # upscale latent
+ if self.upscale_model is None:
+ upscaled_latent = latent_upscale_on_pixel_space(samples, scale_method, upscale_factor, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook_base, tile_size=self.tile_size)
+ else:
+ upscaled_latent = latent_upscale_on_pixel_space_with_model(samples, scale_method, self.upscale_model,
+ upscale_factor, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook_mask, tile_size=self.tile_size)
+
+ return self.do_samples(step_info, base_sampler, mask_sampler, sample_schedule, mask, upscaled_latent)
+
+ def prepare_hook(self, step_info):
+ if self.hook_base is not None:
+ self.hook_base.set_steps(step_info)
+ if self.hook_mask is not None:
+ self.hook_mask.set_steps(step_info)
+ if self.hook_full is not None:
+ self.hook_full.set_steps(step_info)
+
+ def upscale_shape(self, step_info, samples, w, h, save_temp_prefix=None):
+ scale_method, sample_schedule, use_tiled_vae, base_sampler, mask_sampler, mask, vae = self.params
+
+ mask = utils.make_2d_mask(mask)
+
+ self.prepare_hook(step_info)
+
+ # upscale latent
+ if self.upscale_model is None:
+ upscaled_latent = latent_upscale_on_pixel_space_shape(samples, scale_method, w, h, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook_base,
+ tile_size=self.tile_size)
+ else:
+ upscaled_latent = latent_upscale_on_pixel_space_with_model_shape(samples, scale_method, self.upscale_model,
+ w, h, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook_mask,
+ tile_size=self.tile_size)
+
+ return self.do_samples(step_info, base_sampler, mask_sampler, sample_schedule, mask, upscaled_latent)
+
+ def is_full_sample_time(self, step_info, sample_schedule):
+ cur_step, total_step = step_info
+
+ # make start from 1 instead of zero
+ cur_step += 1
+ total_step += 1
+
+ if sample_schedule == "none":
+ return False
+
+ elif sample_schedule == "interleave1":
+ return cur_step % 2 == 0
+
+ elif sample_schedule == "interleave2":
+ return cur_step % 3 == 0
+
+ elif sample_schedule == "interleave3":
+ return cur_step % 4 == 0
+
+ elif sample_schedule == "last1":
+ return cur_step == total_step
+
+ elif sample_schedule == "last2":
+ return cur_step >= total_step - 1
+
+ elif sample_schedule == "interleave1+last1":
+ return cur_step % 2 == 0 or cur_step >= total_step - 1
+
+ elif sample_schedule == "interleave2+last1":
+ return cur_step % 2 == 0 or cur_step >= total_step - 1
+
+ elif sample_schedule == "interleave3+last1":
+ return cur_step % 2 == 0 or cur_step >= total_step - 1
+
+ def do_samples(self, step_info, base_sampler, mask_sampler, sample_schedule, mask, upscaled_latent):
+ mask = utils.make_2d_mask(mask)
+
+ if self.is_full_sample_time(step_info, sample_schedule):
+ logging.info(f"step_info={step_info} / full time")
+
+ upscaled_latent = base_sampler.sample(upscaled_latent, self.hook_base)
+ sampler = self.full_sampler if self.full_sampler is not None else base_sampler
+ return sampler.sample(upscaled_latent, self.hook_full)
+
+ else:
+ logging.info(f"step_info={step_info} / non-full time")
+ # upscale mask
+ if mask.ndim == 2:
+ mask = mask[None, :, :, None]
+ upscaled_mask = F.interpolate(mask, size=(upscaled_latent['samples'].shape[2], upscaled_latent['samples'].shape[3]), mode='bilinear', align_corners=True)
+ upscaled_mask = upscaled_mask[:, :, :upscaled_latent['samples'].shape[2], :upscaled_latent['samples'].shape[3]]
+
+ # base sampler
+ upscaled_inv_mask = torch.where(upscaled_mask != 1.0, torch.tensor(1.0), torch.tensor(0.0))
+ upscaled_latent['noise_mask'] = upscaled_inv_mask
+ upscaled_latent = base_sampler.sample(upscaled_latent, self.hook_base)
+
+ # mask sampler
+ upscaled_latent['noise_mask'] = upscaled_mask
+ upscaled_latent = mask_sampler.sample(upscaled_latent, self.hook_mask)
+
+ # remove mask
+ del upscaled_latent['noise_mask']
+ return upscaled_latent
+
+
+class PixelKSampleUpscaler:
+ def __init__(self, scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise,
+ use_tiled_vae, upscale_model_opt=None, hook_opt=None, tile_size=512, scheduler_func=None,
+ tile_cnet_opt=None, tile_cnet_strength=1.0):
+ self.params = scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise
+ self.upscale_model = upscale_model_opt
+ self.hook = hook_opt
+ self.use_tiled_vae = use_tiled_vae
+ self.tile_size = tile_size
+ self.is_tiled = False
+ self.vae = vae
+ self.scheduler_func = scheduler_func
+ self.tile_cnet = tile_cnet_opt
+ self.tile_cnet_strength = tile_cnet_strength
+
+ def sample(self, model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise, images):
+ if self.tile_cnet is not None:
+ image_batch, image_w, image_h, _ = images.shape
+ if image_batch > 1:
+ warnings.warn('Multiple latents in batch, Tile ControlNet being ignored')
+ else:
+ if 'TilePreprocessor' not in nodes.NODE_CLASS_MAPPINGS:
+ raise RuntimeError("'TilePreprocessor' node (from comfyui_controlnet_aux) isn't installed.")
+ preprocessor = nodes.NODE_CLASS_MAPPINGS['TilePreprocessor']()
+ # might add capacity to set pyrUp_iters later, not needed for now though
+ preprocessed = preprocessor.execute(images, pyrUp_iters=3, resolution=min(image_w, image_h))[0]
+ positive, negative = nodes.ControlNetApplyAdvanced().apply_controlnet(positive=positive,
+ negative=negative,
+ control_net=self.tile_cnet,
+ image=preprocessed,
+ strength=self.tile_cnet_strength,
+ start_percent=0,
+ end_percent=1.0,
+ vae=self.vae)
+
+ refined_latent = impact_sampling.impact_sample(model, seed, steps, cfg, sampler_name, scheduler,
+ positive, negative, upscaled_latent, denoise, scheduler_func=self.scheduler_func)
+
+ return refined_latent
+
+ def upscale(self, step_info, samples, upscale_factor, save_temp_prefix=None):
+ scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise = self.params
+
+ if self.hook is not None:
+ self.hook.set_steps(step_info)
+
+ if self.upscale_model is None:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space2(samples, scale_method, upscale_factor, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix, hook=self.hook, tile_size=512)
+ else:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_with_model2(samples, scale_method, self.upscale_model,
+ upscale_factor, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook,
+ tile_size=self.tile_size)
+
+ if self.hook is not None:
+ model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise = \
+ self.hook.pre_ksample(model, seed, steps, cfg, sampler_name, scheduler, positive, negative,
+ upscaled_latent, denoise)
+
+ if 'noise_mask' in samples:
+ upscaled_latent['noise_mask'] = samples['noise_mask']
+
+ refined_latent = self.sample(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise, upscaled_images)
+ return refined_latent
+
+ def upscale_shape(self, step_info, samples, w, h, save_temp_prefix=None):
+ scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise = self.params
+
+ if self.hook is not None:
+ self.hook.set_steps(step_info)
+
+ if self.upscale_model is None:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_shape2(samples, scale_method, w, h, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix, hook=self.hook,
+ tile_size=self.tile_size)
+ else:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_with_model_shape2(samples, scale_method, self.upscale_model,
+ w, h, vae,
+ use_tile=self.use_tiled_vae,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook,
+ tile_size=self.tile_size)
+
+ if self.hook is not None:
+ model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise = \
+ self.hook.pre_ksample(model, seed, steps, cfg, sampler_name, scheduler, positive, negative,
+ upscaled_latent, denoise)
+
+ if 'noise_mask' in samples:
+ upscaled_latent['noise_mask'] = samples['noise_mask']
+
+ refined_latent = self.sample(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise, upscaled_images)
+ return refined_latent
+
+
+class IPAdapterWrapper:
+ def __init__(self, ipadapter_pipe, weight, noise, weight_type, start_at, end_at, unfold_batch, weight_v2, reference_image, neg_image=None, prev_control_net=None, combine_embeds='concat'):
+ self.reference_image = reference_image
+ self.ipadapter_pipe = ipadapter_pipe
+ self.weight = weight
+ self.weight_type = weight_type
+ self.noise = noise
+ self.start_at = start_at
+ self.end_at = end_at
+ self.unfold_batch = unfold_batch
+ self.prev_control_net = prev_control_net
+ self.weight_v2 = weight_v2
+ self.image = reference_image
+ self.neg_image = neg_image
+ self.combine_embeds = combine_embeds
+
+ # name 'apply_ipadapter' isn't allowed
+ def doit_ipadapter(self, model):
+ cnet_image_list = [self.image]
+ prev_cnet_images = []
+
+ if 'IPAdapterAdvanced' not in nodes.NODE_CLASS_MAPPINGS:
+ if 'IPAdapterApply' in nodes.NODE_CLASS_MAPPINGS:
+ raise Exception("[ERROR] 'ComfyUI IPAdapter Plus' is outdated.")
+
+ utils.try_install_custom_node('https://github.com/cubiq/ComfyUI_IPAdapter_plus',
+ "To use 'IPAdapterApplySEGS' node, 'ComfyUI IPAdapter Plus' extension is required.")
+ raise Exception("[ERROR] To use IPAdapterApplySEGS, you need to install 'ComfyUI IPAdapter Plus'")
+
+ obj = nodes.NODE_CLASS_MAPPINGS['IPAdapterAdvanced']
+
+ ipadapter, _, clip_vision, insightface, lora_loader = self.ipadapter_pipe
+ model = lora_loader(model)
+
+ if self.prev_control_net is not None:
+ model, prev_cnet_images = self.prev_control_net.doit_ipadapter(model)
+
+ model = obj().apply_ipadapter(model=model, ipadapter=ipadapter, weight=self.weight, weight_type=self.weight_type,
+ start_at=self.start_at, end_at=self.end_at, combine_embeds=self.combine_embeds,
+ clip_vision=clip_vision, image=self.image, image_negative=self.neg_image, attn_mask=None,
+ insightface=insightface, weight_faceidv2=self.weight_v2)[0]
+
+ cnet_image_list.extend(prev_cnet_images)
+
+ return model, cnet_image_list
+
+ def apply(self, positive, negative, image, mask=None, use_acn=False):
+ if self.prev_control_net is not None:
+ return self.prev_control_net.apply(positive, negative, image, mask, use_acn=use_acn)
+ else:
+ return positive, negative, []
+
+
+class ControlNetWrapper:
+ def __init__(self, control_net, strength, preprocessor, prev_control_net=None, original_size=None, crop_region=None, control_image=None):
+ self.control_net = control_net
+ self.strength = strength
+ self.preprocessor = preprocessor
+ self.prev_control_net = prev_control_net
+
+ if original_size is not None and crop_region is not None and control_image is not None:
+ self.control_image = utils.tensor_resize(control_image, original_size[1], original_size[0])
+ self.control_image = torch.tensor(utils.tensor_crop(self.control_image, crop_region))
+ else:
+ self.control_image = None
+
+ def apply(self, positive, negative, image, mask=None, use_acn=False):
+ cnet_image_list = []
+ prev_cnet_images = []
+
+ if self.prev_control_net is not None:
+ positive, negative, prev_cnet_images = self.prev_control_net.apply(positive, negative, image, mask, use_acn=use_acn)
+
+ if self.control_image is not None:
+ cnet_image = self.control_image
+ elif self.preprocessor is not None:
+ cnet_image = self.preprocessor.apply(image, mask)
+ else:
+ cnet_image = image
+
+ cnet_image_list.extend(prev_cnet_images)
+ cnet_image_list.append(cnet_image)
+
+ if use_acn:
+ if "ACN_AdvancedControlNetApply" in nodes.NODE_CLASS_MAPPINGS:
+ acn = nodes.NODE_CLASS_MAPPINGS['ACN_AdvancedControlNetApply']()
+ positive, negative, _ = acn.apply_controlnet(positive=positive, negative=negative, control_net=self.control_net, image=cnet_image,
+ strength=self.strength, start_percent=0.0, end_percent=1.0)
+ else:
+ utils.try_install_custom_node('https://github.com/BlenderNeko/ComfyUI_TiledKSampler',
+ "To use 'ControlNetWrapper' for AnimateDiff, 'ComfyUI-Advanced-ControlNet' extension is required.")
+ raise Exception("'ACN_AdvancedControlNetApply' node isn't installed.")
+ else:
+ positive = nodes.ControlNetApply().apply_controlnet(positive, self.control_net, cnet_image, self.strength)[0]
+
+ return positive, negative, cnet_image_list
+
+ def doit_ipadapter(self, model):
+ if self.prev_control_net is not None:
+ return self.prev_control_net.doit_ipadapter(model)
+ else:
+ return model, []
+
+
+class ControlNetAdvancedWrapper:
+ def __init__(self, control_net, strength, start_percent, end_percent, preprocessor, prev_control_net=None,
+ original_size=None, crop_region=None, control_image=None, vae=None):
+ self.control_net = control_net
+ self.strength = strength
+ self.preprocessor = preprocessor
+ self.prev_control_net = prev_control_net
+ self.start_percent = start_percent
+ self.end_percent = end_percent
+ self.vae = vae
+
+ if original_size is not None and crop_region is not None and control_image is not None:
+ self.control_image = utils.tensor_resize(control_image, original_size[1], original_size[0])
+ self.control_image = torch.tensor(utils.tensor_crop(self.control_image, crop_region))
+ else:
+ self.control_image = None
+
+ def doit_ipadapter(self, model):
+ if self.prev_control_net is not None:
+ return self.prev_control_net.doit_ipadapter(model)
+ else:
+ return model, []
+
+ def apply(self, positive, negative, image, mask=None, use_acn=False):
+ cnet_image_list = []
+ prev_cnet_images = []
+
+ if self.prev_control_net is not None:
+ positive, negative, prev_cnet_images = self.prev_control_net.apply(positive, negative, image, mask)
+
+ if self.control_image is not None:
+ cnet_image = self.control_image
+ elif self.preprocessor is not None:
+ cnet_image = self.preprocessor.apply(image, mask)
+ else:
+ cnet_image = image
+
+ cnet_image_list.extend(prev_cnet_images)
+ cnet_image_list.append(cnet_image)
+
+ if use_acn:
+ if "ACN_AdvancedControlNetApply" in nodes.NODE_CLASS_MAPPINGS:
+ acn = nodes.NODE_CLASS_MAPPINGS['ACN_AdvancedControlNetApply']()
+ positive, negative, _ = acn.apply_controlnet(positive=positive, negative=negative, control_net=self.control_net, image=cnet_image,
+ strength=self.strength, start_percent=self.start_percent, end_percent=self.end_percent)
+ else:
+ utils.try_install_custom_node('https://github.com/BlenderNeko/ComfyUI_TiledKSampler',
+ "To use 'ControlNetAdvancedWrapper' for AnimateDiff, 'ComfyUI-Advanced-ControlNet' extension is required.")
+ raise Exception("'ACN_AdvancedControlNetApply' node isn't installed.")
+ else:
+ if self.vae is not None:
+ apply_controlnet = nodes.ControlNetApplyAdvanced().apply_controlnet
+ signature = inspect.signature(apply_controlnet)
+
+ if 'vae' in signature.parameters:
+ positive, negative = nodes.ControlNetApplyAdvanced().apply_controlnet(positive, negative, self.control_net, cnet_image, self.strength, self.start_percent, self.end_percent, vae=self.vae)
+ else:
+ logging.error("[Impact Pack] ERROR: The ComfyUI version is outdated. VAE cannot be used in ApplyControlNet.")
+ raise Exception("[Impact Pack] ERROR: The ComfyUI version is outdated. VAE cannot be used in ApplyControlNet.")
+ else:
+ positive, negative = nodes.ControlNetApplyAdvanced().apply_controlnet(positive, negative, self.control_net, cnet_image, self.strength, self.start_percent, self.end_percent)
+
+ return positive, negative, cnet_image_list
+
+
+# REQUIREMENTS: BlenderNeko/ComfyUI_TiledKSampler
+class TiledKSamplerWrapper:
+ params = None
+
+ def __init__(self, model, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise,
+ tile_width, tile_height, tiling_strategy):
+ self.params = model, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy
+
+ def sample(self, latent_image, hook=None):
+ if "BNK_TiledKSampler" in nodes.NODE_CLASS_MAPPINGS:
+ TiledKSampler = nodes.NODE_CLASS_MAPPINGS['BNK_TiledKSampler']
+ else:
+ utils.try_install_custom_node('https://github.com/BlenderNeko/ComfyUI_TiledKSampler',
+ "To use 'TiledKSamplerProvider', 'Tiled sampling for ComfyUI' extension is required.")
+ raise Exception("'BNK_TiledKSampler' node isn't installed.")
+
+ model, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise, tile_width, tile_height, tiling_strategy = self.params
+
+ if hook is not None:
+ model, seed, steps, cfg, sampler_name, scheduler, positive, negative, upscaled_latent, denoise = \
+ hook.pre_ksample(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
+ denoise)
+
+ return TiledKSampler().sample(model, seed, tile_width, tile_height, tiling_strategy, steps, cfg, sampler_name,
+ scheduler, positive, negative, latent_image, denoise)[0]
+
+
+class PixelTiledKSampleUpscaler:
+ def __init__(self, scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative,
+ denoise,
+ tile_width, tile_height, tiling_strategy,
+ upscale_model_opt=None, hook_opt=None, tile_cnet_opt=None, tile_size=512, tile_cnet_strength=1.0, overlap=64):
+ self.params = scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise
+ self.vae = vae
+ self.tile_params = tile_width, tile_height, tiling_strategy
+ self.upscale_model = upscale_model_opt
+ self.hook = hook_opt
+ self.tile_cnet = tile_cnet_opt
+ self.tile_size = tile_size
+ self.is_tiled = True
+ self.tile_cnet_strength = tile_cnet_strength
+ self.overlap = overlap
+
+ def tiled_ksample(self, latent, images):
+ if "BNK_TiledKSampler" in nodes.NODE_CLASS_MAPPINGS:
+ TiledKSampler = nodes.NODE_CLASS_MAPPINGS['BNK_TiledKSampler']
+ else:
+ utils.try_install_custom_node('https://github.com/BlenderNeko/ComfyUI_TiledKSampler',
+ "To use 'PixelTiledKSampleUpscalerProvider', 'Tiled sampling for ComfyUI' extension is required.")
+ raise RuntimeError("'BNK_TiledKSampler' node isn't installed.")
+
+ scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise = self.params
+ tile_width, tile_height, tiling_strategy = self.tile_params
+
+ if self.tile_cnet is not None:
+ image_batch, image_w, image_h, _ = images.shape
+ if image_batch > 1:
+ warnings.warn('Multiple latents in batch, Tile ControlNet being ignored')
+ else:
+ if 'TilePreprocessor' not in nodes.NODE_CLASS_MAPPINGS:
+ raise RuntimeError("'TilePreprocessor' node (from comfyui_controlnet_aux) isn't installed.")
+ preprocessor = nodes.NODE_CLASS_MAPPINGS['TilePreprocessor']()
+ # might add capacity to set pyrUp_iters later, not needed for now though
+ preprocessed = preprocessor.execute(images, pyrUp_iters=3, resolution=min(image_w, image_h))[0]
+
+ positive, negative = nodes.ControlNetApplyAdvanced().apply_controlnet(positive=positive,
+ negative=negative,
+ control_net=self.tile_cnet,
+ image=preprocessed,
+ strength=self.tile_cnet_strength,
+ start_percent=0, end_percent=1.0,
+ vae=self.vae)
+
+ return TiledKSampler().sample(model, seed, tile_width, tile_height, tiling_strategy, steps, cfg, sampler_name,
+ scheduler, positive, negative, latent, denoise)[0]
+
+ def upscale(self, step_info, samples, upscale_factor, save_temp_prefix=None):
+ scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise = self.params
+
+ if self.hook is not None:
+ self.hook.set_steps(step_info)
+
+ if self.upscale_model is None:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space2(samples, scale_method, upscale_factor, vae,
+ use_tile=True, save_temp_prefix=save_temp_prefix,
+ hook=self.hook, tile_size=self.tile_size)
+ else:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_with_model2(samples, scale_method, self.upscale_model,
+ upscale_factor, vae, use_tile=True,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook, tile_size=self.tile_size)
+
+ refined_latent = self.tiled_ksample(upscaled_latent, upscaled_images)
+
+ return refined_latent
+
+ def upscale_shape(self, step_info, samples, w, h, save_temp_prefix=None):
+ scale_method, model, vae, seed, steps, cfg, sampler_name, scheduler, positive, negative, denoise = self.params
+
+ if self.hook is not None:
+ self.hook.set_steps(step_info)
+
+ if self.upscale_model is None:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_shape2(samples, scale_method, w, h, vae,
+ use_tile=True, save_temp_prefix=save_temp_prefix,
+ hook=self.hook, tile_size=self.tile_size)
+ else:
+ upscaled_latent, upscaled_images = \
+ latent_upscale_on_pixel_space_with_model_shape2(samples, scale_method,
+ self.upscale_model, w, h, vae,
+ use_tile=True,
+ save_temp_prefix=save_temp_prefix,
+ hook=self.hook,
+ tile_size=self.tile_size)
+
+ refined_latent = self.tiled_ksample(upscaled_latent, upscaled_images)
+
+ return refined_latent
+
+
+# REQUIREMENTS: biegert/ComfyUI-CLIPSeg
+class BBoxDetectorBasedOnCLIPSeg:
+ prompt = None
+ blur = None
+ threshold = None
+ dilation_factor = None
+ aux = None
+
+ def __init__(self, prompt, blur, threshold, dilation_factor):
+ self.prompt = prompt
+ self.blur = blur
+ self.threshold = threshold
+ self.dilation_factor = dilation_factor
+
+ def detect(self, image, bbox_threshold, bbox_dilation, bbox_crop_factor, drop_size=1, detailer_hook=None):
+ mask = self.detect_combined(image, bbox_threshold, bbox_dilation)
+
+ mask = utils.make_2d_mask(mask)
+
+ segs = mask_to_segs(mask, False, bbox_crop_factor, True, drop_size, detailer_hook=detailer_hook)
+
+ if detailer_hook is not None and hasattr(detailer_hook, "post_detection"):
+ segs = detailer_hook.post_detection(segs)
+
+ return segs
+
+ def detect_combined(self, image, bbox_threshold, bbox_dilation):
+ if "CLIPSeg" in nodes.NODE_CLASS_MAPPINGS:
+ CLIPSeg = nodes.NODE_CLASS_MAPPINGS['CLIPSeg']
+ else:
+ utils.try_install_custom_node('https://github.com/biegert/ComfyUI-CLIPSeg/raw/main/custom_nodes/clipseg.py',
+ "To use 'CLIPSegDetectorProvider', 'CLIPSeg' extension is required.")
+ raise Exception("'CLIPSeg' node isn't installed.")
+
+ if self.threshold is None:
+ threshold = bbox_threshold
+ else:
+ threshold = self.threshold
+
+ if self.dilation_factor is None:
+ dilation_factor = bbox_dilation
+ else:
+ dilation_factor = self.dilation_factor
+
+ prompt = self.aux if self.prompt == '' and self.aux is not None else self.prompt
+
+ mask, _, _ = CLIPSeg().segment_image(image, prompt, self.blur, threshold, dilation_factor)
+ mask = utils.to_binary_mask(mask)
+ return mask
+
+ def setAux(self, x):
+ self.aux = x
+
+
+def update_node_status(node, text, progress=None):
+ if PromptServer.instance.client_id is None:
+ return
+
+ PromptServer.instance.send_sync("impact/update_status", {
+ "node": node,
+ "progress": progress,
+ "text": text
+ }, PromptServer.instance.client_id)
+
+
+def random_mask_raw(mask, bbox, factor):
+ x1, y1, x2, y2 = bbox
+ w = x2 - x1
+ h = y2 - y1
+
+ factor = max(6, int(min(w, h) * factor / 4))
+
+ def draw_random_circle(center, radius):
+ i, j = center
+ for x in range(int(i - radius), int(i + radius)):
+ for y in range(int(j - radius), int(j + radius)):
+ if np.linalg.norm(np.array([x, y]) - np.array([i, j])) <= radius:
+ mask[x, y] = 1
+
+ def draw_irregular_line(start, end, pivot, is_vertical):
+ i = start
+ while i < end:
+ base_radius = np.random.randint(5, factor)
+ radius = int(base_radius)
+
+ if is_vertical:
+ draw_random_circle((i, pivot), radius)
+ else:
+ draw_random_circle((pivot, i), radius)
+
+ i += radius
+
+ def draw_irregular_line_parallel(start, end, pivot, is_vertical):
+ with ThreadPoolExecutor(max_workers=16) as executor:
+ futures = []
+ step = (end - start) // 16
+ for i in range(start, end, step):
+ future = executor.submit(draw_irregular_line, i, min(i + step, end), pivot, is_vertical)
+ futures.append(future)
+
+ for future in futures:
+ future.result()
+
+ draw_irregular_line_parallel(y1 + factor, y2 - factor, x1 + factor, True)
+ draw_irregular_line_parallel(y1 + factor, y2 - factor, x2 - factor, True)
+ draw_irregular_line_parallel(x1 + factor, x2 - factor, y1 + factor, False)
+ draw_irregular_line_parallel(x1 + factor, x2 - factor, y2 - factor, False)
+
+ mask[y1 + factor:y2 - factor, x1 + factor:x2 - factor] = 1.0
+
+
+def random_mask(mask, bbox, factor, size=128):
+ small_mask = np.zeros((size, size)).astype(np.float32)
+ random_mask_raw(small_mask, (0, 0, size, size), factor)
+
+ x1, y1, x2, y2 = bbox
+ small_mask = torch.tensor(small_mask).unsqueeze(0).unsqueeze(0)
+ bbox_mask = torch.nn.functional.interpolate(small_mask, size=(y2 - y1, x2 - x1), mode='bilinear', align_corners=False)
+ bbox_mask = bbox_mask.squeeze(0).squeeze(0)
+ mask[y1:y2, x1:x2] = bbox_mask
+
+
+def adaptive_mask_paste(dest_mask, src_mask, bbox):
+ x1, y1, x2, y2 = bbox
+ small_mask = torch.tensor(src_mask).unsqueeze(0).unsqueeze(0)
+ bbox_mask = torch.nn.functional.interpolate(small_mask, size=(y2 - y1, x2 - x1), mode='bilinear', align_corners=False)
+ bbox_mask = bbox_mask.squeeze(0).squeeze(0)
+ dest_mask[y1:y2, x1:x2] = bbox_mask
+
+
+def crop_condition_mask(mask, image, crop_region):
+ cond_scale = (mask.shape[1] / image.shape[1], mask.shape[2] / image.shape[2])
+ mask_region = [round(v * cond_scale[i % 2]) for i, v in enumerate(crop_region)]
+ return utils.crop_ndarray3(mask, mask_region)
+
+
+class SafeToGPU:
+ def __init__(self, size):
+ self.size = size
+
+ def to_device(self, obj, device):
+ if utils.is_same_device(device, 'cpu'):
+ obj.to(device)
+ else:
+ if utils.is_same_device(obj.device, 'cpu'): # cpu to gpu
+ model_management.free_memory(self.size * 1.3, device)
+ if model_management.get_free_memory(device) > self.size * 1.3:
+ try:
+ obj.to(device)
+ except Exception:
+ logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [1]")
+ else:
+ logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [2]")
+
+
+class SafeToGPU_stub():
+ def to_device(self, obj, device):
+ pass
+
+
+from comfy.cli_args import args, LatentPreviewMethod
+import folder_paths
+from latent_preview import TAESD, TAESDPreviewerImpl, Latent2RGBPreviewer
+
+try:
+ import comfy.latent_formats as latent_formats
+
+
+ def get_previewer(device, latent_format=latent_formats.SD15(), force=False, method=None):
+ previewer = None
+
+ if method is None:
+ method = args.preview_method
+
+ if method != LatentPreviewMethod.NoPreviews or force:
+ # TODO previewer methods
+ taesd_decoder_path = None
+
+ if hasattr(latent_format, "taesd_decoder_path"):
+ taesd_decoder_path = folder_paths.get_full_path("vae_approx", latent_format.taesd_decoder_name)
+
+ if method == LatentPreviewMethod.Auto:
+ method = LatentPreviewMethod.Latent2RGB
+ if taesd_decoder_path:
+ method = LatentPreviewMethod.TAESD
+
+ if method == LatentPreviewMethod.TAESD:
+ if taesd_decoder_path:
+ taesd = TAESD(None, taesd_decoder_path, latent_channels=latent_format.latent_channels).to(device)
+ previewer = TAESDPreviewerImpl(taesd)
+ else:
+ logging.warning("[Impact Pack] TAESD previews enabled, but could not find models/vae_approx/{}".format(
+ latent_format.taesd_decoder_name))
+
+ if previewer is None:
+ previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors)
+ return previewer
+
+except Exception:
+ logging.error("#########################################################################")
+ logging.error("[ERROR] ComfyUI-Impact-Pack: Please update ComfyUI to the latest version.")
+ logging.error("#########################################################################")
diff --git a/docs/hel-892/tts-reference/impact__modules__impact__logics.py b/docs/hel-892/tts-reference/impact__modules__impact__logics.py
new file mode 100644
index 00000000..413ba494
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact__modules__impact__logics.py
@@ -0,0 +1,779 @@
+import sys
+import time
+
+import execution
+import impact.impact_server
+from server import PromptServer
+from impact.utils import any_typ
+import impact.core as core
+import re
+import nodes
+import logging
+
+
+class ImpactCompare:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "cmp": (['a = b', 'a <> b', 'a > b', 'a < b', 'a >= b', 'a <= b', 'tt', 'ff'],),
+ "a": (any_typ, ),
+ "b": (any_typ, ),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("BOOLEAN", )
+
+ def doit(self, cmp, a, b):
+ if cmp == "a = b":
+ return (a == b, )
+ elif cmp == "a <> b":
+ return (a != b, )
+ elif cmp == "a > b":
+ return (a > b, )
+ elif cmp == "a < b":
+ return (a < b, )
+ elif cmp == "a >= b":
+ return (a >= b, )
+ elif cmp == "a <= b":
+ return (a <= b, )
+ elif cmp == 'tt':
+ return (True, )
+ else:
+ return (False, )
+
+
+class ImpactNotEmptySEGS:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {"segs": ("SEGS",)}}
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("BOOLEAN", )
+
+ def doit(self, segs):
+ return (segs[1] != [], )
+
+
+class ImpactConditionalBranch:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "cond": ("BOOLEAN",),
+ "tt_value": (any_typ,{"lazy": True}),
+ "ff_value": (any_typ,{"lazy": True}),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = (any_typ, )
+
+ def check_lazy_status(self, cond, tt_value=None, ff_value=None):
+ if cond and tt_value is None:
+ return ["tt_value"]
+ if not cond and ff_value is None:
+ return ["ff_value"]
+
+ def doit(self, cond, tt_value=None, ff_value=None):
+ if cond:
+ return (tt_value,)
+ else:
+ return (ff_value,)
+
+
+class ImpactConditionalBranchSelMode:
+ @classmethod
+ def INPUT_TYPES(cls):
+ if not core.is_execution_model_version_supported():
+ required_inputs = {
+ "cond": ("BOOLEAN",),
+ "sel_mode": ("BOOLEAN", {"default": True, "label_on": "select_on_prompt", "label_off": "select_on_execution"}),
+ }
+ else:
+ required_inputs = {
+ "cond": ("BOOLEAN",),
+ }
+
+ return {
+ "required": required_inputs,
+ "optional": {
+ "tt_value": (any_typ,),
+ "ff_value": (any_typ,),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = (any_typ, )
+
+ def doit(self, cond, tt_value=None, ff_value=None, **kwargs):
+ if cond:
+ return (tt_value,)
+ else:
+ return (ff_value,)
+
+
+class ImpactConvertDataType:
+ def __init__(self):
+ pass
+
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {"value": (any_typ,)}}
+
+ RETURN_TYPES = ("STRING", "FLOAT", "INT", "BOOLEAN")
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+
+ @staticmethod
+ def is_number(string):
+ pattern = re.compile(r'^[-+]?[0-9]*\.?[0-9]+$')
+ return bool(pattern.match(string))
+
+ def doit(self, value):
+ if self.is_number(str(value)):
+ num = value
+ else:
+ if str.lower(str(value)) != "false":
+ num = 1
+ else:
+ num = 0
+ return (str(value), float(num), int(float(num)), bool(float(num)), )
+
+
+class ImpactIfNone:
+ def __init__(self):
+ pass
+
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {},
+ "optional": {"signal": (any_typ,), "any_input": (any_typ,), }
+ }
+
+ RETURN_TYPES = (any_typ, "BOOLEAN")
+ RETURN_NAMES = ("signal_opt", "bool")
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+
+ def doit(self, signal=None, any_input=None):
+ if any_input is None:
+ return (signal, False, )
+ else:
+ return (signal, True, )
+
+
+class ImpactLogicalOperators:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "operator": (['and', 'or', 'xor'],),
+ "bool_a": ("BOOLEAN", {"forceInput": True}),
+ "bool_b": ("BOOLEAN", {"forceInput": True}),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("BOOLEAN", )
+
+ def doit(self, operator, bool_a, bool_b):
+ if operator == "and":
+ return (bool_a and bool_b, )
+ elif operator == "or":
+ return (bool_a or bool_b, )
+ else:
+ return (bool_a != bool_b, )
+
+
+class ImpactConditionalStopIteration:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": { "cond": ("BOOLEAN", {"forceInput": True}), },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ()
+
+ OUTPUT_NODE = True
+
+ def doit(self, cond):
+ if cond:
+ PromptServer.instance.send_sync("stop-iteration", {})
+ return {}
+
+
+class ImpactNeg:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": { "value": ("BOOLEAN", {"forceInput": True}), },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("BOOLEAN", )
+
+ def doit(self, value):
+ return (not value, )
+
+
+class ImpactInt:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "value": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("INT", )
+
+ def doit(self, value):
+ return (value, )
+
+
+class ImpactFloat:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "value": ("FLOAT", {"default": 1.0, "min": -3.402823466e+38, "max": 3.402823466e+38}),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("FLOAT", )
+
+ def doit(self, value):
+ return (value, )
+
+
+class ImpactBoolean:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "value": ("BOOLEAN", {"default": False}),
+ },
+ }
+
+ FUNCTION = "doit"
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ("BOOLEAN", )
+
+ def doit(self, value):
+ return (value, )
+
+
+class ImpactValueSender:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "value": (any_typ, ),
+ "link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
+ },
+ "optional": {
+ "signal_opt": (any_typ,),
+ }
+ }
+
+ OUTPUT_NODE = True
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = (any_typ, )
+ RETURN_NAMES = ("signal", )
+
+ def doit(self, value, link_id=0, signal_opt=None):
+ PromptServer.instance.send_sync("value-send", {"link_id": link_id, "value": value})
+ return (signal_opt, )
+
+
+class ImpactIntConstSender:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ, ),
+ "value": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
+ "link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
+ },
+ }
+
+ OUTPUT_NODE = True
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = ()
+
+ def doit(self, signal, value, link_id=0):
+ PromptServer.instance.send_sync("value-send", {"link_id": link_id, "value": value})
+ return {}
+
+
+class ImpactValueReceiver:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "typ": (["STRING", "INT", "FLOAT", "BOOLEAN"], ),
+ "value": ("STRING", {"default": ""}),
+ "link_id": ("INT", {"default": 0, "min": 0, "max": sys.maxsize, "step": 1}),
+ },
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+
+ RETURN_TYPES = (any_typ, )
+
+ def doit(self, typ, value, link_id=0):
+ if typ == "INT":
+ return (int(value), )
+ elif typ == "FLOAT":
+ return (float(value), )
+ elif typ == "BOOLEAN":
+ return (value.lower() == "true", )
+ else:
+ return (value, )
+
+
+class ImpactImageInfo:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "value": ("IMAGE", ),
+ },
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+
+ RETURN_TYPES = ("INT", "INT", "INT", "INT")
+ RETURN_NAMES = ("batch", "height", "width", "channel")
+
+ def doit(self, value):
+ return (value.shape[0], value.shape[1], value.shape[2], value.shape[3])
+
+
+class ImpactLatentInfo:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "value": ("LATENT", ),
+ },
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+
+ RETURN_TYPES = ("INT", "INT", "INT", "INT")
+ RETURN_NAMES = ("batch", "height", "width", "channel")
+
+ def doit(self, value):
+ shape = value['samples'].shape
+ return (shape[0], shape[2] * 8, shape[3] * 8, shape[1])
+
+
+class ImpactMinMax:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "mode": ("BOOLEAN", {"default": True, "label_on": "max", "label_off": "min"}),
+ "a": (any_typ,),
+ "b": (any_typ,),
+ },
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+
+ RETURN_TYPES = ("INT", )
+
+ def doit(self, mode, a, b):
+ if mode:
+ return (max(a, b), )
+ else:
+ return (min(a, b),)
+
+
+class ImpactQueueTrigger:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ,),
+ "mode": ("BOOLEAN", {"default": True, "label_on": "Trigger", "label_off": "Don't trigger"}),
+ }
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = (any_typ,)
+ RETURN_NAMES = ("signal_opt",)
+ OUTPUT_NODE = True
+
+ def doit(self, signal, mode):
+ if(mode):
+ PromptServer.instance.send_sync("impact-add-queue", {})
+
+ return (signal,)
+
+
+class ImpactQueueTriggerCountdown:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "count": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ "total": ("INT", {"default": 10, "min": 1, "max": 0xffffffffffffffff}),
+ "mode": ("BOOLEAN", {"default": True, "label_on": "Trigger", "label_off": "Don't trigger"}),
+ },
+ "optional": {"signal": (any_typ,),},
+ "hidden": {"unique_id": "UNIQUE_ID"}
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = (any_typ, "INT", "INT")
+ RETURN_NAMES = ("signal_opt", "count", "total")
+ OUTPUT_NODE = True
+
+ def doit(self, count, total, mode, unique_id, signal=None):
+ if (mode):
+ if count < total - 1:
+ PromptServer.instance.send_sync("impact-node-feedback",
+ {"node_id": unique_id, "widget_name": "count", "type": "int", "value": count+1})
+ PromptServer.instance.send_sync("impact-add-queue", {})
+ if count >= total - 1:
+ PromptServer.instance.send_sync("impact-node-feedback",
+ {"node_id": unique_id, "widget_name": "count", "type": "int", "value": 0})
+
+ return (signal, count, total)
+
+
+
+class ImpactSetWidgetValue:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ,),
+ "node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ "widget_name": ("STRING", {"multiline": False}),
+ },
+ "optional": {
+ "boolean_value": ("BOOLEAN", {"forceInput": True}),
+ "int_value": ("INT", {"forceInput": True}),
+ "float_value": ("FLOAT", {"forceInput": True}),
+ "string_value": ("STRING", {"forceInput": True}),
+ }
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = (any_typ,)
+ RETURN_NAMES = ("signal_opt",)
+ OUTPUT_NODE = True
+
+ def doit(self, signal, node_id, widget_name, boolean_value=None, int_value=None, float_value=None, string_value=None, ):
+ kind = None
+ if boolean_value is not None:
+ value = boolean_value
+ kind = "BOOLEAN"
+ elif int_value is not None:
+ value = int_value
+ kind = "INT"
+ elif float_value is not None:
+ value = float_value
+ kind = "FLOAT"
+ elif string_value is not None:
+ value = string_value
+ kind = "STRING"
+ else:
+ value = None
+
+ if value is not None:
+ PromptServer.instance.send_sync("impact-node-feedback",
+ {"node_id": node_id, "widget_name": widget_name, "type": kind, "value": value})
+
+ return (signal,)
+
+
+class ImpactNodeSetMuteState:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ,),
+ "node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ "set_state": ("BOOLEAN", {"default": True, "label_on": "active", "label_off": "mute"}),
+ }
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = (any_typ,)
+ RETURN_NAMES = ("signal_opt",)
+ OUTPUT_NODE = True
+
+ def doit(self, signal, node_id, set_state):
+ PromptServer.instance.send_sync("impact-node-mute-state", {"node_id": node_id, "is_active": set_state})
+ return (signal,)
+
+
+class ImpactSleep:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ,),
+ "seconds": ("FLOAT", {"default": 0.5, "min": 0, "max": 3600}),
+ }
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = (any_typ,)
+ RETURN_NAMES = ("signal_opt",)
+ OUTPUT_NODE = True
+
+ def doit(self, signal, seconds):
+ time.sleep(seconds)
+ return (signal,)
+
+
+def workflow_to_map(workflow):
+ nodes = {}
+ links = {}
+ for link in workflow['links']:
+ links[link[0]] = link[1:]
+ for node in workflow['nodes']:
+ nodes[str(node['id'])] = node
+
+ return nodes, links
+
+
+class ImpactRemoteBoolean:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ "widget_name": ("STRING", {"multiline": False}),
+ "value": ("BOOLEAN", {"default": True, "label_on": "True", "label_off": "False"}),
+ }}
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = ()
+ OUTPUT_NODE = True
+
+ def doit(self, **kwargs):
+ return {}
+
+
+class ImpactRemoteInt:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "node_id": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
+ "widget_name": ("STRING", {"multiline": False}),
+ "value": ("INT", {"default": 0, "min": -0xffffffffffffffff, "max": 0xffffffffffffffff}),
+ }}
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic/_for_test"
+ RETURN_TYPES = ()
+ OUTPUT_NODE = True
+
+ def doit(self, **kwargs):
+ return {}
+
+class ImpactControlBridge:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "value": (any_typ,),
+ "mode": ("BOOLEAN", {"default": True, "label_on": "Active", "label_off": "Stop/Mute/Bypass"}),
+ "behavior": (["Stop", "Mute", "Bypass"], ),
+ },
+ "hidden": {"unique_id": "UNIQUE_ID", "prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}
+ }
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Logic"
+ RETURN_TYPES = (any_typ,)
+ RETURN_NAMES = ("value",)
+ OUTPUT_NODE = True
+
+ DESCRIPTION = ("When behavior is Stop and mode is active, the input value is passed directly to the output.\n"
+ "When behavior is Mute/Bypass and mode is active, the node connected to the output is changed to active state.\n"
+ "When behavior is Stop and mode is Stop/Mute/Bypass, the workflow execution of the current node is halted.\n"
+ "When behavior is Mute/Bypass and mode is Stop/Mute/Bypass, the node connected to the output is changed to Mute/Bypass state.")
+
+ @classmethod
+ def IS_CHANGED(self, value, mode, behavior="Stop", unique_id=None, prompt=None, extra_pnginfo=None):
+ if behavior == "Stop":
+ return value, mode, behavior
+ else:
+ # NOTE: extra_pnginfo is not populated for IS_CHANGED.
+ # so extra_pnginfo is useless in here
+ try:
+ workflow = core.current_prompt['extra_data']['extra_pnginfo']['workflow']
+ except Exception:
+ logging.info("[Impact Pack] core.current_prompt['extra_data']['extra_pnginfo']['workflow']")
+ return 0
+
+ nodes, links = workflow_to_map(workflow)
+ next_nodes = []
+
+ for link in nodes[unique_id]['outputs'][0]['links']:
+ node_id = str(links[link][2])
+ impact.utils.collect_non_reroute_nodes(nodes, links, next_nodes, node_id)
+
+ return next_nodes
+
+ def doit(self, value, mode, behavior="Stop", unique_id=None, prompt=None, extra_pnginfo=None):
+ global error_skip_flag
+
+ if core.is_execution_model_version_supported():
+ from comfy_execution.graph import ExecutionBlocker
+ else:
+ logging.info("[Impact Pack] ImpactControlBridge: ComfyUI is outdated. The 'Stop' behavior cannot function properly.")
+
+ if behavior == "Stop":
+ if mode:
+ return (value, )
+ else:
+ return (ExecutionBlocker(None), )
+ elif extra_pnginfo is None:
+ logging.warning(f"[Impact Pack] limitation: '{behavior}' behavior cannot be used in API execution.")
+ return (value,)
+ else:
+ workflow_nodes, links = workflow_to_map(extra_pnginfo['workflow'])
+
+ active_nodes = []
+ mute_nodes = []
+ bypass_nodes = []
+
+ for link in workflow_nodes[unique_id]['outputs'][0]['links']:
+ node_id = str(links[link][2])
+
+ next_nodes = []
+ impact.utils.collect_non_reroute_nodes(workflow_nodes, links, next_nodes, node_id)
+
+ for next_node_id in next_nodes:
+ node_mode = workflow_nodes[next_node_id]['mode']
+
+ if node_mode == 0:
+ active_nodes.append(next_node_id)
+ elif node_mode == 2:
+ mute_nodes.append(next_node_id)
+ elif node_mode == 4:
+ bypass_nodes.append(next_node_id)
+
+ if mode:
+ # active
+ should_be_active_nodes = mute_nodes + bypass_nodes
+ if len(should_be_active_nodes) > 0:
+ PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'actives': list(should_be_active_nodes)})
+ nodes.interrupt_processing()
+
+ elif behavior == "Mute" or behavior == True: # noqa: E712
+ # mute
+ should_be_mute_nodes = active_nodes + bypass_nodes
+ if len(should_be_mute_nodes) > 0:
+ PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'mutes': list(should_be_mute_nodes)})
+ nodes.interrupt_processing()
+
+ else:
+ # bypass
+ should_be_bypass_nodes = active_nodes + mute_nodes
+ if len(should_be_bypass_nodes) > 0:
+ PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'bypasses': list(should_be_bypass_nodes)})
+ nodes.interrupt_processing()
+
+ return (value, )
+
+
+class ImpactExecutionOrderController:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "signal": (any_typ,),
+ "value": (any_typ,),
+ }}
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+ RETURN_TYPES = (any_typ, any_typ)
+ RETURN_NAMES = ("signal", "value")
+
+ def doit(self, signal, value):
+ return signal, value
+
+
+class ImpactListBridge:
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {"required": {
+ "list_input": (any_typ,),
+ }}
+
+ FUNCTION = "doit"
+
+ DESCRIPTION = "When passing the list output through this node, it collects and organizes the data before forwarding it, which ensures that the previous stage's sub-workflow has been completed."
+
+ CATEGORY = "ImpactPack/Util"
+ RETURN_TYPES = (any_typ, )
+ RETURN_NAMES = ("list_output", )
+
+ INPUT_IS_LIST = True
+ OUTPUT_IS_LIST = (True, )
+
+ @staticmethod
+ def doit(list_input):
+ return (list_input,)
+
+
+original_handle_execution = execution.PromptExecutor.handle_execution_error
+
+
+def handle_execution_error(**kwargs):
+ execution.PromptExecutor.handle_execution_error(**kwargs)
+
diff --git a/docs/hel-892/tts-reference/impact__modules__impact__util_nodes.py b/docs/hel-892/tts-reference/impact__modules__impact__util_nodes.py
new file mode 100644
index 00000000..1c94c48f
--- /dev/null
+++ b/docs/hel-892/tts-reference/impact__modules__impact__util_nodes.py
@@ -0,0 +1,775 @@
+from impact.utils import any_typ, ByPassTypeTuple, make_3d_mask
+import comfy_extras.nodes_mask
+from nodes import MAX_RESOLUTION
+import torch
+import comfy
+import sys
+import nodes
+import re
+import impact.core as core
+from server import PromptServer
+import inspect
+import logging
+
+
+class GeneralSwitch:
+ @classmethod
+ def INPUT_TYPES(s):
+ dyn_inputs = {"input1": (any_typ, {"lazy": True, "tooltip": "Any input. When connected, one more input slot is added."}), }
+ if core.is_execution_model_version_supported():
+ stack = inspect.stack()
+ if stack[2].function == 'get_input_info':
+ # bypass validation
+ class AllContainer:
+ def __contains__(self, item):
+ return True
+
+ def __getitem__(self, key):
+ return any_typ, {"lazy": True}
+
+ dyn_inputs = AllContainer()
+
+ inputs = {"required": {
+ "select": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1, "tooltip": "The input number you want to output among the inputs"}),
+ "sel_mode": ("BOOLEAN", {"default": False, "label_on": "select_on_prompt", "label_off": "select_on_execution", "forceInput": False,
+ "tooltip": "In the case of 'select_on_execution', the selection is dynamically determined at the time of workflow execution. 'select_on_prompt' is an option that exists for older versions of ComfyUI, and it makes the decision before the workflow execution."}),
+ },
+ "optional": dyn_inputs,
+ "hidden": {"unique_id": "UNIQUE_ID", "extra_pnginfo": "EXTRA_PNGINFO"}
+ }
+
+ return inputs
+
+ RETURN_TYPES = (any_typ, "STRING", "INT")
+ RETURN_NAMES = ("selected_value", "selected_label", "selected_index")
+ OUTPUT_TOOLTIPS = ("Output is generated only from the input chosen by the 'select' value.", "Slot label of the selected input slot", "Outputs the select value as is")
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def check_lazy_status(self, *args, **kwargs):
+ selected_index = int(kwargs['select'])
+ input_name = f"input{selected_index}"
+
+ logging.info(f"SELECTED: {input_name}")
+
+ if input_name in kwargs:
+ return [input_name]
+ else:
+ return []
+
+ @staticmethod
+ def doit(*args, **kwargs):
+ selected_index = int(kwargs['select'])
+ input_name = f"input{selected_index}"
+
+ selected_label = input_name
+ node_id = kwargs['unique_id']
+
+ if 'extra_pnginfo' in kwargs and kwargs['extra_pnginfo'] is not None:
+ nodelist = kwargs['extra_pnginfo']['workflow']['nodes']
+ for node in nodelist:
+ if str(node['id']) == node_id:
+ inputs = node['inputs']
+
+ for slot in inputs:
+ if slot['name'] == input_name and 'label' in slot:
+ selected_label = slot['label']
+
+ break
+ else:
+ logging.info("[Impact-Pack] The switch node does not guarantee proper functioning in API mode.")
+
+ if input_name in kwargs:
+ return kwargs[input_name], selected_label, selected_index
+ else:
+ logging.info("ImpactSwitch: invalid select index (ignored)")
+ return None, "", selected_index
+
+class LatentSwitch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "select": ("INT", {"default": 1, "min": 1, "max": 99999, "step": 1}),
+ "latent1": ("LATENT",),
+ },
+ }
+
+ RETURN_TYPES = ("LATENT", )
+
+ OUTPUT_NODE = True
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, *args, **kwargs):
+ input_name = f"latent{int(kwargs['select'])}"
+
+ if input_name in kwargs:
+ return (kwargs[input_name],)
+ else:
+ logging.info("LatentSwitch: invalid select index ('latent1' is selected)")
+ return (kwargs['latent1'],)
+
+
+class ImageMaskSwitch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "select": ("INT", {"default": 1, "min": 1, "max": 4, "step": 1}),
+ "images1": ("IMAGE",),
+ },
+
+ "optional": {
+ "mask1_opt": ("MASK",),
+ "images2_opt": ("IMAGE",),
+ "mask2_opt": ("MASK",),
+ "images3_opt": ("IMAGE",),
+ "mask3_opt": ("MASK",),
+ "images4_opt": ("IMAGE",),
+ "mask4_opt": ("MASK",),
+ },
+ }
+
+ RETURN_TYPES = ("IMAGE", "MASK",)
+
+ OUTPUT_NODE = True
+
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, select, images1, mask1_opt=None, images2_opt=None, mask2_opt=None, images3_opt=None, mask3_opt=None,
+ images4_opt=None, mask4_opt=None):
+ if select == 1:
+ return images1, mask1_opt,
+ elif select == 2:
+ return images2_opt, mask2_opt,
+ elif select == 3:
+ return images3_opt, mask3_opt,
+ else:
+ return images4_opt, mask4_opt,
+
+
+class GeneralInversedSwitch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "select": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1, "tooltip": "The output number you want to send from the input"}),
+ "input": (any_typ, {"tooltip": "Any input. When connected, one more input slot is added."}),
+
+ },
+ "optional": {
+ "sel_mode": ("BOOLEAN", {"default": False, "label_on": "select_on_prompt", "label_off": "select_on_execution", "forceInput": False,
+ "tooltip": "In the case of 'select_on_execution', the selection is dynamically determined at the time of workflow execution. 'select_on_prompt' is an option that exists for older versions of ComfyUI, and it makes the decision before the workflow execution."}),
+ },
+ "hidden": {"prompt": "PROMPT", "unique_id": "UNIQUE_ID"},
+ }
+
+ RETURN_TYPES = ByPassTypeTuple((any_typ, ))
+ OUTPUT_TOOLTIPS = ("Output occurs only from the output selected by the 'select' value.\nWhen slots are connected, additional slots are created.", )
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, select, prompt, unique_id, input, **kwargs):
+ if core.is_execution_model_version_supported():
+ from comfy_execution.graph import ExecutionBlocker
+ else:
+ logging.warning("[Impact Pack] InversedSwitch: ComfyUI is outdated. The 'select_on_execution' mode cannot function properly.")
+
+ res = []
+
+ # search max output count in prompt
+ cnt = 0
+ for x in prompt.values():
+ for y in x.get('inputs', {}).values():
+ if isinstance(y, list) and len(y) == 2:
+ if y[0] == unique_id:
+ cnt = max(cnt, y[1])
+
+ for i in range(0, cnt + 1):
+ if select == i+1:
+ res.append(input)
+ elif core.is_execution_model_version_supported():
+ res.append(ExecutionBlocker(None))
+ else:
+ res.append(None)
+
+ return res
+
+
+class RemoveNoiseMask:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {"samples": ("LATENT",)}}
+
+ RETURN_TYPES = ("LATENT",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, samples):
+ res = {key: value for key, value in samples.items() if key != 'noise_mask'}
+ return (res, )
+
+
+class ImagePasteMasked:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "destination": ("IMAGE",),
+ "source": ("IMAGE",),
+ "x": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
+ "y": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 1}),
+ "resize_source": ("BOOLEAN", {"default": False}),
+ },
+ "optional": {
+ "mask": ("MASK",),
+ }
+ }
+ RETURN_TYPES = ("IMAGE",)
+ FUNCTION = "composite"
+
+ CATEGORY = "image"
+
+ def composite(self, destination, source, x, y, resize_source, mask = None):
+ destination = destination.clone().movedim(-1, 1)
+ output = comfy_extras.nodes_mask.composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1)
+ return (output,)
+
+
+from impact.utils import any_typ
+
+class ImpactLogger:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "data": (any_typ,),
+ "text": ("STRING", {"multiline": True}),
+ },
+ "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO", "unique_id": "UNIQUE_ID"},
+ }
+
+ CATEGORY = "ImpactPack/Debug"
+
+ OUTPUT_NODE = True
+
+ RETURN_TYPES = ()
+ FUNCTION = "doit"
+
+ def doit(self, data, text, prompt, extra_pnginfo, unique_id):
+ shape = ""
+ if hasattr(data, "shape"):
+ shape = f"{data.shape} / "
+
+ logging.info(f"[IMPACT LOGGER]: {shape}{data}")
+
+ logging.info(f" PROMPT: {prompt}")
+
+ # for x in prompt:
+ # if 'inputs' in x and 'populated_text' in x['inputs']:
+ # print(f"PROMPT: {x['10']['inputs']['populated_text']}")
+ #
+ # for x in extra_pnginfo['workflow']['nodes']:
+ # if x['type'] == 'ImpactWildcardProcessor':
+ # print(f" WV : {x['widgets_values'][1]}\n")
+
+ PromptServer.instance.send_sync("impact-node-feedback", {"node_id": unique_id, "widget_name": "text", "type": "TEXT", "value": f"{data}"})
+ return {}
+
+
+class ImpactDummyInput:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {}}
+
+ CATEGORY = "ImpactPack/Debug"
+
+ RETURN_TYPES = (any_typ,)
+ FUNCTION = "doit"
+
+ def doit(self):
+ return ("DUMMY",)
+
+
+class MasksToMaskList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"optional": {
+ "masks": ("MASK", ),
+ }
+ }
+
+ RETURN_TYPES = ("MASK", )
+ OUTPUT_IS_LIST = (True, )
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Operation"
+
+ def doit(self, masks):
+ if masks is None:
+ empty_mask = torch.zeros((64, 64), dtype=torch.float32, device="cpu")
+ return ([empty_mask], )
+
+ res = []
+
+ for mask in masks:
+ res.append(mask)
+
+ res = [make_3d_mask(x) for x in res]
+
+ return (res, )
+
+
+class MaskListToMaskBatch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "mask": ("MASK", ),
+ }
+ }
+
+ INPUT_IS_LIST = True
+
+ RETURN_TYPES = ("MASK", )
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Operation"
+
+ def doit(self, mask):
+ if len(mask) == 0:
+ empty_mask = torch.zeros((1, 64, 64), dtype=torch.float32, device="cpu").unsqueeze(0)
+ return (empty_mask,)
+
+ masks_3d = [make_3d_mask(m) for m in mask]
+ target_shape = masks_3d[0].shape[1:]
+ upscaled_masks = []
+ for m in masks_3d:
+ if m.shape[1:] != target_shape:
+ m = m.unsqueeze(1).repeat(1, 3, 1, 1)
+ m = comfy.utils.common_upscale(m, target_shape[1], target_shape[0], "lanczos", "center")
+ m = m[:, 0, :, :]
+
+ upscaled_masks.append(m)
+ # Concatenate all at once
+ result = torch.cat(upscaled_masks, dim=0)
+ return (result,)
+
+
+class ImageListToImageBatch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "images": ("IMAGE", ),
+ }
+ }
+
+ INPUT_IS_LIST = True
+
+ RETURN_TYPES = ("IMAGE", )
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Operation"
+
+ def doit(self, images):
+ if len(images) == 0:
+ return ()
+ if len(images) == 1:
+ img = images[0]
+ if img.ndim == 3: # add batch dim if missing
+ img = img.unsqueeze(0)
+ return (img,)
+
+ # Start with the first image
+ image1 = images[0]
+ if image1.ndim == 3:
+ image1 = image1.unsqueeze(0)
+
+ for image2 in images[1:]:
+ # Ensure batch dim
+ if image2.ndim == 3:
+ image2 = image2.unsqueeze(0)
+
+ # Ensure same device
+ if image2.device != image1.device:
+ image2 = image2.to(image1.device)
+
+ # Ensure HxW match exactly
+ H, W = image1.shape[1], image1.shape[2]
+ if image2.shape[1] != H or image2.shape[2] != W:
+ image2 = comfy.utils.common_upscale(
+ image2.movedim(-1, 1), # move channels first
+ W, # width
+ H, # height
+ "lanczos",
+ "center"
+ ).movedim(1, -1) # move channels back last
+
+ # Ensure channels match
+ if image2.shape[3] != image1.shape[3]:
+ # simple fix: truncate or pad channels
+ min_C = min(image1.shape[3], image2.shape[3])
+ image1 = image1[:, :, :, :min_C]
+ image2 = image2[:, :, :, :min_C]
+
+ # Concatenate along batch dimension
+ image1 = torch.cat((image1, image2), dim=0)
+
+ return (image1,)
+
+
+class ImageBatchToImageList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {"image": ("IMAGE",), }}
+
+ RETURN_TYPES = ("IMAGE",)
+ OUTPUT_IS_LIST = (True,)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, image):
+ images = [image[i:i + 1, ...] for i in range(image.shape[0])]
+ return (images, )
+
+
+class MakeAnyList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {},
+ "optional": {"value1": (any_typ,), }
+ }
+
+ RETURN_TYPES = (any_typ,)
+ OUTPUT_IS_LIST = (True,)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, **kwargs):
+ values = []
+
+ for k, v in kwargs.items():
+ if v is not None:
+ values.append(v)
+
+ return (values, )
+
+
+class MakeMaskList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {"mask1": ("MASK",), }}
+
+ RETURN_TYPES = ("MASK",)
+ OUTPUT_IS_LIST = (True,)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, **kwargs):
+ masks = []
+
+ for k, v in kwargs.items():
+ masks.append(v)
+
+ return (masks, )
+
+
+class NthItemOfAnyList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "any_list": (any_typ,),
+ "index": ("INT", {"default": 0, "min": -sys.maxsize, "max": sys.maxsize, "step": 1, "tooltip": "The index of the item you want to select from the list. Use negative values to select from the end (e.g., -1 for last item, -2 for second to last)."}),
+ }
+ }
+
+ RETURN_TYPES = (any_typ,)
+ INPUT_IS_LIST = True
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ DESCRIPTION = "Selects the Nth item from a list. If the index is out of range, it returns the last item in the list."
+
+ def doit(self, any_list, index):
+ i = index[0]
+ list_len = len(any_list)
+ if i >= list_len or i < -list_len:
+ return (any_list[-1],)
+ else:
+ return (any_list[i],)
+
+
+class MakeImageList:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"optional": {"image1": ("IMAGE",), }}
+
+ RETURN_TYPES = ("IMAGE",)
+ OUTPUT_IS_LIST = (True,)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, **kwargs):
+ images = []
+
+ for k, v in kwargs.items():
+ images.append(v)
+
+ return (images, )
+
+
+class MakeImageBatch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"optional": {"image1": ("IMAGE",), }}
+
+ RETURN_TYPES = ("IMAGE",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, **kwargs):
+ images = [value for value in kwargs.values()]
+
+ if len(images) == 1:
+ return (images[0],)
+ else:
+ image1 = images[0]
+ for image2 in images[1:]:
+ if image1.shape[1:] != image2.shape[1:]:
+ image2 = comfy.utils.common_upscale(image2.movedim(-1, 1), image1.shape[2], image1.shape[1], "lanczos", "center").movedim(1, -1)
+ image1 = torch.cat((image1, image2), dim=0)
+ return (image1,)
+
+
+class MakeMaskBatch:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"optional": {"mask1": ("MASK",), }}
+
+ RETURN_TYPES = ("MASK",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, **kwargs):
+ masks = [make_3d_mask(value) for value in kwargs.values()]
+
+ if len(masks) == 1:
+ return (masks[0],)
+ else:
+ mask1 = masks[0]
+ for mask2 in masks[1:]:
+ if mask1.shape[1:] != mask2.shape[1:]:
+ mask2 = comfy.utils.common_upscale(mask2.movedim(-1, 1), mask1.shape[2], mask1.shape[1], "lanczos", "center").movedim(1, -1)
+ mask1 = torch.cat((mask1, mask2), dim=0)
+ return (mask1,)
+
+
+class ReencodeLatent:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "samples": ("LATENT", ),
+ "tile_mode": (["None", "Both", "Decode(input) only", "Encode(output) only"],),
+ "input_vae": ("VAE", ),
+ "output_vae": ("VAE", ),
+ "tile_size": ("INT", {"default": 512, "min": 320, "max": 4096, "step": 64}),
+ },
+ "optional": {
+ "overlap": ("INT", {"default": 64, "min": 0, "max": 4096, "step": 32, "tooltip": "This setting applies when 'tile_mode' is enabled."}),
+ }
+ }
+
+ CATEGORY = "ImpactPack/Util"
+
+ RETURN_TYPES = ("LATENT", )
+ FUNCTION = "doit"
+
+ def doit(self, samples, tile_mode, input_vae, output_vae, tile_size=512, overlap=64):
+ if tile_mode in ["Both", "Decode(input) only"]:
+ decoder = nodes.VAEDecodeTiled()
+ if 'overlap' in inspect.signature(decoder.decode).parameters:
+ pixels = decoder.decode(input_vae, samples, tile_size, overlap=overlap)[0]
+ else:
+ pixels = decoder.decode(input_vae, samples, tile_size, overlap=overlap)[0]
+ else:
+ pixels = nodes.VAEDecode().decode(input_vae, samples)[0]
+
+ if tile_mode in ["Both", "Encode(output) only"]:
+ encoder = nodes.VAEEncodeTiled()
+ if 'overlap' in inspect.signature(encoder.encode).parameters:
+ return encoder.encode(output_vae, pixels, tile_size, overlap=overlap)
+ else:
+ return encoder.encode(output_vae, pixels, tile_size)
+ else:
+ return nodes.VAEEncode().encode(output_vae, pixels)
+
+
+class ReencodeLatentPipe:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "samples": ("LATENT", ),
+ "tile_mode": (["None", "Both", "Decode(input) only", "Encode(output) only"],),
+ "input_basic_pipe": ("BASIC_PIPE", ),
+ "output_basic_pipe": ("BASIC_PIPE", ),
+ },
+ }
+
+ CATEGORY = "ImpactPack/Util"
+
+ RETURN_TYPES = ("LATENT", )
+ FUNCTION = "doit"
+
+ def doit(self, samples, tile_mode, input_basic_pipe, output_basic_pipe):
+ _, _, input_vae, _, _ = input_basic_pipe
+ _, _, output_vae, _, _ = output_basic_pipe
+ return ReencodeLatent().doit(samples, tile_mode, input_vae, output_vae)
+
+
+class StringSelector:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {"required": {
+ "strings": ("STRING", {"multiline": True}),
+ "multiline": ("BOOLEAN", {"default": False, "label_on": "enabled", "label_off": "disabled"}),
+ "select": ("INT", {"min": 0, "max": sys.maxsize, "step": 1, "default": 0}),
+ }}
+
+ RETURN_TYPES = ("STRING",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, strings, multiline, select):
+ lines = strings.split('\n')
+
+ if multiline:
+ result = []
+ current_string = ""
+
+ for line in lines:
+ if line.startswith("#"):
+ if current_string:
+ result.append(current_string.strip())
+ current_string = ""
+ current_string += line + "\n"
+
+ if current_string:
+ result.append(current_string.strip())
+
+ if len(result) == 0:
+ selected = strings
+ else:
+ selected = result[select % len(result)]
+
+ if selected.startswith('#'):
+ selected = selected[1:]
+ else:
+ if len(lines) == 0:
+ selected = strings
+ else:
+ selected = lines[select % len(lines)]
+
+ return (selected, )
+
+
+class StringListToString:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "join_with": ("STRING", {"default": "\\n"}),
+ "string_list": ("STRING", {"forceInput": True}),
+ }
+ }
+
+ INPUT_IS_LIST = True
+ RETURN_TYPES = ("STRING",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, join_with, string_list):
+ # convert \\n to newline character
+ if join_with[0] == "\\n":
+ join_with[0] = "\n"
+
+ joined_text = join_with[0].join(string_list)
+
+ return (joined_text,)
+
+
+class WildcardPromptFromString:
+ @classmethod
+ def INPUT_TYPES(s):
+ return {
+ "required": {
+ "string": ("STRING", {"forceInput": True}),
+ "delimiter": ("STRING", {"multiline": False, "default": "\\n" }),
+ "prefix_all": ("STRING", {"multiline": False}),
+ "postfix_all": ("STRING", {"multiline": False}),
+ "restrict_to_tags": ("STRING", {"multiline": False}),
+ "exclude_tags": ("STRING", {"multiline": False})
+ },
+ }
+
+ RETURN_TYPES = ("STRING", "STRING",)
+ RETURN_NAMES = ("wildcard", "segs_labels",)
+ FUNCTION = "doit"
+
+ CATEGORY = "ImpactPack/Util"
+
+ def doit(self, string, delimiter, prefix_all, postfix_all, restrict_to_tags, exclude_tags):
+ # convert \\n to newline character
+ if delimiter == "\\n":
+ delimiter = "\n"
+
+ # some sanity checks and normalization for later processing
+ if prefix_all is None:
+ prefix_all = ""
+ if postfix_all is None:
+ postfix_all = ""
+ if restrict_to_tags is None:
+ restrict_to_tags = ""
+ if exclude_tags is None:
+ exclude_tags = ""
+
+ restrict_to_tags = restrict_to_tags.split(", ")
+ exclude_tags = exclude_tags.split(", ")
+
+ # build the wildcard prompt per list entry
+ output = ["[LAB]"]
+ labels = []
+ for x in string.split(delimiter):
+ label = str(len(labels) + 1)
+ labels.append(label)
+ x = x.split(", ")
+ # restrict to tags
+ if restrict_to_tags != [""]:
+ x = list(set(x) & set(restrict_to_tags))
+ # remove tags
+ if exclude_tags != [""]:
+ x = list(set(x) - set(exclude_tags))
+ # next row: