mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-10 13:32:36 +08:00
support object_storage in IS_CHANGED
This commit is contained in:
parent
6f3d9f52db
commit
01cbf20899
14
execution.py
14
execution.py
@ -204,7 +204,7 @@ def recursive_will_execute(prompt, outputs, current_item):
|
||||
|
||||
return will_execute + [unique_id]
|
||||
|
||||
def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item):
|
||||
def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item, object_storage):
|
||||
unique_id = current_item
|
||||
inputs = prompt[unique_id]['inputs']
|
||||
class_type = prompt[unique_id]['class_type']
|
||||
@ -213,6 +213,12 @@ def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item
|
||||
is_changed_old = ''
|
||||
is_changed = ''
|
||||
to_delete = False
|
||||
|
||||
obj = object_storage.get((unique_id, class_type), None)
|
||||
if obj is None:
|
||||
obj = class_def()
|
||||
object_storage[(unique_id, class_type)] = obj
|
||||
|
||||
if hasattr(class_def, 'IS_CHANGED'):
|
||||
if unique_id in old_prompt and 'is_changed' in old_prompt[unique_id]:
|
||||
is_changed_old = old_prompt[unique_id]['is_changed']
|
||||
@ -221,7 +227,7 @@ def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item
|
||||
if input_data_all is not None:
|
||||
try:
|
||||
#is_changed = class_def.IS_CHANGED(**input_data_all)
|
||||
is_changed = map_node_over_list(class_def, input_data_all, "IS_CHANGED")
|
||||
is_changed = map_node_over_list(obj, input_data_all, "IS_CHANGED")
|
||||
prompt[unique_id]['is_changed'] = is_changed
|
||||
except:
|
||||
to_delete = True
|
||||
@ -244,7 +250,7 @@ def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item
|
||||
input_unique_id = input_data[0]
|
||||
output_index = input_data[1]
|
||||
if input_unique_id in outputs:
|
||||
to_delete = recursive_output_delete_if_changed(prompt, old_prompt, outputs, input_unique_id)
|
||||
to_delete = recursive_output_delete_if_changed(prompt, old_prompt, outputs, input_unique_id, object_storage)
|
||||
else:
|
||||
to_delete = True
|
||||
if to_delete:
|
||||
@ -340,7 +346,7 @@ class PromptExecutor:
|
||||
del d
|
||||
|
||||
for x in prompt:
|
||||
recursive_output_delete_if_changed(prompt, self.old_prompt, self.outputs, x)
|
||||
recursive_output_delete_if_changed(prompt, self.old_prompt, self.outputs, x, self.object_storage)
|
||||
|
||||
current_outputs = set(self.outputs.keys())
|
||||
for x in list(self.outputs_ui.keys()):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user