From 583c3d2270791d352d78f03d830eb4b8ba506d8c Mon Sep 17 00:00:00 2001 From: Sammy Franklin Date: Fri, 27 Oct 2023 16:41:42 -0700 Subject: [PATCH] fixed event for progress visual --- execution.py | 4 +++- web/extensions/core/subflow.js | 32 -------------------------------- web/scripts/app.js | 9 +++++---- 3 files changed, 8 insertions(+), 37 deletions(-) diff --git a/execution.py b/execution.py index 918c2bc5c..2ebae8ba0 100644 --- a/execution.py +++ b/execution.py @@ -143,7 +143,9 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data, execute input_data_all = get_input_data(inputs, class_def, unique_id, outputs, prompt, extra_data) if server.client_id is not None: server.last_node_id = unique_id - server.send_sync("executing", { "node": unique_id, "prompt_id": prompt_id }, server.client_id) + subflow_node = prompt[unique_id].get('for_subflow') + executing_node = unique_id if subflow_node is None else subflow_node + server.send_sync("executing", { "node": executing_node, "prompt_id": prompt_id }, server.client_id) obj = object_storage.get((unique_id, class_type), None) if obj is None: diff --git a/web/extensions/core/subflow.js b/web/extensions/core/subflow.js index 9db1154e1..2d1616e0f 100644 --- a/web/extensions/core/subflow.js +++ b/web/extensions/core/subflow.js @@ -65,36 +65,8 @@ app.registerExtension({ // Map widgets subflow.extras.widgetSlots = {}; - // const resolveWidgetPath = (thisNode, path, widgetIndex) => { - // const subflowNodes = thisNode.subflow.nodes; - - // let q = 0; // get what would be the q-th exported widget - // console.log(path); - // for (const subflowNode of subflowNodes) { - // const exportedWidgets = subflowNode.properties?.exports?.widgets; - // console.log("has nodes", q, widgetIndex); - // if (exportedWidgets) { - // console.log("in exports"); - // const childPath = `${path}${subflowNode.id}/`; - // for (const i in exportedWidgets) { - // console.log("exported Widgets",q, widgetIndex); - // if (widgetIndex == q) { - // console.log(subflowNode); - // if (subflowNode.subflow) { - // console.log("widget is inside subflow!") - // return resolveWidgetPath(subflowNode, childPath, i); - // } - // return `${childPath}${subflowNode.id}/`; - // } - // q++; - // } - // } - // } - // console.warn("couldn't export a widget"); - // }; const subflowNodes = subflow.nodes; - console.log(subflow.extras.widgetSlots); let widgetIndex = 1; for (const subflowNode of subflowNodes) { const exports = subflowNode.properties?.exports; @@ -131,8 +103,6 @@ app.registerExtension({ } } - console.log(subflow.extras.widgetSlots); - }; const refreshNode = (node, subflow, filename) => { @@ -143,8 +113,6 @@ app.registerExtension({ refreshPins(node, subflow); refreshWidgets(node, subflow, false); - - console.log("HAS", node.subflow.extras.inputSlots); node.size[0] = Math.max(100, LiteGraph.NODE_TEXT_SIZE * node.title.length * 0.45 + 100); }; diff --git a/web/scripts/app.js b/web/scripts/app.js index 31d3dbf02..6da924c4f 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -1623,11 +1623,10 @@ export class ComfyApp { for ( const [key, value] of Object.entries(subgraphPromptOutput) ) { output[key] = { ...value, - for_subflow: String(node.id) // keep reference of root level subflow node + for_subflow: String(node.id) // keep reference of root node for progress and execution events }; } - - // childNodeIdOffset += subgraph.last_node_id; + Object.assign(globalMappings, subgraphGlobalMappings); } @@ -1744,7 +1743,9 @@ export class ComfyApp { for (const o in output) { for (const i in output[o].inputs) { - if (Array.isArray(output[o].inputs[i]) && output[o].inputs[i].length === 2 && !output[output[o].inputs[i][0]]) { + if (Array.isArray(output[o].inputs[i]) + && output[o].inputs[i].length === 2 + && !output[output[o].inputs[i][0]]) { delete output[o].inputs[i]; } }