From 41a08f6948b3d148c7422da3f68983111b9c58f3 Mon Sep 17 00:00:00 2001 From: Jordan Thompson Date: Fri, 11 Aug 2023 00:42:05 -0700 Subject: [PATCH] Patch IS_CHANGED --- __init__.py | 2 +- nodes.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index 5072c72..455113a 100644 --- a/__init__.py +++ b/__init__.py @@ -5,7 +5,7 @@ NODE_CLASS_MAPPINGS = { } NODE_DISPLAY_NAME_MAPPINGS = { - "Preset_Model_Merge": "MergeModelPreset" + "Preset_Model_Merge": "ModelMergeByPreset" } __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] \ No newline at end of file diff --git a/nodes.py b/nodes.py index 5a8551d..19dcc18 100644 --- a/nodes.py +++ b/nodes.py @@ -1,5 +1,6 @@ import math import random +import hashlib from comfy_extras.nodes_model_merging import ModelMergeBlocks @@ -143,16 +144,16 @@ class Preset_Model_Merge: } @classmethod - def IS_CHANGED(cls, **kwargs): - if kwargs.__contains__('preset'): - if kwargs['preset'] == 'RANDOM': - return float("NaN") - else: - sha256_hash = hashlib.sha256() - sha256_hash.update(kwargs['preset'].encode('utf-8')) - return sha256_hash.hexdigest() + def IS_CHANGED(cls, preset): + print("Checking change state...") + if preset == 'RANDOM': + print("IS_CHANGED == True") + return float("NaN") else: - return 0 + print("IS_CHANGED == False") + sha256_hash = hashlib.sha256() + sha256_hash.update(kwargs['preset'].encode('utf-8')) + return sha256_hash.digest().hex() RETURN_TYPES = ("MODEL",) FUNCTION = "merge"