Merge branch 'comfyanonymous:master' into batched_noise

This commit is contained in:
FizzleDorf 2023-12-04 01:30:02 -05:00 committed by GitHub
commit 07016664b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 6 deletions

View File

@ -475,6 +475,16 @@ export class GroupNodeConfig {
} }
static async registerFromWorkflow(groupNodes, missingNodeTypes) { static async registerFromWorkflow(groupNodes, missingNodeTypes) {
const clean = app.clean;
app.clean = function () {
for (const g in groupNodes) {
try {
LiteGraph.unregisterNodeType("workflow/" + g);
} catch (error) {}
}
app.clean = clean;
};
for (const g in groupNodes) { for (const g in groupNodes) {
const groupData = groupNodes[g]; const groupData = groupNodes[g];
@ -482,7 +492,24 @@ export class GroupNodeConfig {
for (const n of groupData.nodes) { for (const n of groupData.nodes) {
// Find missing node types // Find missing node types
if (!(n.type in LiteGraph.registered_node_types)) { if (!(n.type in LiteGraph.registered_node_types)) {
missingNodeTypes.push(n.type); missingNodeTypes.push({
type: n.type,
hint: ` (In group node 'workflow/${g}')`,
});
missingNodeTypes.push({
type: "workflow/" + g,
action: {
text: "Remove from workflow",
callback: (e) => {
delete groupNodes[g];
e.target.textContent = "Removed";
e.target.style.pointerEvents = "none";
e.target.style.opacity = 0.7;
},
},
});
hasMissing = true; hasMissing = true;
} }
} }

View File

@ -164,7 +164,7 @@ class ManageTemplates extends ComfyDialog {
var prev_i = el.dataset.id; var prev_i = el.dataset.id;
if ( el == this.draggedEl && prev_i != i ) { if ( el == this.draggedEl && prev_i != i ) {
[this.templates[i], this.templates[prev_i]] = [this.templates[prev_i], this.templates[i]]; this.templates.splice(i, 0, this.templates.splice(prev_i, 1)[0]);
} }
el.dataset.id = i; el.dataset.id = i;
}); });

View File

@ -1519,14 +1519,36 @@ export class ComfyApp {
} }
showMissingNodesError(missingNodeTypes, hasAddedNodes = true) { showMissingNodesError(missingNodeTypes, hasAddedNodes = true) {
let seenTypes = new Set();
this.ui.dialog.show( this.ui.dialog.show(
$el("div", [ $el("div.comfy-missing-nodes", [
$el("span", { textContent: "When loading the graph, the following node types were not found: " }), $el("span", { textContent: "When loading the graph, the following node types were not found: " }),
$el( $el(
"ul", "ul",
Array.from(new Set(missingNodeTypes)).map((t) => $el("li", { textContent: t })) Array.from(new Set(missingNodeTypes)).map((t) => {
let children = [];
if (typeof t === "object") {
if(seenTypes.has(t.type)) return null;
seenTypes.add(t.type);
children.push($el("span", { textContent: t.type }));
if (t.hint) {
children.push($el("span", { textContent: t.hint }));
}
if (t.action) {
children.push($el("button", { onclick: t.action.callback, textContent: t.action.text }));
}
} else {
if(seenTypes.has(t)) return null;
seenTypes.add(t);
children.push($el("span", { textContent: t }));
}
return $el("li", children);
}).filter(Boolean)
), ),
...(hasAddedNodes ? [$el("span", { textContent: "Nodes that have failed to load will show as red on the graph." })] : []), ...(hasAddedNodes
? [$el("span", { textContent: "Nodes that have failed to load will show as red on the graph." })]
: []),
]) ])
); );
this.logging.addEntry("Comfy.App", "warn", { this.logging.addEntry("Comfy.App", "warn", {
@ -1682,7 +1704,8 @@ export class ComfyApp {
const output = {}; const output = {};
// Process nodes in order of execution // Process nodes in order of execution
for (const outerNode of this.graph.computeExecutionOrder(false)) { for (const outerNode of this.graph.computeExecutionOrder(false)) {
const innerNodes = outerNode.getInnerNodes ? outerNode.getInnerNodes() : [outerNode]; const skipNode = outerNode.mode === 2 || outerNode.mode === 4;
const innerNodes = (!skipNode && outerNode.getInnerNodes) ? outerNode.getInnerNodes() : [outerNode];
for (const node of innerNodes) { for (const node of innerNodes) {
if (node.isVirtualNode) { if (node.isVirtualNode) {
continue; continue;

View File

@ -424,6 +424,11 @@ dialog::backdrop {
height: var(--comfy-img-preview-height); height: var(--comfy-img-preview-height);
} }
.comfy-missing-nodes li button {
font-size: 12px;
margin-left: 5px;
}
/* Search box */ /* Search box */
.litegraph.litesearchbox { .litegraph.litesearchbox {