diff --git a/README.md b/README.md index d097ada..9bb63cc 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ Tips: base64格式字符串比较长,会导致界面卡顿,接口请求带 | × | ImageSizeGetter | 获取图片尺寸(宽、高、最大边、最小边、批次) | | × | FilterSortDependSubGraphs | 使前置依赖子图按指定顺序执行(且只执行配置的前置依赖),如:配置filter_sort为1,4,3 表示按 depend_1 => depend_4 => depend_3 依次执行, 而depend_2不会被执行。 | | × | SortDependSubGraphs | 使前置依赖子图按指定顺序执行(未配置的依赖输入项在指定项后按默认顺序执行),如:配置sort为1,4 表示先按 depend_1 => depend_4 依次执行, 然后depend_3和depend_2按默认顺序执行。 | +| × | NoneNode | 返回None | ### 示例 ![save api extended](docs/example_note.png) @@ -103,6 +104,8 @@ Tips: base64格式字符串比较长,会导致界面卡顿,接口请求带 ![批量裁剪打标](example/example_image_crop_tag.png) ## 更新记录 +### 2025-03-28 (v1.1.4) +- 新增节点 NoneNode ### 2025-03-28 (v1.1.3) - 新增配置项 `allow_create_dir_when_save` 控制保存文本和图像时是否自动创建目录 - 新增节点 ImageSizeGetter、FilterSortDependSubGraphs、SortDependSubGraphs diff --git a/easyapi/UtilNode.py b/easyapi/UtilNode.py index dc60932..0d005bb 100644 --- a/easyapi/UtilNode.py +++ b/easyapi/UtilNode.py @@ -779,6 +779,18 @@ class LoadLocalFilePath: return image_paths, len(image_paths), relative_image_paths, directory, +class NoneNode: + @classmethod + def INPUT_TYPES(s): + return {} + RETURN_TYPES = (any_type,) + RETURN_NAMES = ("none",) + FUNCTION = "execute" + CATEGORY = "EasyApi/Utils" + DESCRIPTION = "判断输入是否为None、空列表、空字符串(trim后判断)、空字典" + + def execute(self): + return None, class IsNoneOrEmpty: @classmethod @@ -828,7 +840,7 @@ class IsNoneOrEmptyOptional: OUTPUT_IS_LIST = (True,) def execute(self, any=None, default=None): - if any is None or len(any) == 0: + if any is None or len(any) == 0 or any[0] is None: return default, if isinstance(any[0], (list, tuple, dict)): return (default if len(any[0]) == 0 else any,) @@ -837,7 +849,7 @@ class IsNoneOrEmptyOptional: return (any,) def check_lazy_status(self, any=None, default=None): - if any is None or len(any) == 0: + if any is None or len(any) == 0 or any[0] is None: return ["default"] if isinstance(any[0], (list, tuple, dict)): return ["default"] if len(any[0]) == 0 else ["any"] @@ -1211,6 +1223,7 @@ NODE_CLASS_MAPPINGS = { "ConvertToJsonStr": ConvertToJsonStr, "FilterValueForList": FilterValueForList, "LoadLocalFilePath": LoadLocalFilePath, + "NoneNode": NoneNode, "IsNoneOrEmpty": IsNoneOrEmpty, "IsNoneOrEmptyOptional": IsNoneOrEmptyOptional, "EmptyOutputNode": EmptyOutputNode, @@ -1253,6 +1266,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "ConvertToJsonStr": "ConvertToJsonStr", "FilterValueForList": "FilterValueForList", "LoadLocalFilePath": "LoadLocalFilePath", + "NoneNode": "NoneNode", "IsNoneOrEmpty": "IsNoneOrEmpty", "IsNoneOrEmptyOptional": "IsNoneOrEmptyOptional", "EmptyOutputNode": "EmptyOutputNode", diff --git a/pyproject.toml b/pyproject.toml index 1dbe6c7..e0ac15a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-easyapi-nodes" description = "Provides some features and nodes related to API calls. 开发独立应用调用ComfyUI服务的一些补充节点。" -version = "1.1.3" +version = "1.1.4" license = { file = "LICENSE" } dependencies = ["segment_anything", "simple_lama_inpainting", "insightface", "simplejson", "pycocotools"]