mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-21 20:00:17 +08:00
Minor refactor of IsChangedCache.get
This commit is contained in:
parent
b3e547f22b
commit
fa48ad3a1f
40
execution.py
40
execution.py
@ -33,24 +33,28 @@ class IsChangedCache:
|
|||||||
self.is_changed = {}
|
self.is_changed = {}
|
||||||
|
|
||||||
def get(self, node_id):
|
def get(self, node_id):
|
||||||
if node_id not in self.is_changed:
|
if node_id in self.is_changed:
|
||||||
node = self.dynprompt.get_node(node_id)
|
return self.is_changed[node_id]
|
||||||
class_type = node["class_type"]
|
|
||||||
class_def = nodes.NODE_CLASS_MAPPINGS[class_type]
|
node = self.dynprompt.get_node(node_id)
|
||||||
if hasattr(class_def, "IS_CHANGED"):
|
class_type = node["class_type"]
|
||||||
if "is_changed" in node:
|
class_def = nodes.NODE_CLASS_MAPPINGS[class_type]
|
||||||
self.is_changed[node_id] = node["is_changed"]
|
if not hasattr(class_def, "IS_CHANGED"):
|
||||||
else:
|
self.is_changed[node_id] = False
|
||||||
input_data_all, _ = get_input_data(node["inputs"], class_def, node_id, self.outputs_cache)
|
return self.is_changed[node_id]
|
||||||
try:
|
|
||||||
is_changed = map_node_over_list(class_def, input_data_all, "IS_CHANGED")
|
if "is_changed" in node:
|
||||||
node["is_changed"] = [None if isinstance(x, ExecutionBlocker) else x for x in is_changed]
|
self.is_changed[node_id] = node["is_changed"]
|
||||||
self.is_changed[node_id] = node["is_changed"]
|
return self.is_changed[node_id]
|
||||||
except:
|
|
||||||
node["is_changed"] = float("NaN")
|
input_data_all, _ = get_input_data(node["inputs"], class_def, node_id, self.outputs_cache)
|
||||||
self.is_changed[node_id] = node["is_changed"]
|
try:
|
||||||
else:
|
is_changed = map_node_over_list(class_def, input_data_all, "IS_CHANGED")
|
||||||
self.is_changed[node_id] = False
|
node["is_changed"] = [None if isinstance(x, ExecutionBlocker) else x for x in is_changed]
|
||||||
|
except:
|
||||||
|
node["is_changed"] = float("NaN")
|
||||||
|
finally:
|
||||||
|
self.is_changed[node_id] = node["is_changed"]
|
||||||
return self.is_changed[node_id]
|
return self.is_changed[node_id]
|
||||||
|
|
||||||
class CacheSet:
|
class CacheSet:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user