From d5941127a7a69be5c18916e7aa6c5fe47808aa96 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 30 Apr 2025 22:26:50 +1000 Subject: [PATCH] #87 --- __init__.py | 2 +- js/image_filter.js | 5 ++--- js/popup.js | 1 - list_utility_nodes.py | 15 +++------------ pyproject.toml | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/__init__.py b/__init__.py index 86ffb45..e4fdbd4 100644 --- a/__init__.py +++ b/__init__.py @@ -9,7 +9,7 @@ from .image_filter import ImageFilter, MaskImageFilter, TextImageFilterWithExtra from .list_utility_nodes import PickFromList, BatchFromImageList, ImageListFromBatch from .string_utility_nodes import SplitByCommas, StringToFloat, StringToInt -VERSION = "1.4.1" +VERSION = "1.4.2" WEB_DIRECTORY = "./js" NODE_CLASS_MAPPINGS= { diff --git a/js/image_filter.js b/js/image_filter.js index 3fc5d77..43d76b4 100644 --- a/js/image_filter.js +++ b/js/image_filter.js @@ -66,11 +66,10 @@ app.registerExtension({ this.outputs[0].type = type this.inputs[0].type = type } + return onConnectionsChange ? onConnectionsChange.apply(this, arguments) : undefined; } } if (FILTER_TYPES.includes(nodeType.comfyClass )) { - nodeType.prototype.choose_id = function() { this._ni_widget.value = Math.floor(Math.random() * 1000000) } - const onNodeCreated = nodeType.prototype.onNodeCreated; nodeType.prototype.onNodeCreated = function () { this._ni_widget = this.widgets.find((n)=>n.name=='node_identifier') @@ -79,8 +78,8 @@ app.registerExtension({ } this._ni_widget.hidden = true this._ni_widget.computeSize = () => [0,0] + this._ni_widget.value = Math.floor(Math.random() * 1000000) - this.choose_id() return onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined; } } diff --git a/js/popup.js b/js/popup.js index 647fcdc..9876856 100644 --- a/js/popup.js +++ b/js/popup.js @@ -126,7 +126,6 @@ class Popup extends HTMLSpanElement { close() { this.state = State.INACTIVE - this.node.choose_id() State.render(this) } diff --git a/list_utility_nodes.py b/list_utility_nodes.py index 0fad3ee..6ea6ac5 100644 --- a/list_utility_nodes.py +++ b/list_utility_nodes.py @@ -1,14 +1,5 @@ import torch -from json import JSONEncoder - -def _default(self, obj): return getattr(obj.__class__, "to_json", _default.default)(obj) -_default.default = JSONEncoder().default -JSONEncoder.default = _default - -class AlwaysEqual: - def to_json(self): return "*" - def __ne__(self, __value: object) -> bool: return False - def __eq__(self, __value: object) -> bool: return True +from comfy.comfy_types.node_typing import IO class BatchFromImageList: @classmethod @@ -47,11 +38,11 @@ class PickFromList: def INPUT_TYPES(s): return { "required": { - "anything" : (AlwaysEqual(), ), + "anything" : (IO.ANY, ), "indexes": ("STRING", {"default": ""}) }, } - RETURN_TYPES = (AlwaysEqual(),) + RETURN_TYPES = (IO.ANY,) RETURN_NAMES = ("picks",) FUNCTION = "func" diff --git a/pyproject.toml b/pyproject.toml index 21fa9c5..588534b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "cg-image-filter" description = "A set of custom nodes that pause a workflow while you select images, add masks, or edit text." -version = "1.4.1" +version = "1.4.2" license = { file = "LICENSE" } [project.urls]