improve: better ImpactInversedSwitch

This commit is contained in:
Dr.Lt.Data
2023-12-20 21:40:45 +09:00
parent b02d288635
commit 3a28fe18c6
4 changed files with 22 additions and 5 deletions
+2
View File
@@ -428,3 +428,5 @@ The tile sampler allows high-resolution sampling even in places with low GPU VRA
BlenderNeok/[ComfyUI_Noise](https://github.com/BlenderNeko/ComfyUI_Noise) - The noise injection feature relies on this function.
WASasquatch/[was-node-suite-comfyui](https://github.com/WASasquatch/was-node-suite-comfyui) - A powerful custom node extensions of ComfyUI.
Trung0246/[ComfyUI-0246](https://github.com/Trung0246/ComfyUI-0246) - Nice bypass hack!
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version = "V4.48.7"
version = "V4.48.8"
dependency_version = 19
+2 -2
View File
@@ -1,4 +1,4 @@
from impact.utils import any_typ
from impact.utils import any_typ, ByPassTypeTuple
import comfy_extras.nodes_mask
from nodes import MAX_RESOLUTION
@@ -55,7 +55,7 @@ class GeneralInversedSwitch:
"hidden": {"unique_id": "UNIQUE_ID"},
}
RETURN_TYPES = tuple([any_typ] * 100)
RETURN_TYPES = ByPassTypeTuple((any_typ, ))
FUNCTION = "doit"
CATEGORY = "ImpactPack/Util"
+17 -2
View File
@@ -468,6 +468,22 @@ def apply_mask_alpha_to_pil(decoded_pil, mask):
return decoded_rgba
# author: Trung0246 --->
class TautologyStr(str):
def __ne__(self, other):
return False
class ByPassTypeTuple(tuple):
def __getitem__(self, index):
if index > 0:
index = 0
item = super().__getitem__(index)
if isinstance(item, str):
return TautologyStr(item)
return item
class NonListIterable:
def __init__(self, data):
self.data = data
@@ -476,7 +492,6 @@ class NonListIterable:
return self.data[index]
# author: Trung0246
def add_folder_path_and_extensions(folder_name, full_folder_paths, extensions):
# Iterate over the list of full folder paths
for full_folder_path in full_folder_paths:
@@ -496,7 +511,7 @@ def add_folder_path_and_extensions(folder_name, full_folder_paths, extensions):
# Now we just need to update the set of extensions as it would be an empty set
# Also ensure that all paths are included (since add_model_folder_path adds only one path at a time)
folder_paths.folder_names_and_paths[folder_name] = (full_folder_paths, extensions)
# <---
# wildcard trick is taken from pythongossss's
class AnyType(str):