mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
## Summary Tested these changes and confirmed that: 1. Feedback button shows. 2. You can run workflows and switch out models. 3. You can use the mask editor. (thank you @ric-yu for helping me verify). ## Changes A lot, please see commits. Gets us up to date with `main` as of 10-11-2025. --------- Co-authored-by: Simula_r <18093452+simula-r@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: snomiao <snomiao@gmail.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: DrJKL <DrJKL@users.noreply.github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Marwan Ahmed <155799754+marawan206@users.noreply.github.com> Co-authored-by: DrJKL <DrJKL0424@gmail.com> Co-authored-by: Rizumu Ayaka <rizumu@ayaka.moe> Co-authored-by: Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> Co-authored-by: AustinMroz <4284322+AustinMroz@users.noreply.github.com> Co-authored-by: Austin Mroz <austin@comfy.org> Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com> Co-authored-by: Benjamin Lu <benceruleanlu@proton.me> Co-authored-by: Jin Yi <jin12cc@gmail.com> Co-authored-by: Robin Huang <robin.j.huang@gmail.com>
85 lines
2.3 KiB
Python
85 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import torch
|
|
|
|
import comfy.utils as utils
|
|
from comfy.model_patcher import ModelPatcher
|
|
import nodes
|
|
import folder_paths
|
|
|
|
|
|
class DummyPatch(torch.nn.Module):
|
|
def __init__(self, module: torch.nn.Module, dummy_float: float = 0.0):
|
|
super().__init__()
|
|
self.module = module
|
|
self.dummy_float = dummy_float
|
|
|
|
def forward(self, *args, **kwargs):
|
|
if isinstance(self.module, DummyPatch):
|
|
raise Exception(f"Calling nested dummy patch! {self.dummy_float}")
|
|
|
|
return self.module(*args, **kwargs)
|
|
|
|
|
|
class ObjectPatchNode:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"model": ("MODEL",),
|
|
"target_module": ("STRING", {"multiline": True}),
|
|
},
|
|
"optional": {
|
|
"dummy_float": ("FLOAT", {"default": 0.0}),
|
|
},
|
|
}
|
|
|
|
RETURN_TYPES = ("MODEL",)
|
|
FUNCTION = "apply_patch"
|
|
CATEGORY = "DevTools"
|
|
DESCRIPTION = "A node that applies an object patch"
|
|
|
|
def apply_patch(
|
|
self, model: ModelPatcher, target_module: str, dummy_float: float = 0.0
|
|
) -> ModelPatcher:
|
|
module = utils.get_attr(model.model, target_module)
|
|
work_model = model.clone()
|
|
work_model.add_object_patch(target_module, DummyPatch(module, dummy_float))
|
|
return (work_model,)
|
|
|
|
|
|
class LoadAnimatedImageTest(nodes.LoadImage):
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
input_dir = folder_paths.get_input_directory()
|
|
files = [
|
|
f
|
|
for f in os.listdir(input_dir)
|
|
if os.path.isfile(os.path.join(input_dir, f)) and f.endswith(".webp")
|
|
]
|
|
files = folder_paths.filter_files_content_types(files, ["image"])
|
|
return {
|
|
"required": {"image": (sorted(files), {"animated_image_upload": True})},
|
|
}
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"DevToolsObjectPatchNode": ObjectPatchNode,
|
|
"DevToolsLoadAnimatedImageTest": LoadAnimatedImageTest,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"DevToolsObjectPatchNode": "Object Patch Node",
|
|
"DevToolsLoadAnimatedImageTest": "Load Animated Image",
|
|
}
|
|
|
|
__all__ = [
|
|
"DummyPatch",
|
|
"ObjectPatchNode",
|
|
"LoadAnimatedImageTest",
|
|
"NODE_CLASS_MAPPINGS",
|
|
"NODE_DISPLAY_NAME_MAPPINGS",
|
|
]
|