improve: InversedSwitch - now use ExecutionBlocker for unselected output

This commit is contained in:
Dr.Lt.Data
2024-08-24 12:05:40 +09:00
parent 0a7dbe45a9
commit e325d1b208
3 changed files with 20 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import configparser
import os
version_code = [7, 1, 1]
version_code = [7, 2]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
dependency_version = 22
+18 -2
View File
@@ -1,5 +1,6 @@
from impact.utils import any_typ, ByPassTypeTuple, make_3d_mask
import comfy_extras.nodes_mask
from comfy_execution.graph import ExecutionBlocker
from nodes import MAX_RESOLUTION
import torch
import comfy
@@ -145,10 +146,12 @@ class GeneralInversedSwitch:
return {"required": {
"select": ("INT", {"default": 1, "min": 1, "max": 999999, "step": 1}),
"input": (any_typ,),
},
"optional": {
"sel_mode": ("BOOLEAN", {"default": False, "label_on": "select_on_prompt", "label_off": "select_on_execution", "forceInput": False}),
},
"hidden": {"prompt": "PROMPT", "unique_id": "UNIQUE_ID"},
}
RETURN_TYPES = ByPassTypeTuple((any_typ, ))
@@ -156,12 +159,25 @@ class GeneralInversedSwitch:
CATEGORY = "ImpactPack/Util"
def doit(self, select, input, **kwargs):
def doit(self, select, prompt, unique_id, input, **kwargs):
if core.is_execution_model_version_supported:
from comfy_execution.graph import ExecutionBlocker
res = []
for i in range(0, select):
# 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)
+1 -1
View File
@@ -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 = "7.1.1"
version = "7.2"
license = { file = "LICENSE.txt" }
dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]