Merge branch 'comfyanonymous:master' into feature/maskpainting

This commit is contained in:
ltdrdata 2023-04-26 20:37:45 +09:00 committed by GitHub
commit ce55aa784a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 22 deletions

View File

@ -97,21 +97,25 @@ def recursive_output_delete_if_changed(prompt, old_prompt, outputs, current_item
is_changed_old = '' is_changed_old = ''
is_changed = '' is_changed = ''
to_delete = False
if hasattr(class_def, 'IS_CHANGED'): if hasattr(class_def, 'IS_CHANGED'):
if unique_id in old_prompt and 'is_changed' in old_prompt[unique_id]: if unique_id in old_prompt and 'is_changed' in old_prompt[unique_id]:
is_changed_old = old_prompt[unique_id]['is_changed'] is_changed_old = old_prompt[unique_id]['is_changed']
if 'is_changed' not in prompt[unique_id]: if 'is_changed' not in prompt[unique_id]:
input_data_all = get_input_data(inputs, class_def, unique_id, outputs) input_data_all = get_input_data(inputs, class_def, unique_id, outputs)
if input_data_all is not None: if input_data_all is not None:
try:
is_changed = class_def.IS_CHANGED(**input_data_all) is_changed = class_def.IS_CHANGED(**input_data_all)
prompt[unique_id]['is_changed'] = is_changed prompt[unique_id]['is_changed'] = is_changed
except:
to_delete = True
else: else:
is_changed = prompt[unique_id]['is_changed'] is_changed = prompt[unique_id]['is_changed']
if unique_id not in outputs: if unique_id not in outputs:
return True return True
to_delete = False if not to_delete:
if is_changed != is_changed_old: if is_changed != is_changed_old:
to_delete = True to_delete = True
elif unique_id not in old_prompt: elif unique_id not in old_prompt:
@ -152,6 +156,15 @@ class PromptExecutor:
self.server.client_id = None self.server.client_id = None
with torch.inference_mode(): with torch.inference_mode():
#delete cached outputs if nodes don't exist for them
to_delete = []
for o in self.outputs:
if o not in prompt:
to_delete += [o]
for o in to_delete:
d = self.outputs.pop(o)
del d
for x in prompt: 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)

View File

@ -136,9 +136,11 @@ function addMultilineWidget(node, name, opts, app) {
left: `${t.a * margin + t.e}px`, left: `${t.a * margin + t.e}px`,
top: `${t.d * (y + widgetHeight - margin - 3) + t.f}px`, top: `${t.d * (y + widgetHeight - margin - 3) + t.f}px`,
width: `${(widgetWidth - margin * 2 - 3) * t.a}px`, width: `${(widgetWidth - margin * 2 - 3) * t.a}px`,
background: (!node.color)?'':node.color,
height: `${(this.parent.inputHeight - margin * 2 - 4) * t.d}px`, height: `${(this.parent.inputHeight - margin * 2 - 4) * t.d}px`,
position: "absolute", position: "absolute",
zIndex: 1, color: (!node.color)?'':'white',
zIndex: app.graph._nodes.indexOf(node),
fontSize: `${t.d * 10.0}px`, fontSize: `${t.d * 10.0}px`,
}); });
this.inputEl.hidden = !visible; this.inputEl.hidden = !visible;