mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-11 22:12:33 +08:00
Fix reroutes updating to wildcards on graph load
The type of reroutes connected to primitive nodes may be lost when the graph is loaded, depending on the configuration order of nodes. Also fixed an error when a primitive widget callback is called and is connected to a reroute without output links.
This commit is contained in:
parent
c226b2615a
commit
3d9f4229c1
@ -55,6 +55,7 @@ app.registerExtension({
|
||||
let updateNodes = [];
|
||||
let inputType = null;
|
||||
let inputNode = null;
|
||||
let rootNode = null;
|
||||
while (currentNode) {
|
||||
updateNodes.unshift(currentNode);
|
||||
const linkId = currentNode.inputs[0].link;
|
||||
@ -76,6 +77,7 @@ app.registerExtension({
|
||||
// We've found the end
|
||||
inputNode = currentNode;
|
||||
inputType = node.outputs[link.origin_slot]?.type ?? null;
|
||||
rootNode = node;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -123,6 +125,11 @@ app.registerExtension({
|
||||
}
|
||||
}
|
||||
|
||||
if (rootNode?.constructor.type === "PrimitiveNode" && inputType === "*") {
|
||||
// Primitive doesn't have type yet, skip update
|
||||
return;
|
||||
}
|
||||
|
||||
const displayType = (inputType === "*" && outputType) || inputType || outputType || "*";
|
||||
const color = LGraphCanvas.link_type_colors[displayType];
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ app.registerExtension({
|
||||
|
||||
function get_links(node) {
|
||||
let links = [];
|
||||
for (const l of node.outputs[0].links) {
|
||||
for (const l of node.outputs[0].links ?? []) {
|
||||
const linkInfo = app.graph.links[l];
|
||||
const n = node.graph.getNodeById(linkInfo.target_id);
|
||||
if (n.type == "Reroute") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user