diff --git a/README.md b/README.md index 2367c950..50507b1c 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ This custom node helps to conveniently enhance images through Detector, Detailer * `Dilate SEG_ELT` - Dilate the mask of SEG_ELT. * `From SEG_ELT` bbox - Extract coordinate from bbox in SEG_ELT * `From SEG_ELT` crop_region - Extract coordinate from crop_region in SEG_ELT + * `Count Elt in SEGS` - Number of Elts ins SEGS ### Pipe nodes * `ToDetailerPipe`, `FromDetailerPipe` - These nodes are used to bundle multiple inputs used in the detailer, such as models and vae, ..., into a single DETAILER_PIPE or extract the elements that are bundled in the DETAILER_PIPE. diff --git a/__init__.py b/__init__.py index a1430633..bde026b7 100644 --- a/__init__.py +++ b/__init__.py @@ -195,6 +195,7 @@ def do_install(): "ImpactScaleBy_BBOX_SEG_ELT": SEG_ELT_BBOX_ScaleBy, "ImpactFrom_SEG_ELT_bbox": From_SEG_ELT_bbox, "ImpactFrom_SEG_ELT_crop_region": From_SEG_ELT_crop_region, + "ImpactCount_Elts_in_SEGS": Count_Elts_in_SEGS, "BboxDetectorCombined_v2": BboxDetectorCombined, "SegmDetectorCombined_v2": SegmDetectorCombined, @@ -380,6 +381,7 @@ def do_install(): "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)", diff --git a/modules/impact/config.py b/modules/impact/config.py index bb733d2f..0f80a966 100644 --- a/modules/impact/config.py +++ b/modules/impact/config.py @@ -1,7 +1,7 @@ import configparser import os -version_code = [5, 11, 5] +version_code = [5, 12] version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') dependency_version = 21 diff --git a/modules/impact/segs_nodes.py b/modules/impact/segs_nodes.py index 751bf5ff..c91b513d 100644 --- a/modules/impact/segs_nodes.py +++ b/modules/impact/segs_nodes.py @@ -730,6 +730,23 @@ def doit(self, **kwargs): return ((dim, res), ) +class Count_Elts_in_SEGS: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "segs": ("SEGS", ), + }, + } + + RETURN_TYPES = ("INT",) + FUNCTION = "doit" + + CATEGORY = "ImpactPack/Util" + + def doit(self, segs): + return (len(segs[1]), ) + + class DecomposeSEGS: @classmethod def INPUT_TYPES(s): diff --git a/modules/impact/util_nodes.py b/modules/impact/util_nodes.py index fd85e703..1a73992c 100644 --- a/modules/impact/util_nodes.py +++ b/modules/impact/util_nodes.py @@ -6,6 +6,7 @@ import sys import nodes import re +from server import PromptServer class GeneralSwitch: @@ -196,8 +197,9 @@ class ImpactLogger: def INPUT_TYPES(s): return {"required": { "data": (any_typ, ""), + "text": ("STRING", {"multiline": True}), }, - "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, + "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO", "unique_id": "UNIQUE_ID"}, } CATEGORY = "ImpactPack/Debug" @@ -207,7 +209,7 @@ def INPUT_TYPES(s): RETURN_TYPES = () FUNCTION = "doit" - def doit(self, data, prompt, extra_pnginfo): + def doit(self, data, text, prompt, extra_pnginfo, unique_id): shape = "" if hasattr(data, "shape"): shape = f"{data.shape} / " @@ -218,12 +220,13 @@ def doit(self, data, prompt, extra_pnginfo): # for x in prompt: # if 'inputs' in x and 'populated_text' in x['inputs']: - # print(f"PROMP: {x['10']['inputs']['populated_text']}") + # 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 {} diff --git a/pyproject.toml b/pyproject.toml index 8c71c3ea..8a37ba62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-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." -version = "5.11.5" +version = "5.12" license = "LICENSE" dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]