Add files via upload
This commit is contained in:
@@ -1577,6 +1577,9 @@ class Hub:
|
||||
def execute(self, _id = None, _prompt = None, _workflow = None, **kwargs):
|
||||
# [TODO] Maybe set OUTPUT_IS_LIST depends on widget?
|
||||
# And allow dumping "node:..."?
|
||||
|
||||
# [TODO] Change __BATCH__ to __BATCH_PRIM__
|
||||
# Which means we have to touch fixes.js
|
||||
|
||||
res_data = {}
|
||||
temp_data = {}
|
||||
@@ -1608,7 +1611,6 @@ class Hub:
|
||||
case "__BATCH__":
|
||||
res_data[index_temp] = []
|
||||
for index_type in type_data:
|
||||
# if type_data[index_type] == kwargs[name_data[index_temp]][0]:
|
||||
if type_data[index_type] == temp_data[index_temp]:
|
||||
res_data[index_temp].extend(res_data[index_type])
|
||||
case "__PIPE__":
|
||||
@@ -1636,6 +1638,9 @@ class Hub:
|
||||
res_data[index_temp] = [temp_res_data]
|
||||
else:
|
||||
raise Exception(f"Invalid pipe type \"{temp_data[index_temp]}\".")
|
||||
|
||||
if len(res_data) == 0:
|
||||
raise Exception("No output.")
|
||||
|
||||
return {
|
||||
"ui": {
|
||||
@@ -1690,4 +1695,4 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"0246.Hub": "Hub",
|
||||
}
|
||||
|
||||
print("\033[95m" + lib0246.HEAD_LOG + "Loaded all nodes and apis (/0246-parse)." + "\033[0m")
|
||||
print("\033[95m" + lib0246.HEAD_LOG + "Loaded all nodes and apis (/0246-parse)." + "\033[0m")
|
||||
+29
-13
@@ -306,20 +306,34 @@ const patch_node_db = [
|
||||
["Stringify", "0246.Stringify"],
|
||||
];
|
||||
|
||||
lib0246.hijack(app, "loadGraphData", function (workflow) {
|
||||
if (workflow && !workflow?.extra?.["0246.VERSION"]) {
|
||||
let PATCH_SIG = [];
|
||||
|
||||
for (let i = 0; i < workflow.nodes.length; ++ i)
|
||||
for (let j = 0; j < patch_node_db.length; ++ j) {
|
||||
if (workflow.nodes[i].type === patch_node_db[j][0]) {
|
||||
console.warn(`[ComfyUI-0246] Patching node "${workflow.nodes[i].type}" to "${patch_node_db[j][1]}"`);
|
||||
workflow.nodes[i].type = patch_node_db[j][1];
|
||||
break;
|
||||
} else if (workflow.nodes[i].type === patch_node_db[j][1])
|
||||
break;
|
||||
}
|
||||
lib0246.hijack(app, "loadGraphData", function (workflow) {
|
||||
if (workflow) {
|
||||
if (!workflow?.extra?.["0246.VERSION"])
|
||||
for (let i = 0; i < workflow.nodes.length; ++ i)
|
||||
for (let j = 0; j < patch_node_db.length; ++ j) {
|
||||
if (workflow.nodes[i].type === patch_node_db[j][0]) {
|
||||
console.warn(`[ComfyUI-0246] Patching node "${workflow.nodes[i].type}" to "${patch_node_db[j][1]}"`);
|
||||
workflow.nodes[i].type = patch_node_db[j][1];
|
||||
break;
|
||||
} else if ((workflow.nodes[i].type === "0246.Highway" || workflow.nodes[i].type === "0246.HighwayBatch") && !PATCH_SIG.includes(1))
|
||||
PATCH_SIG.push(1);
|
||||
else if (workflow.nodes[i].type === patch_node_db[j][1])
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, () => {});
|
||||
}, function (workflow) {
|
||||
if (PATCH_SIG.includes(1))
|
||||
for (let i = 0; i < app.graph._nodes.length; ++ i)
|
||||
if (app.graph._nodes[i].type === "0246.Highway" || app.graph._nodes[i].type === "0246.HighwayBatch") {
|
||||
for (let j = 0; j < app.graph._nodes[i].widgets.length; ++ j)
|
||||
if (app.graph._nodes[i].widgets[j].name === "Update") {
|
||||
app.graph._nodes[i].widgets[j].callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let error_flag = false;
|
||||
lib0246.hijack(app, "showMissingNodesError", function (nodes) {
|
||||
@@ -353,7 +367,9 @@ lib0246.hijack(app, "showMissingNodesError", function (nodes) {
|
||||
app.registerExtension({
|
||||
name: "0246.Fixes",
|
||||
async setup(app) {
|
||||
app.graph.extra["0246.VERSION"] = [0, 0, 2]; // Only used when breaking changes happen
|
||||
window.setTimeout(() => {
|
||||
app.graph.extra["0246.VERSION"] = app.graph.extra["0246.VERSION"] ?? [0, 0, 3]; // Only used when breaking changes happen
|
||||
}, 0);
|
||||
|
||||
if (LiteGraph.Nodes.RerouteNode) {
|
||||
// Hijack Reroute (rgthree) to do onConnectOutput and onConnectInput
|
||||
|
||||
+22
-8
@@ -606,14 +606,14 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
case 1: {
|
||||
if (BLACKLIST.includes(this.inputs[link_info.target_slot].name) || link_info.replaced)
|
||||
return;
|
||||
this.inputs[link_info.target_slot].name = app.graph.extra["0246.__NAME__"][this.id]["inputs"][link_info.target_slot]["name"];
|
||||
if (app.graph.extra["0246.__NAME__"][this.id]["inputs"][link_info.target_slot]["type"] === "*")
|
||||
this.inputs[link_info.target_slot].name = app.graph.extra["0246.__NAME__"]?.[this.id]["inputs"][link_info.target_slot]["name"] ?? this.inputs[link_info.target_slot].name;
|
||||
if (app.graph.extra["0246.__NAME__"]?.[this.id]["inputs"][link_info.target_slot]["type"] === "*" || !app.graph.extra["0246.__NAME__"])
|
||||
this.inputs[link_info.target_slot].type = "*";
|
||||
} break;
|
||||
case 2: {
|
||||
if (this.outputs[link_info.origin_slot].links.length === 0 && !BLACKLIST.includes(this.outputs[link_info.origin_slot].name)) {
|
||||
this.outputs[link_info.origin_slot].name = app.graph.extra["0246.__NAME__"][this.id]["outputs"][link_info.origin_slot]["name"];
|
||||
if (app.graph.extra["0246.__NAME__"][this.id]["outputs"][link_info.origin_slot]["type"] === "*")
|
||||
this.outputs[link_info.origin_slot].name = app.graph.extra["0246.__NAME__"]?.[this.id]["outputs"][link_info.origin_slot]["name"] ?? this.outputs[link_info.origin_slot].name;
|
||||
if (app.graph.extra["0246.__NAME__"]?.[this.id]["outputs"][link_info.origin_slot]["type"] === "*" || !app.graph.extra["0246.__NAME__"])
|
||||
this.outputs[link_info.origin_slot].type = "*";
|
||||
}
|
||||
} break;
|
||||
@@ -933,7 +933,7 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
if (!BLACKLIST.includes(node.inputs[i].name) && node.inputs[i].link !== null)
|
||||
prev.push({
|
||||
flag: false,
|
||||
name: app.graph.extra["0246.__NAME__"][node.id]["inputs"][i]["name"],
|
||||
name: app.graph.extra["0246.__NAME__"]?.[node.id]["inputs"][i]["name"] ?? null,
|
||||
node_id: app.graph.links[node.inputs[i].link].origin_id,
|
||||
slot_id: app.graph.links[node.inputs[i].link].origin_slot,
|
||||
});
|
||||
@@ -966,7 +966,7 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
for (let j = 0; j < node.outputs[i].links.length; ++ j)
|
||||
prev.push({
|
||||
flag: true,
|
||||
name: app.graph.extra["0246.__NAME__"][node.id]["outputs"][i]["name"],
|
||||
name: app.graph.extra["0246.__NAME__"]?.[node.id]["outputs"][i]["name"] ?? null,
|
||||
node_id: app.graph.links[node.outputs[i].links[j]].target_id,
|
||||
slot_id: app.graph.links[node.outputs[i].links[j]].target_slot,
|
||||
});
|
||||
@@ -997,7 +997,13 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
for (let i = 0; i < prev.length; ++ i) {
|
||||
// Check if input/output still exists
|
||||
if (prev[i].flag) {
|
||||
for (let j = 0; j < node.outputs.length; ++ j)
|
||||
if (prev[i].name === null)
|
||||
node.connect(
|
||||
i,
|
||||
prev[i].node_id,
|
||||
prev[i].slot_id
|
||||
);
|
||||
else for (let j = 0; j < node.outputs.length; ++ j) {
|
||||
if (app.graph.extra["0246.__NAME__"][node.id]["outputs"][j]["name"].slice(0) === prev[i].name.slice(0)) {
|
||||
node.connect(
|
||||
j,
|
||||
@@ -1006,8 +1012,15 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let j = 0; j < node.inputs.length; ++ j)
|
||||
if (prev[i].name === null)
|
||||
app.graph.getNodeById(prev[i].node_id).connect(
|
||||
prev[i].slot_id,
|
||||
node,
|
||||
i
|
||||
);
|
||||
else for (let j = 0; j < node.inputs.length; ++ j) {
|
||||
if (app.graph.extra["0246.__NAME__"][node.id]["inputs"][j]["name"].slice(1) === prev[i].name.slice(1)) {
|
||||
app.graph.getNodeById(prev[i].node_id).connect(
|
||||
prev[i].slot_id,
|
||||
@@ -1016,6 +1029,7 @@ let defs, node_defs = [], type_defs = new Set();
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user