From cceb530395741f0eac67b367acd831fea0dbc925 Mon Sep 17 00:00:00 2001
From: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
Date: Sat, 8 Apr 2023 14:50:57 +0100
Subject: [PATCH 1/3] Adds warning when loading graph with nodes you dont have
---
web/scripts/app.js | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/web/scripts/app.js b/web/scripts/app.js
index a687eb5c2..695d4a5d0 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -864,9 +864,15 @@ class ComfyApp {
graphData = structuredClone(defaultGraph);
}
- // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now
+ let missingNodeTypes = [];
for (let n of graphData.nodes) {
+ // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now
if (n.type == "T2IAdapterLoader") n.type = "ControlNetLoader";
+
+ // Find missing node types
+ if (!(n.type in LiteGraph.registered_node_types)) {
+ missingNodeTypes.push(n.type);
+ }
}
this.graph.configure(graphData);
@@ -893,6 +899,14 @@ class ComfyApp {
this.#invokeExtensions("loadedGraphNode", node);
}
+
+ if (missingNodeTypes.length) {
+ this.ui.dialog.show(
+ `When loading the graph, the following node types were not found:
${missingNodeTypes.map(
+ (t) => `- ${t}
`
+ )}
Nodes that have failed to load will show as red on the graph.`
+ );
+ }
}
/**
From aad71add699a136eb865f89db8bb6a350d49b417 Mon Sep 17 00:00:00 2001
From: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
Date: Sat, 8 Apr 2023 14:52:24 +0100
Subject: [PATCH 2/3] const
---
web/scripts/app.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/scripts/app.js b/web/scripts/app.js
index 695d4a5d0..dee4f65ac 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -864,7 +864,7 @@ class ComfyApp {
graphData = structuredClone(defaultGraph);
}
- let missingNodeTypes = [];
+ const missingNodeTypes = [];
for (let n of graphData.nodes) {
// Patch T2IAdapterLoader to ControlNetLoader since they are the same node now
if (n.type == "T2IAdapterLoader") n.type = "ControlNetLoader";
From 92e912c065c866054ff38eeca4045c6ee4e23f47 Mon Sep 17 00:00:00 2001
From: pythongosssss <125205205+pythongosssss@users.noreply.github.com>
Date: Sat, 8 Apr 2023 16:55:09 +0100
Subject: [PATCH 3/3] Fix multiple missing
---
web/scripts/app.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/scripts/app.js b/web/scripts/app.js
index dee4f65ac..10019ce82 100644
--- a/web/scripts/app.js
+++ b/web/scripts/app.js
@@ -902,9 +902,9 @@ class ComfyApp {
if (missingNodeTypes.length) {
this.ui.dialog.show(
- `When loading the graph, the following node types were not found: ${missingNodeTypes.map(
+ `When loading the graph, the following node types were not found: ${Array.from(new Set(missingNodeTypes)).map(
(t) => `- ${t}
`
- )}
Nodes that have failed to load will show as red on the graph.`
+ ).join("")}
Nodes that have failed to load will show as red on the graph.`
);
}
}