mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-28 08:46:35 +00:00
Renamed 'node' to 'cls' in PreviewImage/Mask
This commit is contained in:
parent
5423a4f262
commit
5ee63e284b
@ -27,7 +27,7 @@ class SavedResult:
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PreviewImage(_UIOutput):
|
class PreviewImage(_UIOutput):
|
||||||
def __init__(self, image: Image.Type, animated: bool=False, node: ComfyNodeV3=None, **kwargs):
|
def __init__(self, image: Image.Type, animated: bool=False, cls: ComfyNodeV3=None, **kwargs):
|
||||||
output_dir = folder_paths.get_temp_directory()
|
output_dir = folder_paths.get_temp_directory()
|
||||||
type = "temp"
|
type = "temp"
|
||||||
prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))
|
prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))
|
||||||
@ -41,13 +41,13 @@ class PreviewImage(_UIOutput):
|
|||||||
i = 255. * image.cpu().numpy()
|
i = 255. * image.cpu().numpy()
|
||||||
img = PILImage.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
img = PILImage.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||||
metadata = None
|
metadata = None
|
||||||
if not args.disable_metadata and node is not None:
|
if not args.disable_metadata and cls is not None:
|
||||||
metadata = PngInfo()
|
metadata = PngInfo()
|
||||||
if node.hidden.prompt is not None:
|
if cls.hidden.prompt is not None:
|
||||||
metadata.add_text("prompt", json.dumps(node.hidden.prompt))
|
metadata.add_text("prompt", json.dumps(cls.hidden.prompt))
|
||||||
if node.hidden.extra_pnginfo is not None:
|
if cls.hidden.extra_pnginfo is not None:
|
||||||
for x in node.hidden.extra_pnginfo:
|
for x in cls.hidden.extra_pnginfo:
|
||||||
metadata.add_text(x, json.dumps(node.hidden.extra_pnginfo[x]))
|
metadata.add_text(x, json.dumps(cls.hidden.extra_pnginfo[x]))
|
||||||
|
|
||||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||||
file = f"{filename_with_batch_num}_{counter:05}_.png"
|
file = f"{filename_with_batch_num}_{counter:05}_.png"
|
||||||
@ -66,9 +66,9 @@ class PreviewImage(_UIOutput):
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PreviewMask(PreviewImage):
|
class PreviewMask(PreviewImage):
|
||||||
def __init__(self, mask: PreviewMask.Type, animated: bool=False, node: ComfyNodeV3=None, **kwargs):
|
def __init__(self, mask: PreviewMask.Type, animated: bool=False, cls: ComfyNodeV3=None, **kwargs):
|
||||||
preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
|
preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
|
||||||
super().__init__(preview, animated, node, **kwargs)
|
super().__init__(preview, animated, cls, **kwargs)
|
||||||
|
|
||||||
# class UILatent(_UIOutput):
|
# class UILatent(_UIOutput):
|
||||||
# def __init__(self, values: list[SavedResult | dict], **kwargs):
|
# def __init__(self, values: list[SavedResult | dict], **kwargs):
|
||||||
|
@ -105,7 +105,7 @@ class V3TestNode(io.ComfyNodeV3):
|
|||||||
if hasattr(cls, "doohickey"):
|
if hasattr(cls, "doohickey"):
|
||||||
raise Exception("The 'cls' variable leaked state on class properties between runs!")
|
raise Exception("The 'cls' variable leaked state on class properties between runs!")
|
||||||
cls.doohickey = "LOLJK"
|
cls.doohickey = "LOLJK"
|
||||||
return io.NodeOutput(some_int, image, ui=ui.PreviewImage(image))
|
return io.NodeOutput(some_int, image, ui=ui.PreviewImage(image, cls=cls))
|
||||||
|
|
||||||
|
|
||||||
class V3LoraLoader(io.ComfyNodeV3):
|
class V3LoraLoader(io.ComfyNodeV3):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user