From a1d844667034bc2ed2b8806187488d27bf4d6c71 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Tue, 19 Aug 2025 07:01:53 +0900 Subject: [PATCH] =?UTF-8?q?fixed:=20switch=20nodes=20=E2=80=93=20compatibi?= =?UTF-8?q?lity=20fix=20from=20subgraph=20feature=20refactor:=20ruff=20che?= =?UTF-8?q?ck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/1071 --- __init__.py | 2 +- js/impact-pack.js | 13 +++++++++++++ modules/impact/config.py | 2 +- modules/impact/impact_pack.py | 14 ++++++++------ pyproject.toml | 2 +- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index cec919b..ee98aca 100644 --- a/__init__.py +++ b/__init__.py @@ -117,7 +117,7 @@ NODE_CLASS_MAPPINGS = { "UnsamplerHookProvider": UnsamplerHookProvider, # noqa: F405 "CoreMLDetailerHookProvider": CoreMLDetailerHookProvider, # noqa: F405 "PreviewDetailerHookProvider": PreviewDetailerHookProvider, # noqa: F405 - "BlackPatchRetryHookProvider": BlackPatchRetryHookProvider, + "BlackPatchRetryHookProvider": BlackPatchRetryHookProvider, # noqa: F405 "CustomSamplerDetailerHookProvider": CustomSamplerDetailerHookProvider, # noqa: F405 "LamaRemoverDetailerHookProvider": LamaRemoverDetailerHookProvider, # noqa: F405 diff --git a/js/impact-pack.js b/js/impact-pack.js index 60fe66c..7a46ffb 100644 --- a/js/impact-pack.js +++ b/js/impact-pack.js @@ -367,6 +367,13 @@ app.registerExtension({ if(!link_info) return; + // HOTFIX: subgraph + const stackTrace = new Error().stack; + + if(stackTrace.includes('convertToSubgraph')) { + return; + } + if(type == 2) { // connect output if(connected){ @@ -512,6 +519,12 @@ app.registerExtension({ const onConnectionsChange = nodeType.prototype.onConnectionsChange; nodeType.prototype.onConnectionsChange = function (type, index, connected, link_info) { const stackTrace = new Error().stack; + + // HOTFIX: subgraph + if(stackTrace.includes('convertToSubgraph')) { + return; + } + if(stackTrace.includes('loadGraphData')) { if(this.widgets?.[0]) { this.widgets[0].options.max = this.inputs.length-3; diff --git a/modules/impact/config.py b/modules/impact/config.py index 8d5ab9c..0d4d3c1 100644 --- a/modules/impact/config.py +++ b/modules/impact/config.py @@ -3,7 +3,7 @@ import os import logging -version_code = [8, 22] +version_code = [8, 22, 1] version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') my_path = os.path.dirname(__file__) diff --git a/modules/impact/impact_pack.py b/modules/impact/impact_pack.py index 31cefe3..cc5854c 100644 --- a/modules/impact/impact_pack.py +++ b/modules/impact/impact_pack.py @@ -528,7 +528,7 @@ class DetailerForEachAutoRetry: is_mask_all_zeros = (seg.cropped_mask == 0).all().item() if is_mask_all_zeros: - print(f"Detailer: segment skip [empty mask]") + print("Detailer: segment skip [empty mask]") continue if noise_mask: @@ -575,6 +575,11 @@ class DetailerForEachAutoRetry: break orig_cropped_image = cropped_image.clone() + + # initialize + enhanced_image = cropped_image + cnet_pils = None + if not (isinstance(model, str) and model == "DUMMY"): for retry in range(max_retries): enhanced_image, cnet_pils = core.enhance_detail(cropped_image, model, clip, vae, guide_size, guide_size_for_bbox, max_size, @@ -596,14 +601,11 @@ class DetailerForEachAutoRetry: raise Exception("Max retries reached") else: print("Detect bad patch, retrying...") - else: - enhanced_image = cropped_image - cnet_pils = None if cnet_pils is not None: cnet_pil_list.extend(cnet_pils) - if not (enhanced_image is None): + if enhanced_image is not None: # don't latent composite-> converting to latent caused poor quality # use image paste image = image.cpu() @@ -614,7 +616,7 @@ class DetailerForEachAutoRetry: if detailer_hook is not None: image = detailer_hook.post_paste(image) - if not (enhanced_image is None): + if enhanced_image is not None: # Convert enhanced_pil_alpha to RGBA mode enhanced_image_alpha = utils.tensor_convert_rgba(enhanced_image) new_seg_image = enhanced_image.numpy() # alpha should not be applied to seg_image diff --git a/pyproject.toml b/pyproject.toml index d11368c..aa47c4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-impact-pack" description = "This node pack offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler." -version = "8.22" +version = "8.22.1" license = { file = "LICENSE.txt" } dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]